schema stringlengths 29 5.42k | question stringlengths 0 752 | rejected stringlengths 2 4.44k | chosen stringlengths 4 8.94k | weight float64 0 8.73 |
|---|---|---|---|---|
CREATE TABLE table_35502 ("Date" CLOB, "Home Team" CLOB, "Score" CLOB, "Away Team" CLOB, "Venue" CLOB)
| Who was the home team on September 20, 1998 at Spartan Stadium? | SELECT "Home Team" FROM table_35502 WHERE "Venue" = 'spartan stadium' AND "Date" = 'september 20, 1998' | SELECT "Home Team" FROM "table_35502" WHERE "Date" = 'september 20, 1998' AND "Venue" = 'spartan stadium' | 0.102539 |
CREATE TABLE table_200_35 (id NUMBER, "party" CLOB, "active voters" NUMBER, "inactive voters" NUMBER, "total voters" NUMBER, "percentage" CLOB)
| as of october 25 , 2005 , what percentage of voters were unaffiliated ? | SELECT "percentage" FROM table_200_35 WHERE "party" = 'unaffiliated' | SELECT "percentage" FROM "table_200_35" WHERE "party" = 'unaffiliated' | 0.068359 |
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB)
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
CREATE TABLE demographic (subject_i... | what is minimum age of patients whose marital status is married and insurance is medicaid? | SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.insurance = "Medicaid" | SELECT MIN("demographic"."age") FROM "demographic" WHERE "MARRIED" = "demographic"."marital_status" AND "Medicaid" = "demographic"."insurance" | 0.138672 |
CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME)
CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME)
CREATE TABLE allergy (allergyid NUMBER, ... | until 2103, what are the top three most frequent diagnoses patients were given during the same month after receiving mannitol - bolus .25-.5 gms/kg? | SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'mannitol - bolus .25-.5 gms/kg' AND STRF... | WITH "t2" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosisname", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE STRFTIME('%y', "diagnosis"."diagnosistime") <= '2103'), "t3" AS (SELECT "t2"."diagnosisname", DENSE_RANK() OVER (O... | 0.875 |
CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME)
CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, c... | since 907 days ago, when was the first time that patient 006-202432 had the maximum respiration? | SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-202432')) AND NOT vitalperiodic.respiration IS ... | WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-202432' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS... | 0.739258 |
CREATE TABLE student (stuid NUMBER, lname CLOB, fname CLOB, age NUMBER, sex CLOB, major NUMBER, advisor NUMBER, city_code CLOB)
CREATE TABLE club (clubid NUMBER, clubname CLOB, clubdesc CLOB, clublocation CLOB)
CREATE TABLE member_of_club (stuid NUMBER, clubid NUMBER, position CLOB)
| How many members does the club 'Tennis Club' has? | SELECT COUNT(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Tennis Club" | SELECT COUNT(*) FROM "club" "t1" JOIN "member_of_club" "t2" ON "t1"."clubid" = "t2"."clubid" JOIN "student" "t3" ON "t2"."stuid" = "t3"."stuid" WHERE "Tennis Club" = "t1"."clubname" | 0.176758 |
CREATE TABLE table_name_34 (school_club_team VARCHAR2, player VARCHAR2)
| What school did Paul Dawkins play for? | SELECT school_club_team FROM table_name_34 WHERE player = "paul dawkins" | SELECT "school_club_team" FROM "table_name_34" WHERE "paul dawkins" = "player" | 0.076172 |
CREATE TABLE membership_register_branch (member_id NUMBER, branch_id CLOB, register_year CLOB)
CREATE TABLE branch (branch_id NUMBER, name CLOB, open_year CLOB, address_road CLOB, city CLOB, membership_amount CLOB)
CREATE TABLE purchase (member_id NUMBER, branch_id CLOB, year CLOB, total_pounds NUMBER)
CREATE TABLE mem... | What is the name and open year for the branch with most number of memberships registered in 2016? | SELECT T2.name, T2.open_year FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year = 2016 GROUP BY T2.branch_id ORDER BY COUNT(*) DESC LIMIT 1 | SELECT "T2"."name", "T2"."open_year" FROM "membership_register_branch" "T1" JOIN "branch" "T2" ON "T1"."branch_id" = "T2"."branch_id" WHERE "T1"."register_year" = 2016 GROUP BY "T2"."branch_id" ORDER BY COUNT(*) DESC FETCH FIRST 1 ROWS ONLY | 0.234375 |
CREATE TABLE table_name_61 (format VARCHAR2, catalog VARCHAR2)
| What shows as the format for catalog 11 135? | SELECT format FROM table_name_61 WHERE catalog = "11 135" | SELECT "format" FROM "table_name_61" WHERE "11 135" = "catalog" | 0.061523 |
CREATE TABLE table_name_88 (length VARCHAR2, track VARCHAR2)
| What is the lengtho f track 16? | SELECT length FROM table_name_88 WHERE track = "16" | SELECT "length" FROM "table_name_88" WHERE "16" = "track" | 0.055664 |
CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport ... | what flights from HOUSTON to MILWAUKEE on friday in the evening on AA | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MILWAUKEE' AND date_day.day_number = 25 AND date_day.month_number = 6 A... | SELECT DISTINCT "flight"."flight_id" FROM "airport_service" "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 25 AND "date_day"."month_number" = 6 AND "date_day"."year" = 1991 JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'HOUSTON' JOIN "days" O... | 0.803711 |
CREATE TABLE table_40664 ("Player" CLOB, "Club" CLOB, "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 patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdis... | how many hours have elapsed since the last procedure patient 012-20116 had on the current hospital visit? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-20116... | WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '012-20116' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."pati... | 0.657227 |
CREATE TABLE table_name_4 (visitor VARCHAR2, decision VARCHAR2, record VARCHAR2)
| 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 NUMBER, "pick #" NUMBER, "cfl team" CLOB, "player" CLOB, "position" CLOB, "college" CLOB)
| 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 FETCH FIRST 1 ROWS ONLY | 0.092773 |
CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME)
CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, Creati... | React vs Angular popularity over time. | SELECT YEAR(p.CreationDate), TagName, COUNT(1) FROM Posts AS p, PostTags AS pt, Tags AS t WHERE p.Id = pt.PostId AND pt.TagId = t.Id AND TagName IN ('angularjs', 'reactjs', 'vue.js', 'react.js', 'AngularJs', 'Aurelia', 'knockout.js', 'ember.js', 'backbone.js', 'Jqueryjs') AND p.CreationDate > '2010-01-01' AND p.Creatio... | SELECT YEAR("p"."CreationDate"), "TagName", COUNT(1) FROM "Posts" "p" JOIN "PostTags" "pt" ON "p"."Id" = "pt"."PostId" JOIN "Tags" "t" ON "pt"."TagId" = "t"."Id" WHERE "TagName" IN ('angularjs', 'reactjs', 'vue.js', 'react.js', 'AngularJs', 'Aurelia', 'knockout.js', 'ember.js', 'backbone.js', 'Jqueryjs') AND "p"."Creat... | 0.426758 |
CREATE TABLE table_name_54 (finish VARCHAR2, total VARCHAR2, year_s__won VARCHAR2)
| What finish has a total of more than 289 and won in 1979? | SELECT finish FROM table_name_54 WHERE total > 289 AND year_s__won = "1979" | SELECT "finish" FROM "table_name_54" WHERE "1979" = "year_s__won" AND "total" > 289 | 0.081055 |
CREATE TABLE table_24175 ("Episode" CLOB, "Broadcast date" CLOB, "Run time" CLOB, "Viewers ( in millions ) " CLOB, "Archive" CLOB)
| Name the episode for run time of 22:50 | SELECT "Episode" FROM table_24175 WHERE "Run time" = '22:50' | SELECT "Episode" FROM "table_24175" WHERE "Run time" = '22:50' | 0.060547 |
CREATE TABLE table_203_349 (id NUMBER, "no. in\ series" NUMBER, "no. in\ season" NUMBER, "title" CLOB, "directed by" CLOB, "written by" CLOB, "original air date" CLOB, "production\ code" CLOB, "u.s. viewers\ ( millions ) " NUMBER)
| which episode had a higher number of viewers , identity or dead drop ? | SELECT "title" FROM table_203_349 WHERE "title" IN ('"identity"', '"dead drop"') ORDER BY "u.s. viewers\n(millions)" DESC LIMIT 1 | SELECT "title" FROM "table_203_349" WHERE "title" IN ('"identity"', '"dead drop"') ORDER BY "u.s. viewers\n(millions)" DESC FETCH FIRST 1 ROWS ONLY | 0.143555 |
CREATE TABLE table_name_98 (club_team VARCHAR2, nationality VARCHAR2, overall VARCHAR2)
| What club team is the United States player with an overall pick smaller than 142 from? | SELECT club_team FROM table_name_98 WHERE nationality = "united states" AND overall < 142 | SELECT "club_team" FROM "table_name_98" WHERE "nationality" = "united states" AND "overall" < 142 | 0.094727 |
CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER)
CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME)
CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, i... | calculate the number of patients who have received a laboratory test for neutrophils since 1 year ago. | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'neutrophils') AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-1 year')) | WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'neutrophils' GROUP BY "itemid"), "_u_1" AS (SELECT "labevents"."hadm_id" FROM "labevents" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "labevents"."itemid" WHERE DATETIME("labevents"."charttime") >= DATETIME(CURRENT_TIME(), '-1 year'... | 0.511719 |
CREATE TABLE table_204_322 (id NUMBER, "township" CLOB, "fips" NUMBER, "population" NUMBER, "population\ density\ /km2 ( /sq mi ) " CLOB, "land area\ km2 ( sq mi ) " CLOB, "water area\ km2 ( sq mi ) " CLOB, "water %" CLOB, "geographic coordinates" CLOB)
| 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 FETCH FIRST 1 ROWS ONLY | 0.086914 |
CREATE TABLE table_53737 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
| What was the away team's score when the home team scored 11.9 (75)? | SELECT "Away team score" FROM table_53737 WHERE "Home team score" = '11.9 (75)' | SELECT "Away team score" FROM "table_53737" WHERE "Home team score" = '11.9 (75)' | 0.079102 |
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CL... | what is date of birth and admission type of subject id 16438? | SELECT demographic.dob, demographic.admission_type FROM demographic WHERE demographic.subject_id = "16438" | SELECT "demographic"."dob", "demographic"."admission_type" FROM "demographic" WHERE "16438" = "demographic"."subject_id" | 0.117188 |
CREATE TABLE table_64382 ("Rank" FLOAT, "Lane" FLOAT, "Athlete" CLOB, "Nationality" CLOB, "Time" FLOAT, "React" FLOAT)
| What is the lowest lane in the Czech Republic and a time larger than 21.05? | SELECT MIN("Lane") FROM table_64382 WHERE "Nationality" = 'czech republic' AND "Time" > '21.05' | SELECT MIN("Lane") FROM "table_64382" WHERE "Nationality" = 'czech republic' AND "Time" > '21.05' | 0.094727 |
CREATE TABLE table_16636 ("Rd." FLOAT, "Grand Prix" CLOB, "Pole Position" CLOB, "Fastest Lap" CLOB, "Winning Driver" CLOB, "Constructor" CLOB, "Report" CLOB)
| Who is in the pole position for the French Grand Prix? | SELECT "Pole Position" FROM table_16636 WHERE "Grand Prix" = 'French Grand Prix' | SELECT "Pole Position" FROM "table_16636" WHERE "Grand Prix" = 'French Grand Prix' | 0.080078 |
CREATE TABLE basketball_match (Team_ID NUMBER, School_ID NUMBER, Team_Name CLOB, ACC_Regular_Season CLOB, ACC_Percent CLOB, ACC_Home CLOB, ACC_Road CLOB, All_Games CLOB, All_Games_Percent NUMBER, All_Home CLOB, All_Road CLOB, All_Neutral CLOB)
CREATE TABLE university (School_ID NUMBER, School CLOB, Location CLOB, Found... | Draw a bar chart about the distribution of ACC_Road and the average of Team_ID , and group by attribute ACC_Road, and I want to sort in desc by the Y-axis. | SELECT ACC_Road, AVG(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY AVG(Team_ID) DESC | SELECT "ACC_Road", AVG("Team_ID") FROM "basketball_match" GROUP BY "ACC_Road" ORDER BY AVG("Team_ID") DESC | 0.103516 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.