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_40664 ("Player" TEXT, "Club" TEXT, "League" FLOAT, "FA Cup" FLOAT, "FA Trophy" FLOAT, "League Cup" FLOAT, "Total" FLOAT)
Which League has a League Cup smaller than 0?
SELECT MIN("League") FROM table_40664 WHERE "League Cup" < '0'
SELECT MIN("League") FROM "table_40664" WHERE "League Cup" < '0'
0.0625
CREATE TABLE table_66403 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Location/Attendance" TEXT, "Series" TEXT)
What date has a game smaller than 4, and a score of 116-114?
SELECT "Date" FROM table_66403 WHERE "Game" < '4' AND "Score" = '116-114'
SELECT "Date" FROM "table_66403" WHERE "Game" < '4' AND "Score" = '116-114'
0.073242
CREATE TABLE table_name_4 (visitor VARCHAR, decision VARCHAR, record VARCHAR)
Who was the visitor when ward recorded the decision with a record of 22 21 4?
SELECT visitor FROM table_name_4 WHERE decision = "ward" AND record = "22–21–4"
SELECT "visitor" FROM "table_name_4" WHERE "22–21–4" = "record" AND "decision" = "ward"
0.084961
CREATE TABLE table_203_676 (id DECIMAL, "pick #" DECIMAL, "cfl team" TEXT, "player" TEXT, "position" TEXT, "college" TEXT)
which team that drafted players in round four had the longest name ?
SELECT "cfl team" FROM table_203_676 ORDER BY LENGTH("cfl team") DESC LIMIT 1
SELECT "cfl team" FROM "table_203_676" ORDER BY LENGTH("cfl team") DESC NULLS LAST LIMIT 1
0.087891
CREATE TABLE table_613 ("English Name" TEXT, "Simplified" TEXT, "Traditional" TEXT, "Pinyin" TEXT, "Area" FLOAT, "Population" FLOAT, "Density" FLOAT)
How many people live in ?
SELECT MAX("Population") FROM table_613 WHERE "Simplified" = '铅山县'
SELECT MAX("Population") FROM "table_613" WHERE "Simplified" = '铅山县'
0.066406
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt 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 class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name 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 flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR)
my question is i want to go to SAN FRANCISCO and i live in DENVER and i would like to fly on UA do you have an early flight
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.departure_time <= 1000 AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'UA'
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'DENVER' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."airline_code" = 'UA' AND "flight"."departure_time" <= 1000 JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SAN FRANCISCO'
0.570313
CREATE TABLE table_1176371_1 (location VARCHAR, la_matches VARCHAR, name_of_ground VARCHAR)
Where is ropery lane and la matches 7 location?
SELECT location FROM table_1176371_1 WHERE la_matches = 7 AND name_of_ground = "Ropery Lane"
SELECT "location" FROM "table_1176371_1" WHERE "Ropery Lane" = "name_of_ground" AND "la_matches" = 7
0.097656
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress 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 PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (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 VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) 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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange 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 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)
cliffer some closed questions that need cliffering. http://meta.stackexchange.com/questions/78048/enable-automatic-deletion-of-old-unanswered-zero-score-questions-after-a-year/92006#92006
SELECT q.Id AS "post_link", q.Score AS qScore, a.Score AS aScore, q.ViewCount AS Views, q.CreationDate AS qDate FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 AND a.PostTypeId = 2 AND q.AnswerCount = '##numOfAnswers?1##' AND q.Score < 1 AND a.Score = 1 AND LEN(a.Body) < '##lengthOfAnswer?654##' AND q.AcceptedAnswerId IS NULL AND DATEDIFF(DAY, q.ClosedDate, GETDATE()) > 10 AND DATEDIFF(DAY, q.LastEditDate, GETDATE()) > 10 AND q.Id NOT IN (SELECT PostId FROM PostLinks) GROUP BY q.Id, q.Score, a.Score, q.ViewCount, q.CreationDate ORDER BY a.Score
SELECT "q"."Id" AS "post_link", "q"."Score" AS "qScore", "a"."Score" AS "aScore", "q"."ViewCount" AS "Views", "q"."CreationDate" AS "qDate" FROM "Posts" AS "q" JOIN "Posts" AS "a" ON "a"."ParentId" = "q"."Id" AND "a"."PostTypeId" = 2 AND "a"."Score" = 1 AND LENGTH("a"."Body") < '##lengthOfAnswer?654##' WHERE "q"."AcceptedAnswerId" IS NULL AND "q"."AnswerCount" = '##numOfAnswers?1##' AND "q"."PostTypeId" = 1 AND "q"."Score" < 1 AND NOT "q"."Id" IN (SELECT "PostId" FROM "PostLinks") AND DATEDIFF(DAY, CAST("q"."ClosedDate" AS DATETIME), CAST("DAY" AS DATETIME)) > 10 AND DATEDIFF(DAY, CAST("q"."LastEditDate" AS DATETIME), CAST("DAY" AS DATETIME)) > 10 GROUP BY "q"."Id", "q"."Score", "a"."Score", "q"."ViewCount", "q"."CreationDate" ORDER BY "a"."Score" NULLS FIRST
0.750977
CREATE TABLE table_29059 ("Date" TEXT, "Time" TEXT, "Visiting team" TEXT, "Home team" TEXT, "Site" TEXT, "Broadcast" TEXT, "Result" TEXT, "Attendance" FLOAT)
Name the number of time for uab
SELECT COUNT("Time") FROM table_29059 WHERE "Visiting team" = 'UAB'
SELECT COUNT("Time") FROM "table_29059" WHERE "Visiting team" = 'UAB'
0.067383
CREATE TABLE table_name_82 (home_leg VARCHAR, opponents VARCHAR, competition VARCHAR, round VARCHAR)
Name the home leg for uefa europa league and round of q1 with opponents of motherwell
SELECT home_leg FROM table_name_82 WHERE competition = "uefa europa league" AND round = "q1" AND opponents = "motherwell"
SELECT "home_leg" FROM "table_name_82" WHERE "competition" = "uefa europa league" AND "motherwell" = "opponents" AND "q1" = "round"
0.12793
CREATE TABLE table_204_322 (id DECIMAL, "township" TEXT, "fips" DECIMAL, "population" DECIMAL, "population\ density\ /km2 ( /sq mi ) " TEXT, "land area\ km2 ( sq mi ) " TEXT, "water area\ km2 ( sq mi ) " TEXT, "water %" TEXT, "geographic coordinates" TEXT)
which township has the most residents ?
SELECT "township" FROM table_204_322 ORDER BY "population" DESC LIMIT 1
SELECT "township" FROM "table_204_322" ORDER BY "population" DESC NULLS LAST LIMIT 1
0.082031
CREATE TABLE architect (gender VARCHAR)
How many architects are female?
SELECT COUNT(*) FROM architect WHERE gender = 'female'
SELECT COUNT(*) FROM "architect" WHERE "gender" = 'female'
0.056641
CREATE TABLE table_1254 ("Year" FLOAT, "Events played" FLOAT, "Cuts made" FLOAT, "Wins" FLOAT, "2nds" FLOAT, "Top 10s" FLOAT, "Best finish" TEXT, "Earnings ( $ ) " FLOAT, "Rank" TEXT, "Scoring average" TEXT, "Scoring rank" TEXT)
What is the minimum number of wins?
SELECT MIN("Wins") FROM table_1254
SELECT MIN("Wins") FROM "table_1254"
0.035156
CREATE TABLE table_2196 ("Episode" TEXT, "First broadcast" TEXT, "Rufus guest" TEXT, "Marcus guest" TEXT, "Winner" TEXT)
What is the resulting score for the episodes where Rufus's guest is Sean Lock?
SELECT "Winner" FROM table_2196 WHERE "Rufus guest" = 'Sean Lock'
SELECT "Winner" FROM "table_2196" WHERE "Rufus guest" = 'Sean Lock'
0.06543
CREATE TABLE table_26562 ("DVD Name" TEXT, "Ep #" TEXT, "Region 1 ( US ) " TEXT, "Region 1 ( CAN ) " TEXT, "Region 2 ( UK ) " TEXT, "Region 2 ( Germany ) " TEXT, "Region 4 ( Australia ) " TEXT)
What is the region 1 (Canada) date associated with a region 1 (US) date of January 16, 2007?
SELECT "Region 1 (CAN)" FROM table_26562 WHERE "Region 1 (US)" = 'January 16, 2007'
SELECT "Region 1 (CAN)" FROM "table_26562" WHERE "Region 1 (US)" = 'January 16, 2007'
0.083008
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
indicate the daily maximum amount of systemicsystolic for patient 035-24054 on their current hospital encounter.
SELECT MAX(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 = '035-24054' AND patient.hospitaldischargetime IS NULL)) AND NOT vitalperiodic.systemicsystolic IS NULL GROUP BY STRFTIME('%y-%m-%d', vitalperiodic.observationtime)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '035-24054' 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 MAX("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 GROUP BY STRFTIME('%y-%m-%d', "vitalperiodic"."observationtime")
0.676758