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_10747 ("Date" TEXT, "Name" TEXT, "Flag" TEXT, "Tonnage ( GRT ) " FLOAT, "Sunk by" TEXT)
What is the flag for Terkoeli?
SELECT "Flag" FROM table_10747 WHERE "Name" = 'terkoeli'
SELECT "Flag" FROM "table_10747" WHERE "Name" = 'terkoeli'
0.056641
CREATE TABLE table_name_27 (place VARCHAR, player VARCHAR)
What place was Gary Player after two rounds?
SELECT place FROM table_name_27 WHERE player = "gary player"
SELECT "place" FROM "table_name_27" WHERE "gary player" = "player"
0.064453
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_icd_diagnoses (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 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
what was the daily average amount of emesis given to patient 29971 in 08/2100?
SELECT AVG(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29971)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'emesis' AND d_items.linksto = 'outputevents') AND STRFTIME('%y-%m', outputevents.charttime) = '2100-08' GROUP BY STRFTIME('%y-%m-%d', outputevents.charttime)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 29971 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" = 'emesis' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT AVG("outputevents"."value") FROM "outputevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m', "outputevents"."charttime") = '2100-08' GROUP BY STRFTIME('%y-%m-%d', "outputevents"."charttime")
0.790039
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 intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
among patients who were prescribed haldol after they had been diagnosed with third spacing show me the three year survival rate.
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'third spacing' GROUP BY patient.uniquepid HAVING MIN(diagnosis.diagnosistime) = diagnosis.diagnosistime) AS t1) AS t2 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'haldol') AS t3 ON t2.uniquepid = t3.uniquepid WHERE t2.diagnosistime < t3.drugstarttime) AS t4 JOIN patient ON t4.uniquepid = patient.uniquepid
WITH "t1" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 'third spacing' GROUP BY "patient"."uniquepid" HAVING "diagnosis"."diagnosistime" = MIN("diagnosis"."diagnosistime")), "t3" AS (SELECT "patient"."uniquepid", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" WHERE "medication"."drugname" = 'haldol') SELECT SUM(CASE WHEN "patient"."hospitaldischargestatus" = 'alive' THEN 1 WHEN STRFTIME('%j', "patient"."hospitaldischargetime") - STRFTIME('%j', "t1"."diagnosistime") > 1095 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) FROM "t1" AS "t1" JOIN "t3" AS "t3" ON "t1"."diagnosistime" < "t3"."drugstarttime" AND "t1"."uniquepid" = "t3"."uniquepid" JOIN "patient" ON "patient"."uniquepid" = "t1"."uniquepid"
0.917969
CREATE TABLE Student_Course_Registrations (student_id INT, course_id INT, registration_date DATETIME) CREATE TABLE People_Addresses (person_address_id INT, person_id INT, address_id INT, date_from DATETIME, date_to DATETIME) CREATE TABLE Candidate_Assessments (candidate_id INT, qualification CHAR, assessment_date DATETIME, asessment_outcome_code CHAR) CREATE TABLE Candidates (candidate_id INT, candidate_details VARCHAR) CREATE TABLE Student_Course_Attendance (student_id INT, course_id INT, date_of_attendance DATETIME) CREATE TABLE Courses (course_id VARCHAR, course_name VARCHAR, course_description VARCHAR, other_details VARCHAR) CREATE TABLE Students (student_id INT, student_details VARCHAR) CREATE TABLE Addresses (address_id INT, line_1 VARCHAR, line_2 VARCHAR, city VARCHAR, zip_postcode CHAR, state_province_county VARCHAR, country VARCHAR) CREATE TABLE People (person_id INT, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, cell_mobile_number VARCHAR, email_address VARCHAR, login_name VARCHAR, password VARCHAR)
For each course id, how many students are registered and what are the course names, and could you order the total number from low to high order?
SELECT course_name, COUNT(*) FROM Students AS T1 JOIN Student_Course_Registrations AS T2 ON T1.student_id = T2.student_id JOIN Courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id ORDER BY COUNT(*)
SELECT "course_name", COUNT(*) FROM "Students" AS "T1" JOIN "Student_Course_Registrations" AS "T2" ON "T1"."student_id" = "T2"."student_id" JOIN "Courses" AS "T3" ON "T2"."course_id" = "T3"."course_id" GROUP BY "T2"."course_id" ORDER BY COUNT(*) NULLS FIRST
0.250977
CREATE TABLE table_12042 ("Year" FLOAT, "Film name" TEXT, "Music director" TEXT, "Lyricist" TEXT, "Language" TEXT)
What language does Raj Kamal speak?
SELECT "Language" FROM table_12042 WHERE "Music director" = 'raj kamal'
SELECT "Language" FROM "table_12042" WHERE "Music director" = 'raj kamal'
0.071289
CREATE TABLE table_15681686_4 (rating VARCHAR, rank__week_ VARCHAR)
what is the rating where the rank is 48?
SELECT rating / SHARE(18 - 49) FROM table_15681686_4 WHERE rank__week_ = "48"
SELECT "rating" / NULLIF(SHARE(-31), 0) FROM "table_15681686_4" WHERE "48" = "rank__week_"
0.087891
CREATE TABLE table_14148 ("Manufacturer" TEXT, "Transmission" TEXT, "Engine Capacity" FLOAT, "Fuel Type" TEXT, "L/100km Urban ( Cold ) " FLOAT, "L/100km Extra-Urban" FLOAT, "L/100km Combined" FLOAT, "mpg-UK Urban ( Cold ) " FLOAT, "mpg-UK Extra-Urban" FLOAT, "mpg-UK Combined" FLOAT, "mpg-US Urban" FLOAT, "mpg-US Extra-Urban" FLOAT, "mpg-US Combined" FLOAT, "CO 2 g/km" FLOAT, "Green Rating" TEXT)
What is the lowest combined mpg in the US for the A6 transmission, a CO2 g/km under 303, engine capacity over 2461, and L/100km urban (cold) of 15.9?
SELECT MIN("mpg-US Combined") FROM table_14148 WHERE "Transmission" = 'a6' AND "CO 2 g/km" < '303' AND "Engine Capacity" > '2461' AND "L/100km Urban (Cold)" = '15.9'
SELECT MIN("mpg-US Combined") FROM "table_14148" WHERE "CO 2 g/km" < '303' AND "Engine Capacity" > '2461' AND "L/100km Urban (Cold)" = '15.9' AND "Transmission" = 'a6'
0.163086
CREATE TABLE table_60938 ("Name" TEXT, "Public" TEXT, "Intranet" TEXT, "Extranet" TEXT, "Personal Sites" TEXT, "Team Sites" TEXT, "Developer" TEXT)
What is the name of the entry that has a developer entry of Yes and a personal sites entry of No?
SELECT "Name" FROM table_60938 WHERE "Developer" = 'yes' AND "Personal Sites" = 'no'
SELECT "Name" FROM "table_60938" WHERE "Developer" = 'yes' AND "Personal Sites" = 'no'
0.083984
CREATE TABLE table_4103 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Director" TEXT, "Writer ( s ) " TEXT, "Original air date" TEXT, "Production code" TEXT, "U.S. Viewers ( million ) " TEXT)
Who directed episode 11 of the season?
SELECT "Director" FROM table_4103 WHERE "No. in season" = '11'
SELECT "Director" FROM "table_4103" WHERE "No. in season" = '11'
0.0625
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId 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 FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (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 TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId 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 ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
Number of answers in a given period.
SELECT COUNT(*) FROM Posts WHERE PostTypeId = 2 AND CreationDate BETWEEN '##start?2019-01-01##' AND '##end?2019-07-01##'
SELECT COUNT(*) FROM "Posts" WHERE "CreationDate" <= '##end?2019-07-01##' AND "CreationDate" >= '##start?2019-01-01##' AND "PostTypeId" = 2
0.135742
CREATE TABLE table_name_37 (team VARCHAR, drawn VARCHAR, lost VARCHAR)
Which team has 1 as the drawn, with 2 as the lost?
SELECT team FROM table_name_37 WHERE drawn = 1 AND lost = 2
SELECT "team" FROM "table_name_37" WHERE "drawn" = 1 AND "lost" = 2
0.06543
CREATE TABLE Invoices (invoice_number INT, order_id INT, invoice_date DATETIME) CREATE TABLE Customers (customer_id INT, customer_first_name VARCHAR, customer_middle_initial VARCHAR, customer_last_name VARCHAR, gender VARCHAR, email_address VARCHAR, login_name VARCHAR, login_password VARCHAR, phone_number VARCHAR, town_city VARCHAR, state_county_province VARCHAR, country VARCHAR) CREATE TABLE Order_Items (order_item_id INT, order_id INT, product_id INT, product_quantity VARCHAR, other_order_item_details VARCHAR) CREATE TABLE Invoice_Line_Items (order_item_id INT, invoice_number INT, product_id INT, product_title VARCHAR, product_quantity VARCHAR, product_price DECIMAL, derived_product_cost DECIMAL, derived_vat_payable DECIMAL, derived_total_cost DECIMAL) CREATE TABLE Product_Categories (production_type_code VARCHAR, product_type_description VARCHAR, vat_rating DECIMAL) CREATE TABLE Accounts (account_id INT, customer_id INT, date_account_opened DATETIME, account_name VARCHAR, other_account_details VARCHAR) CREATE TABLE Products (product_id INT, parent_product_id INT, production_type_code VARCHAR, unit_price DECIMAL, product_name VARCHAR, product_color VARCHAR, product_size VARCHAR) CREATE TABLE Financial_Transactions (transaction_id INT, account_id INT, invoice_number INT, transaction_type VARCHAR, transaction_date DATETIME, transaction_amount DECIMAL, transaction_comment VARCHAR, other_transaction_details VARCHAR) CREATE TABLE Orders (order_id INT, customer_id INT, date_order_placed DATETIME, order_details VARCHAR)
How many accounts for each customer? Show a bar chart that groups by customer's last name, I want to order Y-axis from low to high order.
SELECT customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*)
SELECT "customer_last_name", COUNT(*) FROM "Accounts" AS "T1" JOIN "Customers" AS "T2" ON "T1"."customer_id" = "T2"."customer_id" GROUP BY "T1"."customer_id" ORDER BY COUNT(*) NULLS FIRST
0.182617
CREATE TABLE table_25647137_2 (touchdowns INT)
What was the highest number of touchdowns by a player?
SELECT MAX(touchdowns) FROM table_25647137_2
SELECT MAX("touchdowns") FROM "table_25647137_2"
0.046875
CREATE TABLE Ref_Address_Types (address_type_code VARCHAR, address_type_description VARCHAR) CREATE TABLE Ref_Incident_Type (incident_type_code VARCHAR, incident_type_description VARCHAR) CREATE TABLE Behavior_Incident (incident_id INT, incident_type_code VARCHAR, student_id INT, date_incident_start DATETIME, date_incident_end DATETIME, incident_summary VARCHAR, recommendations VARCHAR, other_details VARCHAR) CREATE TABLE Student_Addresses (student_id INT, address_id INT, date_address_from DATETIME, date_address_to DATETIME, monthly_rental DECIMAL, other_details VARCHAR) CREATE TABLE Teachers (teacher_id INT, address_id INT, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, gender VARCHAR, cell_mobile_number VARCHAR, email_address VARCHAR, other_details VARCHAR) CREATE TABLE Addresses (address_id INT, line_1 VARCHAR, line_2 VARCHAR, line_3 VARCHAR, city VARCHAR, zip_postcode VARCHAR, state_province_county VARCHAR, country VARCHAR, other_address_details VARCHAR) CREATE TABLE Assessment_Notes (notes_id INT, student_id INT, teacher_id INT, date_of_notes DATETIME, text_of_notes VARCHAR, other_details VARCHAR) CREATE TABLE Ref_Detention_Type (detention_type_code VARCHAR, detention_type_description VARCHAR) CREATE TABLE Students_in_Detention (student_id INT, detention_id INT, incident_id INT) CREATE TABLE Detention (detention_id INT, detention_type_code VARCHAR, teacher_id INT, datetime_detention_start DATETIME, datetime_detention_end DATETIME, detention_summary VARCHAR, other_details VARCHAR) CREATE TABLE Students (student_id INT, address_id INT, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, cell_mobile_number VARCHAR, email_address VARCHAR, date_first_rental DATETIME, date_left_university DATETIME, other_student_details VARCHAR)
Give me the comparison about the average of monthly_rental over the date_address_to , and group by attribute other_details and bin date_address_to by time by a bar chart.
SELECT date_address_to, AVG(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
SELECT "date_address_to", AVG("monthly_rental") FROM "Student_Addresses" GROUP BY "other_details" ORDER BY "monthly_rental" DESC NULLS LAST
0.135742
CREATE TABLE table_60114 ("Country" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalogue #" TEXT)
Which format is in Japan?
SELECT "Format" FROM table_60114 WHERE "Country" = 'japan'
SELECT "Format" FROM "table_60114" WHERE "Country" = 'japan'
0.058594
CREATE TABLE table_34344 ("Score" TEXT, "Opposition" TEXT, "Venue" TEXT, "City" TEXT, "Year" FLOAT)
What score has 1998 as the year?
SELECT "Score" FROM table_34344 WHERE "Year" = '1998'
SELECT "Score" FROM "table_34344" WHERE "Year" = '1998'
0.053711
CREATE TABLE table_name_47 (opponent VARCHAR, record VARCHAR, game VARCHAR, february VARCHAR)
Who was the opponent in games over 58, after Feb 16, and having a record of 40-20-4?
SELECT opponent FROM table_name_47 WHERE game > 58 AND february > 16 AND record = "40-20-4"
SELECT "opponent" FROM "table_name_47" WHERE "40-20-4" = "record" AND "february" > 16 AND "game" > 58
0.098633
CREATE TABLE item (i_id DECIMAL, title TEXT) CREATE TABLE review (a_id DECIMAL, u_id DECIMAL, i_id DECIMAL, rating DECIMAL, rank DECIMAL) CREATE TABLE trust (source_u_id DECIMAL, target_u_id DECIMAL, trust DECIMAL) CREATE TABLE useracct (u_id DECIMAL, name TEXT)
Find the titles of items that received both a rating higher than 8 and a rating below 5.
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5
SELECT "T1"."title" FROM "item" AS "T1" JOIN "review" AS "T2" ON "T1"."i_id" = "T2"."i_id" AND "T2"."rating" > 8 INTERSECT SELECT "T1"."title" FROM "item" AS "T1" JOIN "review" AS "T2" ON "T1"."i_id" = "T2"."i_id" AND "T2"."rating" < 5
0.229492
CREATE TABLE table_13619027_10 (game INT)
What is the highest game number?
SELECT MAX(game) FROM table_13619027_10
SELECT MAX("game") FROM "table_13619027_10"
0.041992
CREATE TABLE table_204_423 (id DECIMAL, "name" TEXT, "location" TEXT, "city" TEXT, "listing date" TEXT)
how many historic sites are listed in coldwater ?
SELECT COUNT("name") FROM table_204_423 WHERE "city" = 'coldwater'
SELECT COUNT("name") FROM "table_204_423" WHERE "city" = 'coldwater'
0.066406
CREATE TABLE table_17697980_1 (no_of_episodes INT, year VARCHAR)
What is the largest number of episodes for a 1989 season dvd release?
SELECT MAX(no_of_episodes) FROM table_17697980_1 WHERE year = "1989"
SELECT MAX("no_of_episodes") FROM "table_17697980_1" WHERE "1989" = "year"
0.072266
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange 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 PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId 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 ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId 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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment 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 ReviewTaskTypes (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 FlagTypes (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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
Top Stackoverflow users in san fran.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%francisco%' OR UPPER(Location) = 'CA' ORDER BY Reputation DESC
SELECT ROW_NUMBER() OVER (ORDER BY "Reputation" DESC NULLS LAST) AS "#", "Id" AS "user_link", "Reputation" FROM "Users" WHERE LOWER("Location") LIKE '%francisco%' OR UPPER("Location") = 'CA' ORDER BY "Reputation" DESC NULLS LAST
0.222656
CREATE TABLE Financial_Transactions (transaction_id INT, account_id INT, invoice_number INT, transaction_type VARCHAR, transaction_date DATETIME, transaction_amount DECIMAL, transaction_comment VARCHAR, other_transaction_details VARCHAR) CREATE TABLE Order_Items (order_item_id INT, order_id INT, product_id INT, product_quantity VARCHAR, other_order_item_details VARCHAR) CREATE TABLE Products (product_id INT, parent_product_id INT, production_type_code VARCHAR, unit_price DECIMAL, product_name VARCHAR, product_color VARCHAR, product_size VARCHAR) CREATE TABLE Accounts (account_id INT, customer_id INT, date_account_opened DATETIME, account_name VARCHAR, other_account_details VARCHAR) CREATE TABLE Invoice_Line_Items (order_item_id INT, invoice_number INT, product_id INT, product_title VARCHAR, product_quantity VARCHAR, product_price DECIMAL, derived_product_cost DECIMAL, derived_vat_payable DECIMAL, derived_total_cost DECIMAL) CREATE TABLE Customers (customer_id INT, customer_first_name VARCHAR, customer_middle_initial VARCHAR, customer_last_name VARCHAR, gender VARCHAR, email_address VARCHAR, login_name VARCHAR, login_password VARCHAR, phone_number VARCHAR, town_city VARCHAR, state_county_province VARCHAR, country VARCHAR) CREATE TABLE Product_Categories (production_type_code VARCHAR, product_type_description VARCHAR, vat_rating DECIMAL) CREATE TABLE Orders (order_id INT, customer_id INT, date_order_placed DATETIME, order_details VARCHAR) CREATE TABLE Invoices (invoice_number INT, order_id INT, invoice_date DATETIME)
Show the transaction types and the total amount of transactions with a bar chart.
SELECT transaction_type, SUM(transaction_amount) FROM Financial_Transactions GROUP BY transaction_type
SELECT "transaction_type", SUM("transaction_amount") FROM "Financial_Transactions" GROUP BY "transaction_type"
0.107422
CREATE TABLE table_1399 ("Headphone Model" TEXT, "Headphone Class" TEXT, "Sensitivity ( dB ) " TEXT, "Impedance ( Ohms ) " FLOAT, "Driver-matched dB" TEXT, "Construction" TEXT, "Earpads" TEXT, "Termination" TEXT, "Succeeded by" TEXT)
Name the headphone model for succeeded by sr125
SELECT "Headphone Model" FROM table_1399 WHERE "Succeeded by" = 'SR125'
SELECT "Headphone Model" FROM "table_1399" WHERE "Succeeded by" = 'SR125'
0.071289
CREATE TABLE table_name_56 (number_of_electorates__2009_ INT, constituency_number VARCHAR)
What's the number of electorates for constituency number 56?
SELECT SUM(number_of_electorates__2009_) FROM table_name_56 WHERE constituency_number = "56"
SELECT SUM("number_of_electorates__2009_") FROM "table_name_56" WHERE "56" = "constituency_number"
0.095703
CREATE TABLE table_69128 ("Stage" TEXT, "Winner" TEXT, "General classification" TEXT, "Points classification" TEXT, "Mountains classification" TEXT, "Young rider classification" TEXT, "Intergiro classification" TEXT, "Trofeo Fast Team" TEXT)
Name the mountains classification which has a young rider classification of francesco casagrande and integiro classification of not awarded with stage of 2
SELECT "Mountains classification" FROM table_69128 WHERE "Young rider classification" = 'francesco casagrande' AND "Intergiro classification" = 'not awarded' AND "Stage" = '2'
SELECT "Mountains classification" FROM "table_69128" WHERE "Intergiro classification" = 'not awarded' AND "Stage" = '2' AND "Young rider classification" = 'francesco casagrande'
0.172852
CREATE TABLE table_name_1 (lost VARCHAR, against INT)
How many losses have points against less than 15?
SELECT COUNT(lost) FROM table_name_1 WHERE against < 15
SELECT COUNT("lost") FROM "table_name_1" WHERE "against" < 15
0.05957
CREATE TABLE table_1310499_1 (input_splines VARCHAR, tag_id VARCHAR)
What is the 3rd ratio for tag number 1386-000-017 and input splines of 26?
SELECT 3 AS rd FROM table_1310499_1 WHERE input_splines = 26 AND tag_id = "1386-000-017"
SELECT 3 AS "rd" FROM "table_1310499_1" WHERE "1386-000-017" = "tag_id" AND "input_splines" = 26
0.09375
CREATE TABLE table_56873 ("Rank" FLOAT, "Rider" TEXT, "Team" TEXT, "Speed" TEXT, "Time" TEXT)
What is the time of the rider who has a rank smaller than 8 and speed of 104.567mph?
SELECT "Time" FROM table_56873 WHERE "Rank" < '8' AND "Speed" = '104.567mph'
SELECT "Time" FROM "table_56873" WHERE "Rank" < '8' AND "Speed" = '104.567mph'
0.076172
CREATE TABLE table_55975 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
How many spectators were at the away team Carlton?
SELECT "Crowd" FROM table_55975 WHERE "Away team" = 'carlton'
SELECT "Crowd" FROM "table_55975" WHERE "Away team" = 'carlton'
0.061523
CREATE TABLE table_name_85 (record VARCHAR, score VARCHAR)
What was the record when the score was 11-10?
SELECT record FROM table_name_85 WHERE score = "11-10"
SELECT "record" FROM "table_name_85" WHERE "11-10" = "score"
0.058594
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE 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 prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
what is the average total cost of the hospital involving a laboratory protein, total test the previous year?
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'protein, total')) AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY cost.hadm_id) AS t1
WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'protein, total' GROUP BY "itemid"), "_u_1" AS (SELECT "labevents"."hadm_id" FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."itemid" WHERE NOT "_u_0"."" IS NULL GROUP BY "hadm_id"), "t1" AS (SELECT SUM("cost"."cost") AS "c1" FROM "cost" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "cost"."hadm_id" WHERE DATETIME("cost"."chargetime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL GROUP BY "cost"."hadm_id") SELECT AVG("t1"."c1") FROM "t1" AS "t1"
0.597656
CREATE TABLE table_30642 ("Team" TEXT, "Average" TEXT, "Points" FLOAT, "Played" FLOAT, "2003-04" TEXT, "2004-05" TEXT, "2005-06" TEXT)
How many averages are associated with a 2003-2004 value of 62/38?
SELECT COUNT("Average") FROM table_30642 WHERE "2003-04" = '62/38'
SELECT COUNT("Average") FROM "table_30642" WHERE "2003-04" = '62/38'
0.066406
CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) 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 area (course_id INT, area VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR)
For the class about Creative Writing-Poetry , what is the course number ?
SELECT DISTINCT number FROM course WHERE (description LIKE '%Creative Writing-Poetry%' OR name LIKE '%Creative Writing-Poetry%') AND department = 'EECS'
SELECT DISTINCT "number" FROM "course" WHERE "department" = 'EECS' AND ("description" LIKE '%Creative Writing-Poetry%' OR "name" LIKE '%Creative Writing-Poetry%')
0.158203
CREATE TABLE table_50329 ("Year ended" TEXT, "Revenue ( \\u00a3million ) " FLOAT, "Profit/ ( loss ) before tax ( \\u00a3m ) " FLOAT, "Net profit ( \\u00a3m ) " FLOAT, "Earnings per share ( p ) " FLOAT)
When revenue is smaller than 4,177 million in year 2008, what is the sum of earnings per share?
SELECT SUM("Earnings per share (p)") FROM table_50329 WHERE "Year ended" = '2008' AND "Revenue (\u00a3million)" < '4,177'
SELECT SUM("Earnings per share (p)") FROM "table_50329" WHERE "Revenue (\u00a3million)" < '4,177' AND "Year ended" = '2008'
0.120117
CREATE TABLE postseason (year INT, round TEXT, team_id_winner TEXT, league_id_winner TEXT, team_id_loser TEXT, league_id_loser TEXT, wins INT, losses INT, ties INT) CREATE TABLE player_award_vote (award_id TEXT, year INT, league_id TEXT, player_id TEXT, points_won DECIMAL, points_max INT, votes_first DECIMAL) CREATE TABLE player (player_id TEXT, birth_year DECIMAL, birth_month DECIMAL, birth_day DECIMAL, birth_country TEXT, birth_state TEXT, birth_city TEXT, death_year DECIMAL, death_month DECIMAL, death_day DECIMAL, death_country TEXT, death_state TEXT, death_city TEXT, name_first TEXT, name_last TEXT, name_given TEXT, weight DECIMAL, height DECIMAL, bats TEXT, throws TEXT, debut TEXT, final_game TEXT, retro_id TEXT, bbref_id TEXT) CREATE TABLE batting_postseason (year INT, round TEXT, player_id TEXT, team_id TEXT, league_id TEXT, g INT, ab INT, r INT, h INT, double INT, triple INT, hr INT, rbi INT, sb INT, cs DECIMAL, bb INT, so INT, ibb DECIMAL, hbp DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE player_award (player_id TEXT, award_id TEXT, year INT, league_id TEXT, tie TEXT, notes TEXT) CREATE TABLE manager_award (player_id TEXT, award_id TEXT, year INT, league_id TEXT, tie TEXT, notes DECIMAL) CREATE TABLE appearances (year INT, team_id TEXT, league_id TEXT, player_id TEXT, g_all DECIMAL, gs DECIMAL, g_batting INT, g_defense DECIMAL, g_p INT, g_c INT, g_1b INT, g_2b INT, g_3b INT, g_ss INT, g_lf INT, g_cf INT, g_rf INT, g_of INT, g_dh DECIMAL, g_ph DECIMAL, g_pr DECIMAL) CREATE TABLE team_franchise (franchise_id TEXT, franchise_name TEXT, active TEXT, na_assoc TEXT) CREATE TABLE team_half (year INT, league_id TEXT, team_id TEXT, half INT, div_id TEXT, div_win TEXT, rank INT, g INT, w INT, l INT) CREATE TABLE fielding_postseason (player_id TEXT, year INT, team_id TEXT, league_id TEXT, round TEXT, pos TEXT, g INT, gs DECIMAL, inn_outs DECIMAL, po INT, a INT, e INT, dp INT, tp INT, pb DECIMAL, sb DECIMAL, cs DECIMAL) CREATE TABLE manager (player_id TEXT, year INT, team_id TEXT, league_id TEXT, inseason INT, g INT, w INT, l INT, rank DECIMAL, plyr_mgr TEXT) CREATE TABLE home_game (year INT, league_id TEXT, team_id TEXT, park_id TEXT, span_first TEXT, span_last TEXT, games INT, openings INT, attendance INT) CREATE TABLE manager_award_vote (award_id TEXT, year INT, league_id TEXT, player_id TEXT, points_won INT, points_max INT, votes_first INT) CREATE TABLE team (year INT, league_id TEXT, team_id TEXT, franchise_id TEXT, div_id TEXT, rank INT, g INT, ghome DECIMAL, w INT, l INT, div_win TEXT, wc_win TEXT, lg_win TEXT, ws_win TEXT, r INT, ab INT, h INT, double INT, triple INT, hr INT, bb INT, so DECIMAL, sb DECIMAL, cs DECIMAL, hbp DECIMAL, sf DECIMAL, ra INT, er INT, era DECIMAL, cg INT, sho INT, sv INT, ipouts INT, ha INT, hra INT, bba INT, soa INT, e INT, dp DECIMAL, fp DECIMAL, name TEXT, park TEXT, attendance DECIMAL, bpf INT, ppf INT, team_id_br TEXT, team_id_lahman45 TEXT, team_id_retro TEXT) CREATE TABLE salary (year INT, team_id TEXT, league_id TEXT, player_id TEXT, salary INT) CREATE TABLE hall_of_fame (player_id TEXT, yearid INT, votedby TEXT, ballots DECIMAL, needed DECIMAL, votes DECIMAL, inducted TEXT, category TEXT, needed_note TEXT) CREATE TABLE all_star (player_id TEXT, year INT, game_num INT, game_id TEXT, team_id TEXT, league_id TEXT, gp DECIMAL, starting_pos DECIMAL) CREATE TABLE park (park_id TEXT, park_name TEXT, park_alias TEXT, city TEXT, state TEXT, country TEXT) CREATE TABLE fielding_outfield (player_id TEXT, year INT, stint INT, glf DECIMAL, gcf DECIMAL, grf DECIMAL) CREATE TABLE pitching_postseason (player_id TEXT, year INT, round TEXT, team_id TEXT, league_id TEXT, w INT, l INT, g INT, gs INT, cg INT, sho INT, sv INT, ipouts INT, h INT, er INT, hr INT, bb INT, so INT, baopp TEXT, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk DECIMAL, bfp DECIMAL, gf INT, r INT, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE player_college (player_id TEXT, college_id TEXT, year INT) CREATE TABLE manager_half (player_id TEXT, year INT, team_id TEXT, league_id TEXT, inseason INT, half INT, g INT, w INT, l INT, rank INT) CREATE TABLE fielding (player_id TEXT, year INT, stint INT, team_id TEXT, league_id TEXT, pos TEXT, g INT, gs DECIMAL, inn_outs DECIMAL, po DECIMAL, a DECIMAL, e DECIMAL, dp DECIMAL, pb DECIMAL, wp DECIMAL, sb DECIMAL, cs DECIMAL, zr DECIMAL) CREATE TABLE college (college_id TEXT, name_full TEXT, city TEXT, state TEXT, country TEXT) CREATE TABLE pitching (player_id TEXT, year INT, stint INT, team_id TEXT, league_id TEXT, w INT, l INT, g INT, gs INT, cg INT, sho INT, sv INT, ipouts DECIMAL, h INT, er INT, hr INT, bb INT, so INT, baopp DECIMAL, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk INT, bfp DECIMAL, gf DECIMAL, r INT, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE batting (player_id TEXT, year INT, stint INT, team_id TEXT, league_id TEXT, g INT, ab DECIMAL, r DECIMAL, h DECIMAL, double DECIMAL, triple DECIMAL, hr DECIMAL, rbi DECIMAL, sb DECIMAL, cs DECIMAL, bb DECIMAL, so DECIMAL, ibb DECIMAL, hbp DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL)
Can you draw the trend of sum attendance over the binning year?, order in asc by the X.
SELECT year, SUM(attendance) FROM home_game ORDER BY year
SELECT "year", SUM("attendance") FROM "home_game" ORDER BY "year" NULLS FIRST
0.075195
CREATE TABLE table_1974782_1 (enrollment INT, institution VARCHAR)
What's Babson College's enrollment?
SELECT MAX(enrollment) FROM table_1974782_1 WHERE institution = "Babson College"
SELECT MAX("enrollment") FROM "table_1974782_1" WHERE "Babson College" = "institution"
0.083984
CREATE TABLE table_name_9 (score VARCHAR, attendance VARCHAR)
What is the score for the game that has an attendance of 5,298?
SELECT score FROM table_name_9 WHERE attendance = "5,298"
SELECT "score" FROM "table_name_9" WHERE "5,298" = "attendance"
0.061523
CREATE TABLE table_name_23 (third VARCHAR, season VARCHAR, lead VARCHAR, second VARCHAR)
What is the Third when the Lead was don bartlett, the Second was carter rycroft, and a Season of 2003 04?
SELECT third FROM table_name_23 WHERE lead = "don bartlett" AND second = "carter rycroft" AND season = "2003–04"
SELECT "third" FROM "table_name_23" WHERE "2003–04" = "season" AND "carter rycroft" = "second" AND "don bartlett" = "lead"
0.119141
CREATE TABLE table_23086 ("Rnd" FLOAT, "Circuit" TEXT, "LMP1 Winning Team" TEXT, "LMP2 Winning Team" TEXT, "GT2 Winning Team" TEXT, "Challenge Winning Team" TEXT, "Results" TEXT)
Name the circuit for #47 orbit racing
SELECT "Circuit" FROM table_23086 WHERE "Challenge Winning Team" = '#47 Orbit Racing'
SELECT "Circuit" FROM "table_23086" WHERE "Challenge Winning Team" = '#47 Orbit Racing'
0.084961
CREATE TABLE table_68444 ("Year" TEXT, "Start" TEXT, "Qual" TEXT, "Rank" TEXT, "Finish" TEXT, "Laps" FLOAT)
The 147.481 Qual, happened in what year?
SELECT "Year" FROM table_68444 WHERE "Qual" = '147.481'
SELECT "Year" FROM "table_68444" WHERE "Qual" = '147.481'
0.055664
CREATE TABLE table_24457 ("Country" TEXT, "Area ( km\\u00b2 ) " TEXT, "Population ( millions , 2011 ) " TEXT, "GDP ( PPP ) ( USD , per capita ) " FLOAT, "GDP ( nominal ) ( billions USD ) " TEXT, "HDI ( 2011 ) " TEXT)
What is the population in millions for 2011 where the HDI for 2011 is 0.453 (low)?
SELECT "Population (millions, 2011)" FROM table_24457 WHERE "HDI (2011)" = '0.453 (low)'
SELECT "Population (millions, 2011)" FROM "table_24457" WHERE "HDI (2011)" = '0.453 (low)'
0.087891
CREATE TABLE table_1231316_4 (location VARCHAR, athlete VARCHAR)
Where is Dwain Chambers from
SELECT location FROM table_1231316_4 WHERE athlete = "Dwain Chambers"
SELECT "location" FROM "table_1231316_4" WHERE "Dwain Chambers" = "athlete"
0.073242
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 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 PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE FlagTypes (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 ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewTaskStates (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 PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
number of posts by tagname.
SELECT COUNT(Posts.Id), MONTH(Posts.CreationDate), YEAR(Posts.CreationDate), Tags.TagName FROM Posts JOIN PostTags ON Posts.Id = PostTags.PostId JOIN Tags ON Tags.Id = PostTags.TagId WHERE Tags.TagName = '##TagName:string##' GROUP BY YEAR(Posts.CreationDate), MONTH(Posts.CreationDate), Tags.TagName
SELECT COUNT("Posts"."Id"), MONTH("Posts"."CreationDate"), YEAR("Posts"."CreationDate"), "Tags"."TagName" FROM "Posts" JOIN "PostTags" ON "PostTags"."PostId" = "Posts"."Id" JOIN "Tags" ON "PostTags"."TagId" = "Tags"."Id" AND "Tags"."TagName" = '##TagName:string##' GROUP BY YEAR("Posts"."CreationDate"), MONTH("Posts"."CreationDate"), "Tags"."TagName"
0.342773
CREATE TABLE table_24212608_1 (starring VARCHAR, episode VARCHAR)
Who starred in episode 3?
SELECT starring FROM table_24212608_1 WHERE episode = 3
SELECT "starring" FROM "table_24212608_1" WHERE "episode" = 3
0.05957
CREATE TABLE Movie (mID INT, title TEXT, year INT, director TEXT) CREATE TABLE Reviewer (rID INT, name TEXT) CREATE TABLE Rating (rID INT, mID INT, stars INT, ratingDate DATE)
Draw a bar chart for what is the average number of stars that each reviewer awards for a movie?, and show in descending by the Y-axis.
SELECT name, AVG(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name ORDER BY AVG(T1.stars) DESC
SELECT "name", AVG("T1"."stars") FROM "Rating" AS "T1" JOIN "Reviewer" AS "T2" ON "T1"."rID" = "T2"."rID" GROUP BY "T2"."name" ORDER BY AVG("T1"."stars") DESC NULLS LAST
0.165039
CREATE TABLE table_31393 ("Season" TEXT, "Season premiere" TEXT, "Season finale" TEXT, "TV season" TEXT, "Ranking" TEXT, "Viewers ( in millions ) " TEXT)
When did the season finale for the January 9, 2000 season premiere first air?
SELECT "Season finale" FROM table_31393 WHERE "Season premiere" = 'January 9, 2000'
SELECT "Season finale" FROM "table_31393" WHERE "Season premiere" = 'January 9, 2000'
0.083008
CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL)
For those employees who was hired before 2002-06-21, visualize a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id.
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
SELECT "JOB_ID", AVG("SALARY") FROM "employees" WHERE "HIRE_DATE" < '2002-06-21' GROUP BY "JOB_ID"
0.095703
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) 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)
Get me the average age of patients who were admitted on or after 2168 with left colon cancer as their primary disease.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "LEFT COLON CANCER" AND demographic.admityear >= "2168"
SELECT AVG("demographic"."age") FROM "demographic" WHERE "2168" <= "demographic"."admityear" AND "LEFT COLON CANCER" = "demographic"."diagnosis"
0.140625
CREATE TABLE table_25518 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT)
The episode which originally aired on December 17, 2004 was written by whom?
SELECT "Written by" FROM table_25518 WHERE "Original air date" = 'December 17, 2004'
SELECT "Written by" FROM "table_25518" WHERE "Original air date" = 'December 17, 2004'
0.083984
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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE 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 intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
the systemicdiastolic of patient 027-89377 was ever less than 72.0 this month?
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-89377')) AND vitalperiodic.systemicdiastolic < 72.0 AND NOT vitalperiodic.systemicdiastolic IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '027-89377' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "vitalperiodic" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE "vitalperiodic"."systemicdiastolic" < 72.0 AND DATETIME("vitalperiodic"."observationtime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."systemicdiastolic" IS NULL
0.708984
CREATE TABLE table_name_57 (record VARCHAR, date VARCHAR)
What is the record of the game on March 5?
SELECT record FROM table_name_57 WHERE date = "march 5"
SELECT "record" FROM "table_name_57" WHERE "date" = "march 5"
0.05957
CREATE TABLE table_203_27 (id DECIMAL, "number" DECIMAL, "serial no" DECIMAL, "entered service" TEXT, "withdrawn" TEXT, "kilometres travelled" DECIMAL)
which locomotive did not have any info after it entered into service ?
SELECT "number" FROM table_203_27 WHERE "kilometres travelled" IS NULL
SELECT "number" FROM "table_203_27" WHERE "kilometres travelled" IS NULL
0.070313
CREATE TABLE table_1540 ("Rank" FLOAT, "Company" TEXT, "Headquarters" TEXT, "Industry" TEXT, "Sales ( billion $ ) " TEXT, "Profits ( billion $ ) " TEXT, "Assets ( billion $ ) " TEXT, "Market Value ( billion $ ) " TEXT)
What are Wells Fargo's assets?
SELECT "Assets (billion $)" FROM table_1540 WHERE "Company" = 'Wells Fargo'
SELECT "Assets (billion $)" FROM "table_1540" WHERE "Company" = 'Wells Fargo'
0.075195
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 vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
what was the last systemicsystolic value patient 007-849 had since 12/27/2105?
SELECT vitalperiodic.systemicsystolic FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-849')) AND NOT vitalperiodic.systemicsystolic IS NULL AND STRFTIME('%y-%m-%d', vitalperiodic.observationtime) >= '2105-12-27' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '007-849' 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 "vitalperiodic"."systemicsystolic" FROM "vitalperiodic" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."systemicsystolic" IS NULL AND STRFTIME('%y-%m-%d', "vitalperiodic"."observationtime") >= '2105-12-27' ORDER BY "vitalperiodic"."observationtime" DESC NULLS LAST LIMIT 1
0.701172
CREATE TABLE table_name_52 (laps INT, time_retired VARCHAR)
Which Laps is the highest one that has a Time/Retired of +3.370 secs?
SELECT MAX(laps) FROM table_name_52 WHERE time_retired = "+3.370 secs"
SELECT MAX("laps") FROM "table_name_52" WHERE "+3.370 secs" = "time_retired"
0.074219
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
when has patient 025-28600 in their first hospital visit received a microbiology test for the first time?
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-28600' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) ORDER BY microlab.culturetakentime LIMIT 1
SELECT "microlab"."culturetakentime" FROM "microlab" WHERE "microlab"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."patienthealthsystemstayid" IN (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '025-28600' AND NOT "patient"."hospitaldischargetime" IS NULL ORDER BY "patient"."hospitaladmittime" NULLS FIRST LIMIT 1)) ORDER BY "microlab"."culturetakentime" NULLS FIRST LIMIT 1
0.454102
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) 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 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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE 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 FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) 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 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)
Percent of answers given to questions with a particular tag per day.
WITH AnsTagInfo(AnsId, AnsCreationDate, quesHasTag) AS (SELECT a.Id AS AnsId, DATE(a.CreationDate) AS AnsCreationDate, CASE WHEN (q.Tags LIKE ('%<##TagName##>%')) THEN 1 ELSE 0 END AS quesHasTag FROM Posts AS a INNER JOIN Posts AS q ON q.Id = a.ParentId WHERE a.PostTypeId = 2) SELECT AnsCreationDate, CASE WHEN (COUNT(*) = 0) THEN 0 ELSE (ROUND((CAST(SUM(quesHasTag) * 100 AS FLOAT)) / (CAST(COUNT(*) AS FLOAT)), 2)) END AS "percent" FROM AnsTagInfo GROUP BY AnsCreationDate ORDER BY AnsCreationDate
SELECT "AnsCreationDate", CASE WHEN COUNT(*) = 0 THEN 0 ELSE ROUND(CAST(SUM("quesHasTag") * 100 AS FLOAT) / NULLIF(CAST(COUNT(*) AS FLOAT), 0), 2) END AS "percent" FROM "Posts" AS "a" JOIN "Posts" AS "q" ON "a"."ParentId" = "q"."Id" WHERE "a"."PostTypeId" = 2 GROUP BY "AnsCreationDate" ORDER BY "AnsCreationDate" NULLS FIRST
0.317383
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
show me the number of patients who were hospitalized for more than 34 days and were less than 86 years of age.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "86" AND demographic.days_stay > "34"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "34" < "demographic"."days_stay" AND "86" > "demographic"."age"
0.134766
CREATE TABLE table_9301 ("Date" TEXT, "Opponent" TEXT, "Venue" TEXT, "Result" TEXT, "Attendance" FLOAT)
What is Attendance, when Date is '26 December 2004'?
SELECT "Attendance" FROM table_9301 WHERE "Date" = '26 december 2004'
SELECT "Attendance" FROM "table_9301" WHERE "Date" = '26 december 2004'
0.069336
CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT) 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)
Find the names of stadiums that some Australian swimmers have been to, and count them by a pie chart
SELECT T4.Name, COUNT(T4.Name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID JOIN event AS t3 ON t2.Event_ID = t3.ID JOIN stadium AS t4 ON t4.ID = t3.Stadium_ID WHERE t1.Nationality = 'Australia' GROUP BY T4.Name
SELECT "T4"."Name", COUNT("T4"."Name") FROM "swimmer" AS "t1" JOIN "record" AS "t2" ON "t1"."ID" = "t2"."Swimmer_ID" JOIN "event" AS "t3" ON "t2"."Event_ID" = "t3"."ID" JOIN "stadium" AS "t4" ON "t3"."Stadium_ID" = "t4"."ID" WHERE "t1"."Nationality" = 'Australia' GROUP BY "T4"."Name"
0.277344
CREATE TABLE table_name_90 (rank VARCHAR, height__ft_ VARCHAR, city VARCHAR, floors VARCHAR)
what is the rank for the city of cologne, floors is 34 and height (ft) is more than 452.8?
SELECT COUNT(rank) FROM table_name_90 WHERE city = "cologne" AND floors = 34 AND height__ft_ > 452.8
SELECT COUNT("rank") FROM "table_name_90" WHERE "city" = "cologne" AND "floors" = 34 AND "height__ft_" > 452.8
0.107422
CREATE TABLE table_27905664_1 (COUNT VARCHAR, us_viewers__million_ VARCHAR)
How many episode numbers had US viewership of 4.26 million?
SELECT COUNT AS № FROM table_27905664_1 WHERE us_viewers__million_ = "4.26"
SELECT "COUNT" AS "№" FROM "table_27905664_1" WHERE "4.26" = "us_viewers__million_"
0.081055
CREATE TABLE Product_Categories (production_type_code VARCHAR, product_type_description VARCHAR, vat_rating DECIMAL) CREATE TABLE Orders (order_id INT, customer_id INT, date_order_placed DATETIME, order_details VARCHAR) CREATE TABLE Products (product_id INT, parent_product_id INT, production_type_code VARCHAR, unit_price DECIMAL, product_name VARCHAR, product_color VARCHAR, product_size VARCHAR) CREATE TABLE Financial_Transactions (transaction_id INT, account_id INT, invoice_number INT, transaction_type VARCHAR, transaction_date DATETIME, transaction_amount DECIMAL, transaction_comment VARCHAR, other_transaction_details VARCHAR) CREATE TABLE Customers (customer_id INT, customer_first_name VARCHAR, customer_middle_initial VARCHAR, customer_last_name VARCHAR, gender VARCHAR, email_address VARCHAR, login_name VARCHAR, login_password VARCHAR, phone_number VARCHAR, town_city VARCHAR, state_county_province VARCHAR, country VARCHAR) CREATE TABLE Order_Items (order_item_id INT, order_id INT, product_id INT, product_quantity VARCHAR, other_order_item_details VARCHAR) CREATE TABLE Accounts (account_id INT, customer_id INT, date_account_opened DATETIME, account_name VARCHAR, other_account_details VARCHAR) CREATE TABLE Invoice_Line_Items (order_item_id INT, invoice_number INT, product_id INT, product_title VARCHAR, product_quantity VARCHAR, product_price DECIMAL, derived_product_cost DECIMAL, derived_vat_payable DECIMAL, derived_total_cost DECIMAL) CREATE TABLE Invoices (invoice_number INT, order_id INT, invoice_date DATETIME)
Show the product ids and the number of unique orders containing each product by a scatter chart.
SELECT product_id, COUNT(DISTINCT order_id) FROM Order_Items
SELECT "product_id", COUNT(DISTINCT "order_id") FROM "Order_Items"
0.064453
CREATE TABLE table_22351 ("No." FLOAT, "Album" TEXT, "Artist" TEXT, "Record label" TEXT, "Released" TEXT, "Chart peak" FLOAT, "Number of times certified platinum" TEXT)
When 35 is the number what is the album?
SELECT "Album" FROM table_22351 WHERE "No." = '35'
SELECT "Album" FROM "table_22351" WHERE "No." = '35'
0.050781
CREATE TABLE table_29412 ("Athlete" TEXT, "Event" TEXT, "Round of 32" TEXT, "Round of 16" TEXT, "Quarterfinals" TEXT, "Semifinals" TEXT)
What is the round of 32 if the round of 16 is drenovak ( srb ) w 20 11?
SELECT "Round of 32" FROM table_29412 WHERE "Round of 16" = 'Drenovak ( SRB ) W 20–11'
SELECT "Round of 32" FROM "table_29412" WHERE "Round of 16" = 'Drenovak ( SRB ) W 20–11'
0.085938
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 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (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 SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId 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) 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 CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
Accepted answers by Join Date.
SELECT YEAR(Users.CreationDate) AS cYear, MONTH(Users.CreationDate) AS cMonth, COUNT(Users.Id) FROM Posts AS A JOIN Posts AS B ON A.AcceptedAnswerId = B.Id JOIN Users ON Users.Id = B.OwnerUserId GROUP BY YEAR(Users.CreationDate), MONTH(Users.CreationDate) ORDER BY 1, 2
SELECT YEAR("Users"."CreationDate") AS "cYear", MONTH("Users"."CreationDate") AS "cMonth", COUNT("Users"."Id") FROM "Posts" AS "A" JOIN "Posts" AS "B" ON "A"."AcceptedAnswerId" = "B"."Id" JOIN "Users" ON "B"."OwnerUserId" = "Users"."Id" GROUP BY YEAR("Users"."CreationDate"), MONTH("Users"."CreationDate") ORDER BY 1 NULLS FIRST, 2 NULLS FIRST
0.334961
CREATE TABLE table_42208 ("Record" TEXT, "Athlete" TEXT, "Nation" TEXT, "Venue" TEXT, "Date" TEXT)
What is the Nation with a Date that is may 6, 1991?
SELECT "Nation" FROM table_42208 WHERE "Date" = 'may 6, 1991'
SELECT "Nation" FROM "table_42208" WHERE "Date" = 'may 6, 1991'
0.061523
CREATE TABLE table_name_7 (against INT, opposing_team VARCHAR)
What is the highest Against for a game against Bristol City?
SELECT MAX(against) FROM table_name_7 WHERE opposing_team = "bristol city"
SELECT MAX("against") FROM "table_name_7" WHERE "bristol city" = "opposing_team"
0.078125
CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE 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 comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE 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 semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT)
How can the PreMajor requirement be satisfied with American Board of Orthodontics Phase II Review Course courses ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%American Board of Orthodontics Phase II Review Course%' OR course.description LIKE '%American Board of Orthodontics Phase II Review Course%' OR course.name LIKE '%American Board of Orthodontics Phase II Review Course%') AND program_course.category LIKE '%PreMajor%'
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "area" ON ("area"."area" LIKE '%American Board of Orthodontics Phase II Review Course%' OR "course"."description" LIKE '%American Board of Orthodontics Phase II Review Course%' OR "course"."name" LIKE '%American Board of Orthodontics Phase II Review Course%') AND "area"."course_id" = "course"."course_id" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%PreMajor%'
0.512695
CREATE TABLE table_train_123 ("id" INT, "bleeding" INT, "systolic_blood_pressure_sbp" INT, "anticoagulation" BOOLEAN, "lumbar_puncture" BOOLEAN, "blood_pressure_problem" BOOLEAN, "stroke" BOOLEAN, "substance_dependence" BOOLEAN, "schizophrenia" BOOLEAN, "major_mental_illness" BOOLEAN, "multiple_sclerosis" BOOLEAN, "platelet_count" FLOAT, "pulse_rate" INT, "diastolic_blood_pressure_dbp" INT, "diabetes_problem" BOOLEAN, "sepsis" BOOLEAN, "breathing_problem" BOOLEAN, "alzheimer_disease_ad" BOOLEAN, "neurological_disease" BOOLEAN, "seizure_disorder" BOOLEAN, "alcohol_abuse" BOOLEAN, "brain_tumor" BOOLEAN, "parkinson_disease" BOOLEAN, "major_depression" BOOLEAN, "NOUSE" FLOAT)
significant neurologic disease such as alzheimer's disease, parkinson's disease, stroke, brain tumor, multiple sclerosis or seizure disorder.
SELECT * FROM table_train_123 WHERE neurological_disease = 1 OR (alzheimer_disease_ad = 1 OR parkinson_disease = 1 OR stroke = 1 OR brain_tumor = 1 OR multiple_sclerosis = 1 OR seizure_disorder = 1)
SELECT * FROM "table_train_123" WHERE "alzheimer_disease_ad" = 1 OR "brain_tumor" = 1 OR "multiple_sclerosis" = 1 OR "neurological_disease" = 1 OR "parkinson_disease" = 1 OR "seizure_disorder" = 1 OR "stroke" = 1
0.207031
CREATE TABLE table_73821 ("Settlement" TEXT, "Cyrillic Name Other Names" TEXT, "Type" TEXT, "Population ( 2011 ) " FLOAT, "Largest ethnic group ( 2002 ) " TEXT, "Dominant religion ( 2002 ) " TEXT)
What is the dominant religion in Gornji Tavankut?
SELECT "Dominant religion (2002)" FROM table_73821 WHERE "Settlement" = 'Gornji Tavankut'
SELECT "Dominant religion (2002)" FROM "table_73821" WHERE "Settlement" = 'Gornji Tavankut'
0.088867
CREATE TABLE table_1656555_1 (archbishop VARCHAR, ordained_bishop VARCHAR)
Which archbishop was ordained as bishop November 30, 1925?
SELECT archbishop FROM table_1656555_1 WHERE ordained_bishop = "November 30, 1925"
SELECT "archbishop" FROM "table_1656555_1" WHERE "November 30, 1925" = "ordained_bishop"
0.085938
CREATE TABLE table_name_79 (time VARCHAR, arranger_s_ VARCHAR)
What are the lengths of the tracks arranged by ROZ?
SELECT time FROM table_name_79 WHERE arranger_s_ = "roz"
SELECT "time" FROM "table_name_79" WHERE "arranger_s_" = "roz"
0.060547
CREATE TABLE table_203_309 (id DECIMAL, "team" TEXT, "winners" DECIMAL, "runners-up" DECIMAL, "years won" TEXT, "years lost" TEXT)
which teams have more wins that werder bremen ?
SELECT "team" FROM table_203_309 WHERE "winners" > (SELECT "winners" FROM table_203_309 WHERE "team" = 'werder bremen')
SELECT "team" FROM "table_203_309" WHERE "winners" > (SELECT "winners" FROM "table_203_309" WHERE "team" = 'werder bremen')
0.120117
CREATE TABLE table_name_65 (runs INT, ovrs VARCHAR, wkts VARCHAR)
What is the sum of the runs when the wkts were bigger than 0 and ovrs were smaller than 2?
SELECT SUM(runs) FROM table_name_65 WHERE ovrs < 2 AND wkts > 0
SELECT SUM("runs") FROM "table_name_65" WHERE "ovrs" < 2 AND "wkts" > 0
0.069336
CREATE TABLE claims_processing (claim_processing_id DECIMAL, claim_id DECIMAL, claim_outcome_code TEXT, claim_stage_id DECIMAL, staff_id DECIMAL) CREATE TABLE policies (policy_id DECIMAL, customer_id DECIMAL, policy_type_code TEXT, start_date TIME, end_date TIME) CREATE TABLE customers (customer_id DECIMAL, customer_details TEXT) CREATE TABLE staff (staff_id DECIMAL, staff_details TEXT) CREATE TABLE claims_processing_stages (claim_stage_id DECIMAL, next_claim_stage_id DECIMAL, claim_status_name TEXT, claim_status_description TEXT) CREATE TABLE claims_documents (claim_id DECIMAL, document_type_code TEXT, created_by_staff_id DECIMAL, created_date DECIMAL) CREATE TABLE claim_headers (claim_header_id DECIMAL, claim_status_code TEXT, claim_type_code TEXT, policy_id DECIMAL, date_of_claim TIME, date_of_settlement TIME, amount_claimed DECIMAL, amount_piad DECIMAL)
Find the customer who started a policy most recently.
SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.start_date = (SELECT MAX(start_date) FROM policies)
SELECT "t2"."customer_details" FROM "policies" AS "t1" JOIN "customers" AS "t2" ON "t1"."customer_id" = "t2"."customer_id" WHERE "t1"."start_date" = (SELECT MAX("start_date") FROM "policies")
0.186523
CREATE TABLE table_name_78 (institution VARCHAR, location VARCHAR)
what is the institution at akron, oh?
SELECT institution FROM table_name_78 WHERE location = "akron, oh"
SELECT "institution" FROM "table_name_78" WHERE "akron, oh" = "location"
0.070313
CREATE TABLE table_2234 ("Pos" TEXT, "No" TEXT, "Driver" TEXT, "Constructor" TEXT, "Part 1" TEXT, "Part 2" TEXT, "Part 3" TEXT, "Grid" TEXT)
What was the time in part 3 when Nick Heidfeld was the driver?
SELECT "Part 3" FROM table_2234 WHERE "Driver" = 'Nick Heidfeld'
SELECT "Part 3" FROM "table_2234" WHERE "Driver" = 'Nick Heidfeld'
0.064453
CREATE TABLE CloseReasonTypes (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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment 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 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 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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE 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 FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) 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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE 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 ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE VoteTypes (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 ReviewTaskResultTypes (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)
Low View High Votes com comentario.
SELECT questao.Id AS "post_link", questao.Score, questao.Title, questao.Body, questao.Tags, questao.ViewCount, comentario.Id, comentario.Score AS socre_comentario, comentario.ViewCount AS views_comentario FROM Posts AS questao JOIN Posts AS comentario ON questao.Id = comentario.ParentId WHERE questao.Tags LIKE '%<windows-phone%' AND questao.CreationDate >= '01/01/2018' AND questao.ParentId IS NULL ORDER BY comentario.Score DESC, questao.ViewCount
SELECT "questao"."Id" AS "post_link", "questao"."Score", "questao"."Title", "questao"."Body", "questao"."Tags", "questao"."ViewCount", "comentario"."Id", "comentario"."Score" AS "socre_comentario", "comentario"."ViewCount" AS "views_comentario" FROM "Posts" AS "questao" JOIN "Posts" AS "comentario" ON "comentario"."ParentId" = "questao"."Id" WHERE "questao"."CreationDate" >= '01/01/2018' AND "questao"."ParentId" IS NULL AND "questao"."Tags" LIKE '%<windows-phone%' ORDER BY "comentario"."Score" DESC NULLS LAST, "questao"."ViewCount" NULLS FIRST
0.536133
CREATE TABLE table_79506 ("Rank" FLOAT, "Athlete" TEXT, "Country" TEXT, "Time" TEXT, "Notes" TEXT)
What is the race time for emma twigg?
SELECT "Time" FROM table_79506 WHERE "Athlete" = 'emma twigg'
SELECT "Time" FROM "table_79506" WHERE "Athlete" = 'emma twigg'
0.061523
CREATE TABLE table_33838 ("Game" FLOAT, "December" FLOAT, "Opponent" TEXT, "Score" TEXT, "Record" TEXT)
December smaller than 21, and a Opponent of buffalo sabres had what score?
SELECT "Score" FROM table_33838 WHERE "December" < '21' AND "Opponent" = 'buffalo sabres'
SELECT "Score" FROM "table_33838" WHERE "December" < '21' AND "Opponent" = 'buffalo sabres'
0.088867
CREATE TABLE table_67852 ("Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Loss" TEXT, "Attendance" FLOAT, "Record" TEXT)
Which opponent lost with pitcher Kinney (0-1)?
SELECT "Opponent" FROM table_67852 WHERE "Loss" = 'kinney (0-1)'
SELECT "Opponent" FROM "table_67852" WHERE "Loss" = 'kinney (0-1)'
0.064453
CREATE TABLE table_203_299 (id DECIMAL, "year" DECIMAL, "competition" TEXT, "venue" TEXT, "position" TEXT, "notes" TEXT)
how many events were won in malaysia ?
SELECT COUNT("competition") FROM table_203_299 WHERE "venue" = 'malaysia'
SELECT COUNT("competition") FROM "table_203_299" WHERE "venue" = 'malaysia'
0.073242
CREATE TABLE table_77424 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" FLOAT, "Money ( $ ) " FLOAT)
What is the highest To Par, when Place is '1'?
SELECT MAX("To par") FROM table_77424 WHERE "Place" = '1'
SELECT MAX("To par") FROM "table_77424" WHERE "Place" = '1'
0.057617
CREATE TABLE table_name_19 (Id VARCHAR)
What is the 1880 figure when 1860 is N/A and 1910 is 494?
SELECT 1880 FROM table_name_19 WHERE 1860 = "n/a" AND 1910 = 494
SELECT 1880 FROM "table_name_19" WHERE FALSE
0.042969
CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) 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 offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college 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 instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id 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_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT)
Who will be teaching computing infrastructure courses ?
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN area ON course_offering.course_id = area.course_id WHERE area.area LIKE '%computing infrastructure%'
SELECT DISTINCT "instructor"."name" FROM "instructor" JOIN "offering_instructor" ON "instructor"."instructor_id" = "offering_instructor"."instructor_id" JOIN "course_offering" ON "course_offering"."offering_id" = "offering_instructor"."offering_id" JOIN "area" ON "area"."area" LIKE '%computing infrastructure%' AND "area"."course_id" = "course_offering"."course_id"
0.357422
CREATE TABLE table_24089503_1 (kentucky_oaks VARCHAR, belmont_stakes VARCHAR)
What was the Kentucky Oaks attendance the year the Belmont Stakes had 64,949 attendance?
SELECT kentucky_oaks FROM table_24089503_1 WHERE belmont_stakes = "64,949"
SELECT "kentucky_oaks" FROM "table_24089503_1" WHERE "64,949" = "belmont_stakes"
0.078125
CREATE TABLE table_51301 ("Driver" TEXT, "Constructor" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT)
What's the average laps driven by david coulthard?
SELECT AVG("Laps") FROM table_51301 WHERE "Driver" = 'david coulthard'
SELECT AVG("Laps") FROM "table_51301" WHERE "Driver" = 'david coulthard'
0.070313
CREATE TABLE table_name_30 (surface VARCHAR, city VARCHAR, tournament VARCHAR)
On what Surface will the Venezuela F5 Futures in Caracas be played?
SELECT surface FROM table_name_30 WHERE city = "caracas" AND tournament = "venezuela f5 futures"
SELECT "surface" FROM "table_name_30" WHERE "caracas" = "city" AND "tournament" = "venezuela f5 futures"
0.101563
CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) 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)
For all employees who have the letters D or S in their first name, visualize a scatter chart about the correlation between employee_id and manager_id .
SELECT EMPLOYEE_ID, MANAGER_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
SELECT "EMPLOYEE_ID", "MANAGER_ID" FROM "employees" WHERE "FIRST_NAME" LIKE '%D%' OR "FIRST_NAME" LIKE '%S%'
0.105469
CREATE TABLE table_10043 ("Rank" FLOAT, "Title" TEXT, "Studio" TEXT, "Director" TEXT, "Gross rental" TEXT)
What is the Studio of the Film with a Gross rental of $7,500,000?
SELECT "Studio" FROM table_10043 WHERE "Gross rental" = '$7,500,000'
SELECT "Studio" FROM "table_10043" WHERE "Gross rental" = '$7,500,000'
0.068359
CREATE TABLE Participates_in (stuid INT, actid INT) CREATE TABLE Faculty_Participates_in (FacID INT, actid INT) CREATE TABLE Activity (actid INT, activity_name VARCHAR) CREATE TABLE Student (StuID INT, LName VARCHAR, Fname VARCHAR, Age INT, Sex VARCHAR, Major INT, Advisor INT, city_code VARCHAR) CREATE TABLE Faculty (FacID INT, Lname VARCHAR, Fname VARCHAR, Rank VARCHAR, Sex VARCHAR, Phone INT, Room VARCHAR, Building VARCHAR)
How many students are advised by each rank of faculty? List the rank and the number of students in a bar chart, and rank by the Y in ascending.
SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank ORDER BY COUNT(*)
SELECT "Rank", COUNT(*) FROM "Faculty" AS "T1" JOIN "Student" AS "T2" ON "T1"."FacID" = "T2"."Advisor" GROUP BY "T1"."Rank" ORDER BY COUNT(*) NULLS FIRST
0.149414
CREATE TABLE table_204_265 (id DECIMAL, "no." DECIMAL, "title ( latin ) " TEXT, "title ( english translation ) " TEXT, "subject" TEXT, "date" TEXT)
latin title of the encyclical before the encyclical with the subject on the church in bavaria
SELECT "title (latin)" FROM table_204_265 WHERE id = (SELECT id FROM table_204_265 WHERE "subject" = 'on the church in bavaria') - 1
SELECT "title (latin)" FROM "table_204_265" WHERE "id" = (SELECT "id" FROM "table_204_265" WHERE "subject" = 'on the church in bavaria') - 1
0.136719
CREATE TABLE table_71519 ("Res." TEXT, "Record" TEXT, "Opponent" TEXT, "Method" TEXT, "Event" TEXT, "Round" FLOAT, "Time" TEXT, "Location" TEXT)
Which event only lasted for 3 rounds against Fernando Terere?
SELECT "Event" FROM table_71519 WHERE "Round" = '3' AND "Opponent" = 'fernando terere'
SELECT "Event" FROM "table_71519" WHERE "Opponent" = 'fernando terere' AND "Round" = '3'
0.085938
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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name 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 inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE 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 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 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 d_labitems (row_id DECIMAL, itemid DECIMAL, label 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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE 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)
how much is the diagnosis price for dvrtclo sml int w hmrhg.
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'dvrtclo sml int w hmrhg'))
WITH "_u_1" AS (SELECT "diagnoses_icd"."row_id" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'dvrtclo sml int w hmrhg' GROUP BY "row_id") SELECT DISTINCT "cost"."cost" FROM "cost" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "cost"."event_id" WHERE "cost"."event_type" = 'diagnoses_icd' AND NOT "_u_1"."" IS NULL
0.399414
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 code_description (code VARCHAR, description TEXT) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant 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 date_day (month_number INT, day_number INT, year INT, day_name 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 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_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id 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 ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE 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)
tell me the flights that leave PHILADELPHIA and go to DALLAS
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PHILADELPHIA' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'DALLAS'
0.498047
CREATE TABLE table_32428 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
Who is the home side when the away side score is 11.14 (80)?
SELECT "Home team" FROM table_32428 WHERE "Away team score" = '11.14 (80)'
SELECT "Home team" FROM "table_32428" WHERE "Away team score" = '11.14 (80)'
0.074219
CREATE TABLE table_44682 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Location" TEXT, "Attendance" FLOAT, "Record" TEXT, "Points" FLOAT)
What is the sum of Game, when Attendance is greater than 18,007, and when Opponent is 'Minnesota Wild'?
SELECT SUM("Game") FROM table_44682 WHERE "Attendance" > '18,007' AND "Opponent" = 'minnesota wild'
SELECT SUM("Game") FROM "table_44682" WHERE "Attendance" > '18,007' AND "Opponent" = 'minnesota wild'
0.098633