schema
stringlengths
28
5.65k
question
stringlengths
0
990
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
9.17k
weight
float64
0
8.95
CREATE TABLE table_29141354_2 (scores VARCHAR, jamie_and_johns_guest VARCHAR)
What were the scores when Jamie and Johns guest was Phillips Idowu?
SELECT scores FROM table_29141354_2 WHERE jamie_and_johns_guest = "Phillips Idowu"
SELECT "scores" FROM "table_29141354_2" WHERE "Phillips Idowu" = "jamie_and_johns_guest"
0.085938
CREATE TABLE table_9769 ("Episode #" TEXT, "Original airdate ( UK ) " TEXT, "Episode title" TEXT, "Doctor Who episode" TEXT, "Webcast link" TEXT)
Which Doctor Who episode has a Episode # of 11?
SELECT "Doctor Who episode" FROM table_9769 WHERE "Episode #" = '11'
SELECT "Doctor Who episode" FROM "table_9769" WHERE "Episode #" = '11'
0.068359
CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) 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 was hired before 2002-06-21, visualize a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday, and order the average of employee id in asc order.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(EMPLOYEE_ID)
SELECT "HIRE_DATE", AVG("EMPLOYEE_ID") FROM "employees" WHERE "HIRE_DATE" < '2002-06-21' ORDER BY AVG("EMPLOYEE_ID") NULLS FIRST
0.125
CREATE TABLE table_name_5 (bronze INT, nation VARCHAR, rank VARCHAR)
Which Bronze has a Nation of canada, and a Rank smaller than 6?
SELECT AVG(bronze) FROM table_name_5 WHERE nation = "canada" AND rank < 6
SELECT AVG("bronze") FROM "table_name_5" WHERE "canada" = "nation" AND "rank" < 6
0.079102
CREATE TABLE Maintenance_Contracts (maintenance_contract_id INT, maintenance_contract_company_id INT, contract_start_date DATETIME, contract_end_date DATETIME, other_contract_details VARCHAR) CREATE TABLE Skills (skill_id INT, skill_code VARCHAR, skill_description VARCHAR) CREATE TABLE Staff (staff_id INT, staff_name VARCHAR, gender VARCHAR, other_staff_details VARCHAR) CREATE TABLE Asset_Parts (asset_id INT, part_id INT) CREATE TABLE Maintenance_Engineers (engineer_id INT, company_id INT, first_name VARCHAR, last_name VARCHAR, other_details VARCHAR) CREATE TABLE Skills_Required_To_Fix (part_fault_id INT, skill_id INT) CREATE TABLE Engineer_Skills (engineer_id INT, skill_id INT) CREATE TABLE Assets (asset_id INT, maintenance_contract_id INT, supplier_company_id INT, asset_details VARCHAR, asset_make VARCHAR, asset_model VARCHAR, asset_acquired_date DATETIME, asset_disposed_date DATETIME, other_asset_details VARCHAR) CREATE TABLE Parts (part_id INT, part_name VARCHAR, chargeable_yn VARCHAR, chargeable_amount VARCHAR, other_part_details VARCHAR) CREATE TABLE Third_Party_Companies (company_id INT, company_type VARCHAR, company_name VARCHAR, company_address VARCHAR, other_company_details VARCHAR) CREATE TABLE Fault_Log (fault_log_entry_id INT, asset_id INT, recorded_by_staff_id INT, fault_log_entry_datetime DATETIME, fault_description VARCHAR, other_fault_details VARCHAR) CREATE TABLE Part_Faults (part_fault_id INT, part_id INT, fault_short_name VARCHAR, fault_description VARCHAR, other_fault_details VARCHAR) CREATE TABLE Fault_Log_Parts (fault_log_entry_id INT, part_fault_id INT, fault_status VARCHAR) CREATE TABLE Engineer_Visits (engineer_visit_id INT, contact_staff_id INT, engineer_id INT, fault_log_entry_id INT, fault_status VARCHAR, visit_start_datetime DATETIME, visit_end_datetime DATETIME, other_visit_details VARCHAR)
Return a bar chart on how many engineers did each staff contact? List both the contact staff name and number of engineers contacted, and could you order by the Y in asc please?
SELECT staff_name, COUNT(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name ORDER BY COUNT(*)
SELECT "staff_name", COUNT(*) FROM "Staff" AS "T1" JOIN "Engineer_Visits" AS "T2" ON "T1"."staff_id" = "T2"."contact_staff_id" GROUP BY "T1"."staff_name" ORDER BY COUNT(*) NULLS FIRST
0.178711
CREATE TABLE table_name_82 (silver INT, bronze INT)
What is the sum of all silver medals with more than 2 bronze?
SELECT SUM(silver) FROM table_name_82 WHERE bronze > 2
SELECT SUM("silver") FROM "table_name_82" WHERE "bronze" > 2
0.058594
CREATE TABLE stock (shop_id DECIMAL, device_id DECIMAL, quantity DECIMAL) CREATE TABLE shop (shop_id DECIMAL, shop_name TEXT, location TEXT, open_date TEXT, open_year DECIMAL) CREATE TABLE device (device_id DECIMAL, device TEXT, carrier TEXT, package_version TEXT, applications TEXT, software_platform TEXT)
What are the different software platforms for devices, ordered by frequency descending?
SELECT software_platform FROM device GROUP BY software_platform ORDER BY COUNT(*) DESC
SELECT "software_platform" FROM "device" GROUP BY "software_platform" ORDER BY COUNT(*) DESC NULLS LAST
0.100586
CREATE TABLE table_13514348_7 (umpires VARCHAR, simpson_medal VARCHAR)
Who were the umpires when Paul Medhurst (C) won the Simpson Medal?
SELECT umpires FROM table_13514348_7 WHERE simpson_medal = "Paul Medhurst (C)"
SELECT "umpires" FROM "table_13514348_7" WHERE "Paul Medhurst (C)" = "simpson_medal"
0.082031
CREATE TABLE region (Region_ID INT, Region_name TEXT, Date TEXT, Label TEXT, Format TEXT, Catalogue TEXT) CREATE TABLE party (Party_ID INT, Minister TEXT, Took_office TEXT, Left_office TEXT, Region_ID INT, Party_name TEXT) CREATE TABLE party_events (Event_ID INT, Event_Name TEXT, Party_ID INT, Member_in_charge_ID INT) CREATE TABLE member (Member_ID INT, Member_Name TEXT, Party_ID TEXT, In_office TEXT)
Give me a bar chart showing the total number of each minister, I want to list in asc by the total number.
SELECT Minister, COUNT(Minister) FROM party GROUP BY Minister ORDER BY COUNT(Minister)
SELECT "Minister", COUNT("Minister") FROM "party" GROUP BY "Minister" ORDER BY COUNT("Minister") NULLS FIRST
0.105469
CREATE TABLE table_49535 ("Outcome" TEXT, "Date" TEXT, "Tournament" TEXT, "Surface" TEXT, "Partner" TEXT, "Opponents" TEXT, "Score" TEXT)
what is the score when the partner is alexandra fusai?
SELECT "Score" FROM table_49535 WHERE "Partner" = 'alexandra fusai'
SELECT "Score" FROM "table_49535" WHERE "Partner" = 'alexandra fusai'
0.067383
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId 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 Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount 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 ReviewTaskTypes (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 PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description 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 PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
Answers with no links or blockquotes.
SELECT Id AS "post_link", OwnerUserId AS "user_link", CreationDate AS "Date Posted", Score, Body FROM Posts WHERE PostTypeId = 2 AND NOT Body LIKE '%http%' AND NOT Body LIKE '%blockquote%' ORDER BY CreationDate DESC
SELECT "Id" AS "post_link", "OwnerUserId" AS "user_link", "CreationDate" AS "Date Posted", "Score", "Body" FROM "Posts" WHERE "PostTypeId" = 2 AND NOT "Body" LIKE '%blockquote%' AND NOT "Body" LIKE '%http%' ORDER BY "CreationDate" DESC NULLS LAST
0.240234
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
how many patients born before the year 1882 had the diagnosis short title chordae tendinae rupture?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "1882" AND diagnoses.short_title = "Chordae tendinae rupture"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Chordae tendinae rupture" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "1882" > "demographic"."dob_year"
0.229492
CREATE TABLE table_29556461_9 (high_points VARCHAR, team VARCHAR)
How many high points occur with the team Umass?
SELECT COUNT(high_points) FROM table_29556461_9 WHERE team = "UMass"
SELECT COUNT("high_points") FROM "table_29556461_9" WHERE "UMass" = "team"
0.072266
CREATE TABLE table_24743 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" TEXT, "U.S. viewers ( millions ) " TEXT)
How many of the writers had 5.35 viewers?
SELECT COUNT("Written by") FROM table_24743 WHERE "U.S. viewers (millions)" = '5.35'
SELECT COUNT("Written by") FROM "table_24743" WHERE "U.S. viewers (millions)" = '5.35'
0.083984
CREATE TABLE table_30192 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" FLOAT)
What is the name of episode 5 in the season?
SELECT "Title" FROM table_30192 WHERE "No. in season" = '5'
SELECT "Title" FROM "table_30192" WHERE "No. in season" = '5'
0.05957
CREATE TABLE table_204_800 (id DECIMAL, "rank" DECIMAL, "nation" TEXT, "gold" DECIMAL, "silver" DECIMAL, "bronze" DECIMAL, "total" DECIMAL)
how many sliver medal does bermuda has
SELECT "silver" FROM table_204_800 WHERE "nation" = 'bermuda'
SELECT "silver" FROM "table_204_800" WHERE "nation" = 'bermuda'
0.061523
CREATE TABLE table_54364 ("Candidate" TEXT, "Contributions" FLOAT, "Loans Received" FLOAT, "All Receipts" FLOAT, "Operating Expenditures" FLOAT, "All Disbursements" FLOAT)
How many Operating Expenditures have Receipts of 44,259,386?
SELECT COUNT("Operating Expenditures") FROM table_54364 WHERE "All Receipts" = '44,259,386'
SELECT COUNT("Operating Expenditures") FROM "table_54364" WHERE "All Receipts" = '44,259,386'
0.09082
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE 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 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 cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
what is the monthly average dose of p.o. that patient 008-30575 has taken since 12/08/2100?
SELECT AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '008-30575')) AND intakeoutput.celllabel = 'p.o.' AND intakeoutput.cellpath LIKE '%intake%' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2100-12-08' GROUP BY STRFTIME('%y-%m', intakeoutput.intakeoutputtime)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '008-30575' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT AVG("intakeoutput"."cellvaluenumeric") FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'p.o.' AND "intakeoutput"."cellpath" LIKE '%intake%' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m-%d', "intakeoutput"."intakeoutputtime") >= '2100-12-08' GROUP BY STRFTIME('%y-%m', "intakeoutput"."intakeoutputtime")
0.734375
CREATE TABLE addresses (address_id DECIMAL, line_1_number_building TEXT, city TEXT, zip_postcode TEXT, state_province_county TEXT, country TEXT) CREATE TABLE contacts (contact_id DECIMAL, customer_id DECIMAL, gender TEXT, first_name TEXT, last_name TEXT, contact_phone TEXT) CREATE TABLE customer_address_history (customer_id DECIMAL, address_id DECIMAL, date_from TIME, date_to TIME) CREATE TABLE order_items (order_item_id DECIMAL, order_id DECIMAL, product_id DECIMAL, order_quantity TEXT) CREATE TABLE customers (customer_id DECIMAL, payment_method_code TEXT, customer_number TEXT, customer_name TEXT, customer_address TEXT, customer_phone TEXT, customer_email TEXT) CREATE TABLE customer_orders (order_id DECIMAL, customer_id DECIMAL, order_date TIME, order_status_code TEXT) CREATE TABLE products (product_id DECIMAL, product_type_code TEXT, product_name TEXT, product_price DECIMAL)
What are the name and phone of the customer with the most ordered product quantity?
SELECT T1.customer_name, T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY SUM(T3.order_quantity) DESC LIMIT 1
SELECT "T1"."customer_name", "T1"."customer_phone" FROM "customers" AS "T1" JOIN "customer_orders" AS "T2" ON "T1"."customer_id" = "T2"."customer_id" JOIN "order_items" AS "T3" ON "T2"."order_id" = "T3"."order_id" GROUP BY "T1"."customer_id" ORDER BY SUM("T3"."order_quantity") DESC NULLS LAST LIMIT 1
0.293945
CREATE TABLE table_name_82 (loss VARCHAR, att VARCHAR)
What loss has 16,458 as an Att.?
SELECT loss FROM table_name_82 WHERE att = "16,458"
SELECT "loss" FROM "table_name_82" WHERE "16,458" = "att"
0.055664
CREATE TABLE table_690 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Status" TEXT, "Opponent" TEXT)
what's the party with opponent being marcy kaptur (d) 75.3% randy whitman (r) 24.7%
SELECT "Party" FROM table_690 WHERE "Opponent" = 'Marcy Kaptur (D) 75.3% Randy Whitman (R) 24.7%'
SELECT "Party" FROM "table_690" WHERE "Opponent" = 'Marcy Kaptur (D) 75.3% Randy Whitman (R) 24.7%'
0.09668
CREATE TABLE table_77913 ("Round" FLOAT, "Pick" FLOAT, "Name" TEXT, "Position" TEXT, "School" TEXT)
What is the position of the player for Washington school?
SELECT "Position" FROM table_77913 WHERE "School" = 'washington'
SELECT "Position" FROM "table_77913" WHERE "School" = 'washington'
0.064453
CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE 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 comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE area (course_id INT, area 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 program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR)
The upper-level classes , are they all worth 1 credits ?
SELECT COUNT(*) = 0 FROM course, program_course WHERE course.credits <> 1 AND course.department = 'EECS' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id
SELECT COUNT(*) = 0 FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%ULCS%' WHERE "course"."credits" <> 1 AND "course"."department" = 'EECS'
0.21582
CREATE TABLE COURSE (CName VARCHAR, Days VARCHAR)
Which courses are taught on days MTW?
SELECT CName FROM COURSE WHERE Days = "MTW"
SELECT "CName" FROM "COURSE" WHERE "Days" = "MTW"
0.047852
CREATE TABLE table_name_81 (internet_explorer VARCHAR, date VARCHAR)
What percentage of browsers were using Internet Explorer in April 2009?
SELECT internet_explorer FROM table_name_81 WHERE date = "april 2009"
SELECT "internet_explorer" FROM "table_name_81" WHERE "april 2009" = "date"
0.073242
CREATE TABLE table_60557 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Game site" TEXT, "Record" TEXT, "Attendance" FLOAT)
What was the score when they played the Boston Patriots?
SELECT "Result" FROM table_60557 WHERE "Opponent" = 'boston patriots'
SELECT "Result" FROM "table_60557" WHERE "Opponent" = 'boston patriots'
0.069336
CREATE TABLE table_44737 ("Coach" TEXT, "First Yr" FLOAT, "Last Yr" FLOAT, "W-L%" FLOAT, "G > .500" FLOAT, "Yr plyf" FLOAT, "G plyf" FLOAT, "W plyf" FLOAT, "L plyf" FLOAT)
What is the total number of yr plyf with a G plyf less than 0?
SELECT COUNT("Yr plyf") FROM table_44737 WHERE "G plyf" < '0'
SELECT COUNT("Yr plyf") FROM "table_44737" WHERE "G plyf" < '0'
0.061523
CREATE TABLE table_name_79 (wins INT, team VARCHAR, played VARCHAR)
What is the sum of Wins, when Team is Sweden, and when Played is less than 5?
SELECT SUM(wins) FROM table_name_79 WHERE team = "sweden" AND played < 5
SELECT SUM("wins") FROM "table_name_79" WHERE "played" < 5 AND "sweden" = "team"
0.078125
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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_procedures (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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
what drug was the last drug that patient 7375 was prescribed via im route until 62 months ago?
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7375) AND prescriptions.route = 'im' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-62 month') ORDER BY prescriptions.startdate DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 7375 GROUP BY "hadm_id") SELECT "prescriptions"."drug" FROM "prescriptions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE "prescriptions"."route" = 'im' AND DATETIME("prescriptions"."startdate") <= DATETIME(CURRENT_TIME(), '-62 month') AND NOT "_u_0"."" IS NULL ORDER BY "prescriptions"."startdate" DESC NULLS LAST LIMIT 1
0.4375
CREATE TABLE table_203_534 (id DECIMAL, "week" DECIMAL, "date" TEXT, "opponent" TEXT, "home/away" TEXT, "result" TEXT, "bye" TEXT)
did the team win more home games or away games ?
SELECT "home/away" FROM table_203_534 WHERE "result" = 'w' GROUP BY "home/away" ORDER BY COUNT(*) DESC LIMIT 1
SELECT "home/away" FROM "table_203_534" WHERE "result" = 'w' GROUP BY "home/away" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1
0.120117
CREATE TABLE table_23696 ("County" TEXT, "McCain #" FLOAT, "McCain %" TEXT, "Obama #" FLOAT, "Obama %" TEXT)
where did obama get 39.8%
SELECT "County" FROM table_23696 WHERE "Obama %" = '39.8%'
SELECT "County" FROM "table_23696" WHERE "Obama %" = '39.8%'
0.058594
CREATE TABLE table_44138 ("Poll" TEXT, "Pre- season" TEXT, "Mar 3" TEXT, "Mar 17" TEXT, "Mar 24" TEXT, "Mar 31" TEXT, "April 7" TEXT, "April 14" TEXT, "April 21" TEXT, "April 28" TEXT, "May 5" TEXT, "May 12" TEXT, "May 19" TEXT, "May 26" TEXT, "Final" TEXT)
What is the April 28th rank when the Final is 20, and Mar 17 is 22?
SELECT "April 28" FROM table_44138 WHERE "Final" = '20' AND "Mar 17" = '22'
SELECT "April 28" FROM "table_44138" WHERE "Final" = '20' AND "Mar 17" = '22'
0.075195
CREATE TABLE table_40157 ("Rank" FLOAT, "Location" TEXT, "Total Passengers" FLOAT, "Annual change" TEXT, "Capacity in use" TEXT)
Can you tell me lowest Rank that has the Capacity in use of 93.6%, and the Total Passengers larger than 4,679,457?
SELECT MIN("Rank") FROM table_40157 WHERE "Capacity in use" = '93.6%' AND "Total Passengers" > '4,679,457'
SELECT MIN("Rank") FROM "table_40157" WHERE "Capacity in use" = '93.6%' AND "Total Passengers" > '4,679,457'
0.105469
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 time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, 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 ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description 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 flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note 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 dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight 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 city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR)
how far is it from MCO airport to ORLANDO
SELECT DISTINCT airport_service.miles_distant FROM airport, airport_service, city WHERE airport.airport_code = 'MCO' AND airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'ORLANDO'
SELECT DISTINCT "airport_service"."miles_distant" FROM "airport" JOIN "airport_service" ON "airport"."airport_code" = "airport_service"."airport_code" JOIN "city" ON "airport_service"."city_code" = "city"."city_code" AND "city"."city_name" = 'ORLANDO' WHERE "airport"."airport_code" = 'MCO'
0.283203
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 inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE 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_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
give me the top four most common diagnostics during the last year?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 4)
WITH "t1" AS (SELECT "diagnoses_icd"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnoses_icd" WHERE DATETIME("diagnoses_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY "diagnoses_icd"."icd9_code"), "_u_0" AS (SELECT "t1"."icd9_code" FROM "t1" AS "t1" WHERE "t1"."c1" <= 4 GROUP BY "icd9_code") SELECT "d_icd_diagnoses"."short_title" FROM "d_icd_diagnoses" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "d_icd_diagnoses"."icd9_code" WHERE NOT "_u_0"."" IS NULL
0.532227
CREATE TABLE market (Market_ID INT, District TEXT, Num_of_employees INT, Num_of_shops FLOAT, Ranking INT) CREATE TABLE phone_market (Market_ID INT, Phone_ID TEXT, Num_of_stock INT) CREATE TABLE phone (Name TEXT, Phone_ID INT, Memory_in_G INT, Carrier TEXT, Price FLOAT)
Give me a histogram for what are the memories and carriers of phones?, and could you rank by the total number from low to high?
SELECT Carrier, AVG(Memory_in_G) FROM phone GROUP BY Carrier ORDER BY AVG(Memory_in_G)
SELECT "Carrier", AVG("Memory_in_G") FROM "phone" GROUP BY "Carrier" ORDER BY AVG("Memory_in_G") NULLS FIRST
0.105469
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId 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 PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId 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 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
[draft] Top users by Tag.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", u.Id AS "user_link", u.Reputation, COUNT(p.Id) FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE t.TagName = '##tagname##' GROUP BY u.Reputation, u.Id ORDER BY COUNT(p.Id) DESC, Reputation DESC
SELECT ROW_NUMBER() OVER (ORDER BY "Reputation" DESC NULLS LAST) AS "#", "u"."Id" AS "user_link", "u"."Reputation", COUNT("p"."Id") FROM "Users" AS "u" JOIN "Posts" AS "p" ON "p"."OwnerUserId" = "u"."Id" JOIN "PostTags" AS "pt" ON "p"."Id" = "pt"."PostId" JOIN "Tags" AS "t" ON "pt"."TagId" = "t"."Id" AND "t"."TagName" = '##tagname##' GROUP BY "u"."Reputation", "u"."Id" ORDER BY COUNT("p"."Id") DESC NULLS LAST, "Reputation" DESC NULLS LAST
0.431641
CREATE TABLE table_name_31 (artist VARCHAR, year VARCHAR, composer VARCHAR)
What artist shows 2007 and composer of Hayko?
SELECT artist FROM table_name_31 WHERE year = 2007 AND composer = "hayko"
SELECT "artist" FROM "table_name_31" WHERE "composer" = "hayko" AND "year" = 2007
0.079102
CREATE TABLE accounts (account_id DECIMAL, customer_id DECIMAL, account_name TEXT, other_account_details TEXT) CREATE TABLE customers (customer_id DECIMAL, customer_first_name TEXT, customer_last_name TEXT, customer_address TEXT, customer_phone TEXT, customer_email TEXT, other_customer_details TEXT) CREATE TABLE financial_transactions (transaction_id DECIMAL, previous_transaction_id DECIMAL, account_id DECIMAL, card_id DECIMAL, transaction_type TEXT, transaction_date TIME, transaction_amount DECIMAL, transaction_comment TEXT, other_transaction_details TEXT) CREATE TABLE customers_cards (card_id DECIMAL, customer_id DECIMAL, card_type_code TEXT, card_number TEXT, date_valid_from TIME, date_valid_to TIME, other_card_details TEXT)
How many credit cards does customer Blanche Huels have?
SELECT COUNT(*) FROM customers_cards AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit"
SELECT COUNT(*) FROM "customers_cards" AS "T1" JOIN "customers" AS "T2" ON "Blanche" = "T2"."customer_first_name" AND "Huels" = "T2"."customer_last_name" AND "T1"."customer_id" = "T2"."customer_id" WHERE "Credit" = "T1"."card_type_code"
0.230469
CREATE TABLE table_23575917_2 (scores VARCHAR, davids_team VARCHAR)
Name the scores for david baddiel and maureen lipman
SELECT COUNT(scores) FROM table_23575917_2 WHERE davids_team = "David Baddiel and Maureen Lipman"
SELECT COUNT("scores") FROM "table_23575917_2" WHERE "David Baddiel and Maureen Lipman" = "davids_team"
0.100586
CREATE TABLE table_70638 ("Season" TEXT, "Games" FLOAT, "Lost" FLOAT, "Points" FLOAT, "Goalsfor" FLOAT, "Goalsagainst" FLOAT)
Goalsagainst that has a Points of 108, and a Lost smaller than 14 has what average?
SELECT AVG("Goalsagainst") FROM table_70638 WHERE "Points" = '108' AND "Lost" < '14'
SELECT AVG("Goalsagainst") FROM "table_70638" WHERE "Lost" < '14' AND "Points" = '108'
0.083984
CREATE TABLE table_43018 ("Country" TEXT, "Area ( km\\u00b2 ) " TEXT, "Population ( 2011 est. ) " TEXT, "Population density ( per km\\u00b2 ) " TEXT, "GDP ( PPP ) $M USD" TEXT)
How much is the population density with a GDP at $188,112?
SELECT "Population density (per km\u00b2)" FROM table_43018 WHERE "GDP (PPP) $M USD" = '$188,112'
SELECT "Population density (per km\u00b2)" FROM "table_43018" WHERE "GDP (PPP) $M USD" = '$188,112'
0.09668
CREATE TABLE table_27248 ("Week" FLOAT, "Date" TEXT, "Kickoff" TEXT, "Opponent" TEXT, "Final score" TEXT, "Team record" TEXT, "Game site" TEXT, "Attendance" FLOAT)
How many weeks total are there?
SELECT MAX("Week") FROM table_27248
SELECT MAX("Week") FROM "table_27248"
0.036133
CREATE TABLE table_50062 ("Date" TEXT, "Team #1" TEXT, "Res." TEXT, "Team #2" TEXT, "Competition" TEXT, "Attendance" FLOAT)
What was the team #1 for the match that had a result of 0-3?
SELECT "Team #1" FROM table_50062 WHERE "Res." = '0-3'
SELECT "Team #1" FROM "table_50062" WHERE "Res." = '0-3'
0.054688
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
Score distribution of all questions.
SELECT Score, COUNT(Id) FROM Posts WHERE PostTypeId = 1 AND Tags LIKE '%<r>%' GROUP BY Score ORDER BY Score
SELECT "Score", COUNT("Id") FROM "Posts" WHERE "PostTypeId" = 1 AND "Tags" LIKE '%<r>%' GROUP BY "Score" ORDER BY "Score" NULLS FIRST
0.129883
CREATE TABLE table_37061 ("Driver" TEXT, "Entries" FLOAT, "Points" FLOAT, "Average points per race entered" FLOAT, "Average pre-2010" FLOAT)
What is the lowest amount of points driver Romain Grosjean, who has an average pre-2010 less than 0, has?
SELECT MIN("Points") FROM table_37061 WHERE "Driver" = 'romain grosjean' AND "Average pre-2010" < '0'
SELECT MIN("Points") FROM "table_37061" WHERE "Average pre-2010" < '0' AND "Driver" = 'romain grosjean'
0.100586
CREATE TABLE table_name_58 (record VARCHAR, opponent VARCHAR)
What is the final record for the Philadelphia 76ers?
SELECT record FROM table_name_58 WHERE opponent = "philadelphia 76ers"
SELECT "record" FROM "table_name_58" WHERE "opponent" = "philadelphia 76ers"
0.074219
CREATE TABLE table_1034 ("Player" TEXT, "Position" TEXT, "Starter" TEXT, "Touchdowns" FLOAT, "Extra points" FLOAT, "Field goals" FLOAT, "Points" FLOAT)
What players played the position of left tackle?
SELECT "Player" FROM table_1034 WHERE "Position" = 'Left tackle'
SELECT "Player" FROM "table_1034" WHERE "Position" = 'Left tackle'
0.064453
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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) 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)
how many patients were discharged from the hospital until 1 year ago?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND DATETIME(patient.hospitaldischargetime) <= DATETIME(CURRENT_TIME(), '-1 year')
SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" WHERE DATETIME("patient"."hospitaldischargetime") <= DATETIME(CURRENT_TIME(), '-1 year') AND NOT "patient"."hospitaldischargetime" IS NULL
0.193359
CREATE TABLE finrev_fed_17 (state_code DECIMAL, idcensus DECIMAL, school_district TEXT, nces_id TEXT, yr_data DECIMAL, t_fed_rev DECIMAL, c14 DECIMAL, c25 DECIMAL) CREATE TABLE ndecoreexcel_math_grade8 (year DECIMAL, state TEXT, all_students TEXT, average_scale_score DECIMAL) CREATE TABLE finrev_fed_key_17 (state_code DECIMAL, state TEXT)
How much federal funding did Faifaix County, VA schools receive in all forms?
SELECT t_fed_rev FROM finrev_fed_17 WHERE school_district = "FAIRFAX CO SCHS"
SELECT "t_fed_rev" FROM "finrev_fed_17" WHERE "FAIRFAX CO SCHS" = "school_district"
0.081055
CREATE TABLE table_10690 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
Who had the high assist in a game number above 77 for Milwaukee?
SELECT "High assists" FROM table_10690 WHERE "Game" > '77' AND "Team" = 'milwaukee'
SELECT "High assists" FROM "table_10690" WHERE "Game" > '77' AND "Team" = 'milwaukee'
0.083008
CREATE TABLE table_55083 ("Season" TEXT, "Club" TEXT, "National League" TEXT, "National Cup" TEXT, "European Cup" TEXT)
What national cup has fc barcelona?
SELECT "National Cup" FROM table_55083 WHERE "Club" = 'fc barcelona'
SELECT "National Cup" FROM "table_55083" WHERE "Club" = 'fc barcelona'
0.068359
CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT) CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT)
For those records from the products and each product's manufacturer, visualize a scatter chart about the correlation between code and manufacturer , and group by attribute founder.
SELECT T1.Code, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
SELECT "T1"."Code", "T1"."Manufacturer" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Founder"
0.144531
CREATE TABLE table_name_95 (number_of_cars INT, car__number VARCHAR, year_started VARCHAR, current_car VARCHAR)
WHAT IS THE HIGHEST # OF CARS WITH A START YEAR LESS THAN 2012, TBA CURRENT CAR, AND MORE THAN 1 CAR?
SELECT MAX(number_of_cars) FROM table_name_95 WHERE year_started < 2012 AND current_car = "tba" AND car__number > 1
SELECT MAX("number_of_cars") FROM "table_name_95" WHERE "car__number" > 1 AND "current_car" = "tba" AND "year_started" < 2012
0.12207
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 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) 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 lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
list the three most common microbiology tests done on patients who have previously received endotracheal tube - insertion within 2 months during the previous year?
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'endotracheal tube - insertion' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, microlab.culturesite, microlab.culturetakentime FROM microlab JOIN patient ON microlab.patientunitstayid = patient.patientunitstayid WHERE DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.culturetakentime AND DATETIME(t2.culturetakentime) BETWEEN DATETIME(t1.treatmenttime) AND DATETIME(t1.treatmenttime, '+2 month') GROUP BY t2.culturesite) AS t3 WHERE t3.c1 <= 3
WITH "t2" AS (SELECT "patient"."uniquepid", "microlab"."culturesite", "microlab"."culturetakentime" FROM "microlab" JOIN "patient" ON "microlab"."patientunitstayid" = "patient"."patientunitstayid" WHERE DATETIME("microlab"."culturetakentime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')), "t3" AS (SELECT "t2"."culturesite", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" JOIN "t2" AS "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND "t2"."culturetakentime" > "treatment"."treatmenttime" AND DATETIME("t2"."culturetakentime") <= DATETIME("treatment"."treatmenttime", '+2 month') AND DATETIME("t2"."culturetakentime") >= DATETIME("treatment"."treatmenttime") WHERE "treatment"."treatmentname" = 'endotracheal tube - insertion' AND DATETIME("treatment"."treatmenttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY "t2"."culturesite") SELECT "t3"."culturesite" FROM "t3" AS "t3" WHERE "t3"."c1" <= 3
1.053711
CREATE TABLE table_name_67 (country VARCHAR, season VARCHAR, team VARCHAR)
Which country does FC Atyrau represent after the 2006 season?
SELECT country FROM table_name_67 WHERE season > 2006 AND team = "fc atyrau"
SELECT "country" FROM "table_name_67" WHERE "fc atyrau" = "team" AND "season" > 2006
0.082031
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
provide the number of patients less than 80 years who are taking cefpodoxime proxetil medication.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "80" AND prescriptions.drug = "Cefpodoxime Proxetil"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Cefpodoxime Proxetil" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "80" > "demographic"."age"
0.223633
CREATE TABLE Student_Tests_Taken (registration_id INT, date_test_taken DATETIME, test_result VARCHAR) CREATE TABLE Course_Authors_and_Tutors (author_id INT, author_tutor_ATB VARCHAR, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR, gender_mf VARCHAR, address_line_1 VARCHAR) CREATE TABLE Subjects (subject_id INT, subject_name VARCHAR) CREATE TABLE Student_Course_Enrolment (registration_id INT, student_id INT, course_id INT, date_of_enrolment DATETIME, date_of_completion DATETIME) CREATE TABLE Courses (course_id INT, author_id INT, subject_id INT, course_name VARCHAR, course_description VARCHAR) CREATE TABLE Students (student_id INT, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR)
Find the number of the latest logon date of the students whose family name is 'Jaskolski' or 'Langosh'.
SELECT date_of_latest_logon, COUNT(date_of_latest_logon) FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh"
SELECT "date_of_latest_logon", COUNT("date_of_latest_logon") FROM "Students" WHERE "Jaskolski" = "family_name" OR "Langosh" = "family_name"
0.135742
CREATE TABLE table_34115 ("Rank" TEXT, "Nation" TEXT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
How much Total has a Silver smaller than 0?
SELECT COUNT("Total") FROM table_34115 WHERE "Silver" < '0'
SELECT COUNT("Total") FROM "table_34115" WHERE "Silver" < '0'
0.05957
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE 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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE FlagTypes (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 TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
Average number of answers depending on day (or time) when bounty was started.
WITH tmp AS (SELECT p.AnswerCount AS ACount, Period = CASE @Frequency WHEN 1 THEN TIME_TO_STR(bs.CreationDate, '%h') WHEN 2 THEN TIME_TO_STR(bs.CreationDate, '%W') WHEN 3 THEN ROUND((CAST(TIME_TO_STR(bs.CreationDate, '%W') AS FLOAT) + CAST(TIME_TO_STR(bs.CreationDate, '%h') AS FLOAT) / 24), 2) END FROM Posts AS p INNER JOIN Votes AS bs ON p.Id = bs.PostId AND bs.VoteTypeId = 8) SELECT Period, AVG(CAST(ACount AS FLOAT)) FROM tmp GROUP BY Period ORDER BY Period
SELECT "Period", AVG(CAST("ACount" AS FLOAT)) FROM "Posts" AS "p" JOIN "Votes" AS "bs" ON "bs"."PostId" = "p"."Id" AND "bs"."VoteTypeId" = 8 GROUP BY "Period" ORDER BY "Period" NULLS FIRST
0.183594
CREATE TABLE table_2597876_2 (top_5 VARCHAR, avg_start VARCHAR)
What is every value for top 5 if average start is 21.9?
SELECT top_5 FROM table_2597876_2 WHERE avg_start = "21.9"
SELECT "top_5" FROM "table_2597876_2" WHERE "21.9" = "avg_start"
0.0625
CREATE TABLE product_suppliers (product_id VARCHAR, total_amount_purchased VARCHAR)
What are the ids of the top three products that were purchased in the largest amount?
SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
SELECT "product_id" FROM "product_suppliers" ORDER BY "total_amount_purchased" DESC NULLS LAST LIMIT 3
0.099609
CREATE TABLE table_16312 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
Who was the scoring leader and how many points did he get in games on December 23?
SELECT "High points" FROM table_16312 WHERE "Date" = 'December 23'
SELECT "High points" FROM "table_16312" WHERE "Date" = 'December 23'
0.066406
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 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)
what is the number of married patients who are females?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.gender = "F"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "F" = "demographic"."gender" AND "MARRIED" = "demographic"."marital_status"
0.146484
CREATE TABLE table_51567 ("Driver" TEXT, "Constructor" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT)
Who constructed the car with a grid over 19 that retired due to suspension?
SELECT "Constructor" FROM table_51567 WHERE "Grid" > '19' AND "Time/Retired" = 'suspension'
SELECT "Constructor" FROM "table_51567" WHERE "Grid" > '19' AND "Time/Retired" = 'suspension'
0.09082
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime 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 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 cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE 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)
what is the three most common procedures for patients who are 20s since 5 years ago?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-5 year') GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 3
WITH "_u_0" AS (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."age" <= 29 AND "patient"."age" >= 20 GROUP BY "patientunitstayid"), "t1" AS (SELECT "treatment"."treatmentname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "treatment" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "treatment"."patientunitstayid" WHERE DATETIME("treatment"."treatmenttime") >= DATETIME(CURRENT_TIME(), '-5 year') AND NOT "_u_0"."" IS NULL GROUP BY "treatment"."treatmentname") SELECT "t1"."treatmentname" FROM "t1" AS "t1" WHERE "t1"."c1" <= 3
0.550781
CREATE TABLE people (People_ID INT, Sex TEXT, Name TEXT, Date_of_Birth TEXT, Height FLOAT, Weight FLOAT) CREATE TABLE candidate (Candidate_ID INT, People_ID INT, Poll_Source TEXT, Date TEXT, Support_rate FLOAT, Consider_rate FLOAT, Oppose_rate FLOAT, Unsure_rate FLOAT)
What is the averag weights for people of each sex? Show a bar chart.
SELECT Sex, AVG(Weight) FROM people GROUP BY Sex
SELECT "Sex", AVG("Weight") FROM "people" GROUP BY "Sex"
0.054688
CREATE TABLE table_21133193_1 (languages VARCHAR, member_countries VARCHAR)
Name the languages for cyprus
SELECT languages FROM table_21133193_1 WHERE member_countries = "Cyprus"
SELECT "languages" FROM "table_21133193_1" WHERE "Cyprus" = "member_countries"
0.076172
CREATE TABLE table_63703 ("Year" FLOAT, "Baden" TEXT, "W\\u00fcrttemberg" TEXT, "Nordbayern" TEXT, "S\\u00fcdbayern" TEXT)
What's the W rttemberg for Karlsruher FV happening after 1931?
SELECT "W\u00fcrttemberg" FROM table_63703 WHERE "Baden" = 'karlsruher fv' AND "Year" > '1931'
SELECT "W\u00fcrttemberg" FROM "table_63703" WHERE "Baden" = 'karlsruher fv' AND "Year" > '1931'
0.09375
CREATE TABLE table_18103 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Results" TEXT, "Candidates" TEXT)
What were the results in the election where Albert Wynn was the incumbent?
SELECT "Results" FROM table_18103 WHERE "Incumbent" = 'Albert Wynn'
SELECT "Results" FROM "table_18103" WHERE "Incumbent" = 'Albert Wynn'
0.067383
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)
provide the number of patients whose death status is 0 and procedure short title is incision of aorta?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.short_title = "Incision of aorta"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Incision of aorta" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "0" = "demographic"."expire_flag"
0.225586
CREATE TABLE table_67539 ("Week" FLOAT, "Set 1" TEXT, "Set 2" TEXT, "Set 3" TEXT, "Set 4" TEXT, "Set 5" TEXT, "Volume Lbs." FLOAT, "Peak Intensity ( Last Set ) " TEXT, "% of 1 Rep Max ( Last Set ) " TEXT)
How many % of 1 Rep Max(Last Set) has a Set 4 of 145lb x 5reps?
SELECT "% of 1 Rep Max(Last Set)" FROM table_67539 WHERE "Set 4" = '145lb x 5reps'
SELECT "% of 1 Rep Max(Last Set)" FROM "table_67539" WHERE "Set 4" = '145lb x 5reps'
0.082031
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE 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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId 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 PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (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 PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
Total Posts by Database Server Per Month.
SELECT CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, 'SQLServer' AS TagName, COUNT(*) AS PostCount FROM Posts AS P INNER JOIN PostTags AS PT ON (P.Id = PT.PostId) INNER JOIN Tags AS T ON (PT.TagId = T.Id) WHERE T.TagName LIKE 'sql-server%' GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY YEAR(P.CreationDate) DESC, MONTH(P.CreationDate) DESC
SELECT CONCAT(YEAR("P"."CreationDate"), '-', MONTH("P"."CreationDate")) AS "YearMonth", 'SQLServer' AS "TagName", COUNT(*) AS "PostCount" FROM "Posts" AS "P" JOIN "PostTags" AS "PT" ON "P"."Id" = "PT"."PostId" JOIN "Tags" AS "T" ON "PT"."TagId" = "T"."Id" AND "T"."TagName" LIKE 'sql-server%' GROUP BY YEAR("P"."CreationDate"), MONTH("P"."CreationDate") ORDER BY YEAR("P"."CreationDate") DESC NULLS LAST, MONTH("P"."CreationDate") DESC NULLS LAST
0.435547
CREATE TABLE table_23235767_1 (year VARCHAR, opponent_in_the_final VARCHAR, championship VARCHAR)
What is every year where opponent in the final is John Mcenroe at Wimbledon?
SELECT year FROM table_23235767_1 WHERE opponent_in_the_final = "John McEnroe" AND championship = "Wimbledon"
SELECT "year" FROM "table_23235767_1" WHERE "John McEnroe" = "opponent_in_the_final" AND "Wimbledon" = "championship"
0.114258
CREATE TABLE table_16864968_9 (opponent VARCHAR, location VARCHAR)
Nam the opponent for prudential center
SELECT opponent FROM table_16864968_9 WHERE location = "Prudential Center"
SELECT "opponent" FROM "table_16864968_9" WHERE "Prudential Center" = "location"
0.078125
CREATE TABLE table_name_62 (react INT, country VARCHAR, lane VARCHAR)
What is the lowest of the athlete from sri lanka who has a lane greater than 8?
SELECT MIN(react) FROM table_name_62 WHERE country = "sri lanka" AND lane > 8
SELECT MIN("react") FROM "table_name_62" WHERE "country" = "sri lanka" AND "lane" > 8
0.083008
CREATE TABLE table_name_9 (to_par VARCHAR, player VARCHAR)
What was Todd Hamilton's to par?
SELECT to_par FROM table_name_9 WHERE player = "todd hamilton"
SELECT "to_par" FROM "table_name_9" WHERE "player" = "todd hamilton"
0.066406
CREATE TABLE table_204_981 (id DECIMAL, "ep#" DECIMAL, "title" TEXT, "broadcast date" TEXT, "written by" TEXT, "directed by" TEXT)
title of the episode that came before the one directed by bob balaban
SELECT "title" FROM table_204_981 WHERE "ep#" = (SELECT "ep#" FROM table_204_981 WHERE "directed by" = 'bob balaban') - 1
SELECT "title" FROM "table_204_981" WHERE "ep#" = (SELECT "ep#" FROM "table_204_981" WHERE "directed by" = 'bob balaban') - 1
0.12207
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) 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 TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId 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 CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
Top Comments of all time, site-wide.
SELECT c.Score, c.UserId AS "user_link", c.CreationDate, c.PostId AS "post_link", c.Text AS C_text FROM Comments AS c INNER JOIN Posts AS p ON p.Id = c.PostId LEFT OUTER JOIN Posts AS pp ON pp.Id = p.ParentId INNER JOIN Users AS u ON c.UserId = u.Id WHERE c.Score >= 50 ORDER BY c.Score DESC
SELECT "c"."Score", "c"."UserId" AS "user_link", "c"."CreationDate", "c"."PostId" AS "post_link", "c"."Text" AS "C_text" FROM "Comments" AS "c" JOIN "Posts" AS "p" ON "c"."PostId" = "p"."Id" JOIN "Users" AS "u" ON "c"."UserId" = "u"."Id" LEFT JOIN "Posts" AS "pp" ON "p"."ParentId" = "pp"."Id" WHERE "c"."Score" >= 50 ORDER BY "c"."Score" DESC NULLS LAST
0.345703
CREATE TABLE table_52961 ("Number & Name" TEXT, "Description" TEXT, "Livery" TEXT, "Owner ( s ) " TEXT, "Date" TEXT)
Which description is dated 1962?
SELECT "Description" FROM table_52961 WHERE "Date" = '1962'
SELECT "Description" FROM "table_52961" WHERE "Date" = '1962'
0.05957
CREATE TABLE table_75691 ("Position" FLOAT, "Team" TEXT, "Points" FLOAT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Against" FLOAT, "Difference" TEXT)
What was the position with the total number less than 1?
SELECT COUNT("Position") FROM table_75691 WHERE "Lost" < '1'
SELECT COUNT("Position") FROM "table_75691" WHERE "Lost" < '1'
0.060547
CREATE TABLE Employees (Employee_ID INT, Role_Code CHAR, Employee_Name VARCHAR, Gender_MFU CHAR, Date_of_Birth DATETIME, Other_Details VARCHAR) CREATE TABLE Roles (Role_Code CHAR, Role_Name VARCHAR, Role_Description VARCHAR) CREATE TABLE Documents_to_be_Destroyed (Document_ID INT, Destruction_Authorised_by_Employee_ID INT, Destroyed_by_Employee_ID INT, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR) CREATE TABLE All_Documents (Document_ID INT, Date_Stored DATETIME, Document_Type_Code CHAR, Document_Name CHAR, Document_Description CHAR, Other_Details VARCHAR) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR, Document_Type_Description VARCHAR) CREATE TABLE Document_Locations (Document_ID INT, Location_Code CHAR, Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME) CREATE TABLE Ref_Locations (Location_Code CHAR, Location_Name VARCHAR, Location_Description VARCHAR) CREATE TABLE Ref_Calendar (Calendar_Date DATETIME, Day_Number INT)
What is the code of each role and the number of employees in each role Show bar chart, and I want to show by the x axis in desc please.
SELECT Role_Code, COUNT(*) FROM Employees GROUP BY Role_Code ORDER BY Role_Code DESC
SELECT "Role_Code", COUNT(*) FROM "Employees" GROUP BY "Role_Code" ORDER BY "Role_Code" DESC NULLS LAST
0.100586
CREATE TABLE table_14342592_7 (points VARCHAR, position VARCHAR)
How many points did the player who was right guard score?
SELECT COUNT(points) FROM table_14342592_7 WHERE position = "Right guard"
SELECT COUNT("points") FROM "table_14342592_7" WHERE "Right guard" = "position"
0.077148
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
count the number of patients whose admission location is transfer from hosp/extram and drug name is gentamicin?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND prescriptions.drug = "Gentamicin"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Gentamicin" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "TRANSFER FROM HOSP/EXTRAM" = "demographic"."admission_location"
0.250977
CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) 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 equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE 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 time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt 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 aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE 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)
display all flights from BOSTON to BALTIMORE on 7 31
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 = 31 AND date_day.month_number = 7 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" = 31 AND "date_day"."month_number" = 7 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 aircraft (aid DECIMAL, name VARCHAR, distance DECIMAL) CREATE TABLE certificate (eid DECIMAL, aid DECIMAL) CREATE TABLE flight (flno DECIMAL, origin VARCHAR, destination VARCHAR, distance DECIMAL, departure_date DATE, arrival_date DATE, price DECIMAL, aid DECIMAL) CREATE TABLE employee (eid DECIMAL, name VARCHAR, salary DECIMAL)
What are the names and distances for all airplanes. Visualize by bar chart.
SELECT name, distance FROM aircraft
SELECT "name", "distance" FROM "aircraft"
0.040039
CREATE TABLE table_17714 ("Name of System" TEXT, "Location" TEXT, "Traction Type" TEXT, "Date ( From ) " TEXT, "Date ( To ) " TEXT, "Notes" TEXT)
what is the date (from) where the notes are apeldoornsche tramweg-maatschappij?
SELECT "Date (From)" FROM table_17714 WHERE "Notes" = 'Apeldoornsche Tramweg-Maatschappij'
SELECT "Date (From)" FROM "table_17714" WHERE "Notes" = 'Apeldoornsche Tramweg-Maatschappij'
0.089844
CREATE TABLE table_60900 ("Stage" TEXT, "Route" TEXT, "Distance" TEXT, "Date" TEXT, "Winner" TEXT)
Who was the winner of the race that had a distance of 175.6km?
SELECT "Winner" FROM table_60900 WHERE "Distance" = '175.6km'
SELECT "Winner" FROM "table_60900" WHERE "Distance" = '175.6km'
0.061523
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)
what is gender and discharge time of subject id 55094?
SELECT demographic.gender, demographic.dischtime FROM demographic WHERE demographic.subject_id = "55094"
SELECT "demographic"."gender", "demographic"."dischtime" FROM "demographic" WHERE "55094" = "demographic"."subject_id"
0.115234
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE 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 d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE 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)
what was the last height of patient 14671 in 12/this year.
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14671)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', chartevents.charttime) = '12' ORDER BY chartevents.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 14671 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'admit ht' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT "chartevents"."valuenum" FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE DATETIME("chartevents"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%m', "chartevents"."charttime") = '12' ORDER BY "chartevents"."charttime" DESC NULLS LAST LIMIT 1
0.886719
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE 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 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 lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
what are the three drugs that are prescribed the most frequently in 2104?
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE STRFTIME('%y', medication.drugstarttime) = '2104' GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 3
WITH "t1" AS (SELECT "medication"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "medication" WHERE STRFTIME('%y', "medication"."drugstarttime") = '2104' GROUP BY "medication"."drugname") SELECT "t1"."drugname" FROM "t1" AS "t1" WHERE "t1"."c1" <= 3
0.274414
CREATE TABLE table_48949 ("Heat" FLOAT, "Lane" FLOAT, "Name" TEXT, "Country" TEXT, "Mark" TEXT)
What is the Country that has Richard Buck Lane higher than 3?
SELECT "Country" FROM table_48949 WHERE "Lane" > '3' AND "Name" = 'richard buck'
SELECT "Country" FROM "table_48949" WHERE "Lane" > '3' AND "Name" = 'richard buck'
0.080078
CREATE TABLE table_name_97 (date VARCHAR, crowd INT)
What date was there a crowd larger than 30,343?
SELECT date FROM table_name_97 WHERE crowd > 30 OFFSET 343
SELECT "date" FROM "table_name_97" WHERE "crowd" > 30 OFFSET 343
0.0625
CREATE TABLE table_name_42 (laps VARCHAR, grid VARCHAR)
How many total laps for a grid of 3?
SELECT COUNT(laps) FROM table_name_42 WHERE grid = 3
SELECT COUNT("laps") FROM "table_name_42" WHERE "grid" = 3
0.056641
CREATE TABLE table_name_70 (wins VARCHAR, matches VARCHAR, success_rate VARCHAR)
What was the win for 4 matches with a success rate of 25%?
SELECT wins FROM table_name_70 WHERE matches = "4" AND success_rate = "25%"
SELECT "wins" FROM "table_name_70" WHERE "25%" = "success_rate" AND "4" = "matches"
0.081055
CREATE TABLE table_26476336_2 (new_conference VARCHAR, new_classification VARCHAR)
How many new conferences are in the NCLL deep south conference?
SELECT COUNT(new_conference) FROM table_26476336_2 WHERE new_classification = "NCLL Deep South Conference"
SELECT COUNT("new_conference") FROM "table_26476336_2" WHERE "NCLL Deep South Conference" = "new_classification"
0.109375
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many unmarried patients take medication via left eye?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "SINGLE" AND prescriptions.route = "LEFT EYE"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "LEFT EYE" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "SINGLE" = "demographic"."marital_status"
0.227539
CREATE TABLE table_name_61 (kicks VARCHAR, games VARCHAR)
How many kicks did he get in the year when he played 7 games?
SELECT kicks FROM table_name_61 WHERE games = "7"
SELECT "kicks" FROM "table_name_61" WHERE "7" = "games"
0.053711
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 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 record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT)
Visualize a bar chart about the distribution of meter_700 and meter_100 , and I want to show meter_100 in descending order.
SELECT meter_700, meter_100 FROM swimmer ORDER BY meter_100 DESC
SELECT "meter_700", "meter_100" FROM "swimmer" ORDER BY "meter_100" DESC NULLS LAST
0.081055
CREATE TABLE table_name_47 (team VARCHAR, last_match VARCHAR)
What is the name of team with Palmeiras 4-2 portuguesa as the last match?
SELECT team FROM table_name_47 WHERE last_match = "palmeiras 4-2 portuguesa"
SELECT "team" FROM "table_name_47" WHERE "last_match" = "palmeiras 4-2 portuguesa"
0.080078