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_name_8 (date VARCHAR, venue VARCHAR)
What date was the game played at princes park?
SELECT date FROM table_name_8 WHERE venue = "princes park"
SELECT "date" FROM "table_name_8" WHERE "princes park" = "venue"
0.0625
CREATE TABLE table_57402 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Record" TEXT)
Name the score for december 5
SELECT "Score" FROM table_57402 WHERE "Date" = 'december 5'
SELECT "Score" FROM "table_57402" WHERE "Date" = 'december 5'
0.05957
CREATE TABLE table_1745843_2 (part_3 VARCHAR, part_2 VARCHAR)
For part 2 *raid, what is listed for part 3?
SELECT part_3 FROM table_1745843_2 WHERE part_2 = "*raid"
SELECT "part_3" FROM "table_1745843_2" WHERE "*raid" = "part_2"
0.061523
CREATE TABLE table_79159 ("Position" FLOAT, "Team" TEXT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Goals For" FLOAT, "Goals Against" FLOAT, "Goal Difference" TEXT, "Points 1" TEXT)
How much Drawn has Goals Against larger than 74, and a Lost smaller than 20, and a Played larger than 38?
SELECT COUNT("Drawn") FROM table_79159 WHERE "Goals Against" > '74' AND "Lost" < '20' AND "Played" > '38'
SELECT COUNT("Drawn") FROM "table_79159" WHERE "Goals Against" > '74' AND "Lost" < '20' AND "Played" > '38'
0.104492
CREATE TABLE Locations (Location_ID INT, Location_Name VARCHAR, Address VARCHAR, Other_Details VARCHAR) CREATE TABLE Tourist_Attractions (Tourist_Attraction_ID INT, Attraction_Type_Code CHAR, Location_ID INT, How_to_Get_There VARCHAR, Name VARCHAR, Description VARCHAR, Opening_Hours VARCHAR, Other_Details VARCHAR) CREATE TABLE Street_Markets (Market_ID INT, Market_Details VARCHAR) CREATE TABLE Tourist_Attraction_Features (Tourist_Attraction_ID INT, Feature_ID INT) CREATE TABLE Features (Feature_ID INT, Feature_Details VARCHAR) CREATE TABLE Visitors (Tourist_ID INT, Tourist_Details VARCHAR) CREATE TABLE Visits (Visit_ID INT, Tourist_Attraction_ID INT, Tourist_ID INT, Visit_Date DATETIME, Visit_Details VARCHAR) CREATE TABLE Hotels (hotel_id INT, star_rating_code CHAR, pets_allowed_yn CHAR, price_range FLOAT, other_hotel_details VARCHAR) CREATE TABLE Ref_Hotel_Star_Ratings (star_rating_code CHAR, star_rating_description VARCHAR) CREATE TABLE Shops (Shop_ID INT, Shop_Details VARCHAR) CREATE TABLE Museums (Museum_ID INT, Museum_Details VARCHAR) CREATE TABLE Theme_Parks (Theme_Park_ID INT, Theme_Park_Details VARCHAR) CREATE TABLE Ref_Attraction_Types (Attraction_Type_Code CHAR, Attraction_Type_Description VARCHAR) CREATE TABLE Royal_Family (Royal_Family_ID INT, Royal_Family_Details VARCHAR) CREATE TABLE Staff (Staff_ID INT, Tourist_Attraction_ID INT, Name VARCHAR, Other_Details VARCHAR) CREATE TABLE Photos (Photo_ID INT, Tourist_Attraction_ID INT, Name VARCHAR, Description VARCHAR, Filename VARCHAR, Other_Details VARCHAR)
What are the distinct visit dates, and count them by a line chart, I want to display X-axis in asc order.
SELECT Visit_Date, COUNT(Visit_Date) FROM Visits ORDER BY Visit_Date
SELECT "Visit_Date", COUNT("Visit_Date") FROM "Visits" ORDER BY "Visit_Date" NULLS FIRST
0.085938
CREATE TABLE table_name_6 (rank VARCHAR, total VARCHAR, nation VARCHAR, bronze VARCHAR, silver VARCHAR)
Which Rank has a Bronze larger than 1, and a Silver larger than 0, and a Nation of norway (host nation), and a Total larger than 16?
SELECT COUNT(rank) FROM table_name_6 WHERE bronze > 1 AND silver > 0 AND nation = "norway (host nation)" AND total > 16
SELECT COUNT("rank") FROM "table_name_6" WHERE "bronze" > 1 AND "nation" = "norway (host nation)" AND "silver" > 0 AND "total" > 16
0.12793
CREATE TABLE table_name_65 (l2_cache VARCHAR, model_number VARCHAR)
What is the L2 cache for the core i7-2635QM?
SELECT l2_cache FROM table_name_65 WHERE model_number = "core i7-2635qm"
SELECT "l2_cache" FROM "table_name_65" WHERE "core i7-2635qm" = "model_number"
0.076172
CREATE TABLE MINOR_IN (DNO VARCHAR) CREATE TABLE DEPARTMENT (DName VARCHAR, DNO VARCHAR)
Find the name of the department that has no students minored in?
SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO
SELECT "DName" FROM "DEPARTMENT" EXCEPT SELECT "T1"."DName" FROM "DEPARTMENT" AS "T1" JOIN "MINOR_IN" AS "T2" ON "T1"."DNO" = "T2"."DNO"
0.132813
CREATE TABLE table_70783 ("Lithium" TEXT, "Sodium" TEXT, "Potassium" TEXT, "Rubidium" TEXT, "Caesium" TEXT)
what is the type of lithium when rubidium is nabr (1.9)?
SELECT "Lithium" FROM table_70783 WHERE "Rubidium" = 'nabr (1.9)'
SELECT "Lithium" FROM "table_70783" WHERE "Rubidium" = 'nabr (1.9)'
0.06543
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 admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod 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 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 procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) 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 d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
did patient 65838 have the results of the microbiological tests in 2105?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65838) AND STRFTIME('%y', microbiologyevents.charttime) = '2105'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 65838 GROUP BY "hadm_id") SELECT COUNT(*) > 0 FROM "microbiologyevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "microbiologyevents"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y', "microbiologyevents"."charttime") = '2105'
0.324219
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) 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 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_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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom 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 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 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
what is the average total cost of the hospital, which includes the laboratory macrophage test since 2 years ago?
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 = 'macrophage')) AND DATETIME(cost.chargetime) >= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY cost.hadm_id) AS t1
WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'macrophage' 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") >= DATETIME(CURRENT_TIME(), '-2 year') AND NOT "_u_1"."" IS NULL GROUP BY "cost"."hadm_id") SELECT AVG("t1"."c1") FROM "t1" AS "t1"
0.561523
CREATE TABLE table_15139 ("Name" TEXT, "Circuit" TEXT, "Date" TEXT, "Winning driver" TEXT, "Winning constructor" TEXT, "Report" TEXT)
Who was the winning driver of the Savio Circuit with the constructor Itala?
SELECT "Winning driver" FROM table_15139 WHERE "Winning constructor" = 'itala' AND "Name" = 'savio circuit'
SELECT "Winning driver" FROM "table_15139" WHERE "Name" = 'savio circuit' AND "Winning constructor" = 'itala'
0.106445
CREATE TABLE table_name_82 (investment_earnings VARCHAR, state_ VARCHAR, _federal VARCHAR)
What were the investment earnings in the year that State and Federal taxes were $8,549,565?
SELECT investment_earnings FROM table_name_82 WHERE state_ & _federal = "8,549,565"
SELECT "investment_earnings" FROM "table_name_82" WHERE "8,549,565" = "state_" & "_federal"
0.088867
CREATE TABLE table_42444 ("Round" TEXT, "Date ( weekend of ) " TEXT, "Matches" FLOAT, "Clubs" TEXT, "Prize money" TEXT)
What is the Match with a Prize of money that is 1,000,000?
SELECT "Matches" FROM table_42444 WHERE "Prize money" = '£1,000,000'
SELECT "Matches" FROM "table_42444" WHERE "Prize money" = '£1,000,000'
0.068359
CREATE TABLE table_name_98 (position VARCHAR, competition VARCHAR)
What is the position of the commonwealth games?
SELECT position FROM table_name_98 WHERE competition = "commonwealth games"
SELECT "position" FROM "table_name_98" WHERE "commonwealth games" = "competition"
0.079102
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost 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 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 d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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)
what has been the first lab test given to patient 61751 the previous month?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT labevents.itemid FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 61751) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY labevents.charttime LIMIT 1)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 61751 GROUP BY "hadm_id") SELECT "d_labitems"."label" FROM "d_labitems" WHERE "d_labitems"."itemid" IN (SELECT "labevents"."itemid" FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."hadm_id" WHERE DATETIME("labevents"."charttime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND NOT "_u_0"."" IS NULL ORDER BY "labevents"."charttime" NULLS FIRST LIMIT 1)
0.493164
CREATE TABLE table_31346 ("Season" TEXT, "Division" TEXT, "League Apps" FLOAT, "League Goals" FLOAT, "FA Cup Apps" FLOAT, "FA Cup Goals" FLOAT, "Other Apps" FLOAT, "Other Goals" FLOAT, "Total Apps" FLOAT, "Total Goals" FLOAT)
Name the total number of division for fa cups being 9
SELECT COUNT("Division") FROM table_31346 WHERE "FA Cup Apps" = '9'
SELECT COUNT("Division") FROM "table_31346" WHERE "FA Cup Apps" = '9'
0.067383
CREATE TABLE table_name_32 (high_points VARCHAR, date VARCHAR)
Can you tell me the High points that has the Date of january 31?
SELECT high_points FROM table_name_32 WHERE date = "january 31"
SELECT "high_points" FROM "table_name_32" WHERE "date" = "january 31"
0.067383
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
how much did it cost for patient 035-14278 hospital stay until 2104?
SELECT SUM(cost.cost) FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-14278') AND STRFTIME('%y', cost.chargetime) <= '2104'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '035-14278' GROUP BY "patienthealthsystemstayid") SELECT SUM("cost"."cost") FROM "cost" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "cost"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y', "cost"."chargetime") <= '2104'
0.339844
CREATE TABLE technician (technician_id DECIMAL, name TEXT, team TEXT, starting_year DECIMAL, age DECIMAL) CREATE TABLE repair (repair_id DECIMAL, name TEXT, launch_date TEXT, notes TEXT) CREATE TABLE machine (machine_id DECIMAL, making_year DECIMAL, class TEXT, team TEXT, machine_series TEXT, value_points DECIMAL, quality_rank DECIMAL) CREATE TABLE repair_assignment (technician_id DECIMAL, repair_id DECIMAL, machine_id DECIMAL)
What are the names of the technicians and how many machines are they assigned to repair?
SELECT T2.name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_id = T2.technician_id GROUP BY T2.name
SELECT "T2"."name", COUNT(*) FROM "repair_assignment" AS "T1" JOIN "technician" AS "T2" ON "T1"."technician_id" = "T2"."technician_id" GROUP BY "T2"."name"
0.151367
CREATE TABLE table_name_19 (song VARCHAR, artist VARCHAR)
What Song is by the Artist 'mor ve tesi'?
SELECT song FROM table_name_19 WHERE artist = "mor ve ötesi"
SELECT "song" FROM "table_name_19" WHERE "artist" = "mor ve ötesi"
0.064453
CREATE TABLE table_9581 ("Year" FLOAT, "Lijsttrekker" TEXT, "Fractievoorzitter" TEXT, "Cabinet" TEXT, "Chair" TEXT)
What is Lijsttrekker, when Year is after 1990, and when Chair is 'Ingrid Van Engelshoven'?
SELECT "Lijsttrekker" FROM table_9581 WHERE "Year" > '1990' AND "Chair" = 'ingrid van engelshoven'
SELECT "Lijsttrekker" FROM "table_9581" WHERE "Chair" = 'ingrid van engelshoven' AND "Year" > '1990'
0.097656
CREATE TABLE table_10797636_1 (percent_of_slovenes_1951 VARCHAR, village__german_ VARCHAR)
What was the percent of slovenes 1951 for bach?
SELECT percent_of_slovenes_1951 FROM table_10797636_1 WHERE village__german_ = "Bach"
SELECT "percent_of_slovenes_1951" FROM "table_10797636_1" WHERE "Bach" = "village__german_"
0.088867
CREATE TABLE table_name_68 (longitude VARCHAR, township VARCHAR, geo_id VARCHAR)
What is the total longitude of Nogosek and a GEO ID larger than 3809357060?
SELECT COUNT(longitude) FROM table_name_68 WHERE township = "nogosek" AND geo_id > 3809357060
SELECT COUNT("longitude") FROM "table_name_68" WHERE "geo_id" > 3809357060 AND "nogosek" = "township"
0.098633
CREATE TABLE grapes (id DECIMAL, grape TEXT, color TEXT) CREATE TABLE wine (no DECIMAL, grape TEXT, winery TEXT, appelation TEXT, state TEXT, name TEXT, year DECIMAL, price DECIMAL, score DECIMAL, cases DECIMAL, drink TEXT) CREATE TABLE appellations (no DECIMAL, appelation TEXT, county TEXT, state TEXT, area TEXT, isava TEXT)
What are the maximum price and score of wines in each year?
SELECT MAX(price), MAX(score), year FROM wine GROUP BY year
SELECT MAX("price"), MAX("score"), "year" FROM "wine" GROUP BY "year"
0.067383
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskStates (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 PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE CloseReasonTypes (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 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) 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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
Possibly broken 'links' to answers.
SELECT DISTINCT (p.Id) AS "post_link" FROM Posts AS a INNER JOIN Posts AS p ON a.ParentId = p.ParentId AND a.Id != p.Id WHERE a.PostTypeId = 2 AND a.OwnerUserId IS NULL AND (p.Body LIKE '%s advice%' OR p.Body LIKE '%s answer%' OR p.Body LIKE '%s idea%' OR p.Body LIKE '%s response%')
SELECT DISTINCT "p"."Id" AS "post_link" FROM "Posts" AS "a" JOIN "Posts" AS "p" ON "a"."Id" <> "p"."Id" AND "a"."ParentId" = "p"."ParentId" AND ("p"."Body" LIKE '%s advice%' OR "p"."Body" LIKE '%s answer%' OR "p"."Body" LIKE '%s idea%' OR "p"."Body" LIKE '%s response%') WHERE "a"."OwnerUserId" IS NULL AND "a"."PostTypeId" = 2
0.319336
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
count the number of patients whose days of hospital stay is greater than 4?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.days_stay > "4"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "4" < "demographic"."days_stay"
0.103516
CREATE TABLE table_name_69 (name VARCHAR, round VARCHAR, position VARCHAR)
What is the name of the ot position player with a round greater than 4?
SELECT name FROM table_name_69 WHERE round > 4 AND position = "ot"
SELECT "name" FROM "table_name_69" WHERE "ot" = "position" AND "round" > 4
0.072266
CREATE TABLE table_11864 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
Which team has an away team score of 9.11 (65)?
SELECT "Away team" FROM table_11864 WHERE "Away team score" = '9.11 (65)'
SELECT "Away team" FROM "table_11864" WHERE "Away team score" = '9.11 (65)'
0.073242
CREATE TABLE weather (zip_code VARCHAR, mean_sea_level_pressure_inches INT)
What is the zip code in which the average mean sea level pressure is the lowest?
SELECT zip_code FROM weather GROUP BY zip_code ORDER BY AVG(mean_sea_level_pressure_inches) LIMIT 1
SELECT "zip_code" FROM "weather" GROUP BY "zip_code" ORDER BY AVG("mean_sea_level_pressure_inches") NULLS FIRST LIMIT 1
0.116211
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 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 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 PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) 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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) 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 ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseReasonTypes (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)
Show the number of posts posted by users with <50 rep at least n weeks ago.
SELECT COUNT(*) FROM Posts AS p INNER JOIN Users AS u ON p.OwnerUserId = u.Id WHERE p.PostTypeId = 1 AND u.Reputation <= 50 AND p.CreationDate < @threshold
SELECT COUNT(*) FROM "Posts" AS "p" JOIN "Users" AS "u" ON "p"."OwnerUserId" = "u"."Id" AND "u"."Reputation" <= 50 WHERE "p"."CreationDate" < $threshold AND "p"."PostTypeId" = 1
0.172852
CREATE TABLE table_1140116_5 (race_name VARCHAR, circuit VARCHAR)
What is the race name in the Monza circuit?
SELECT race_name FROM table_1140116_5 WHERE circuit = "Monza"
SELECT "race_name" FROM "table_1140116_5" WHERE "Monza" = "circuit"
0.06543
CREATE TABLE table_22280 ("Round" TEXT, "Clubs remaining" FLOAT, "Clubs involved" FLOAT, "Winners from previous round" TEXT, "New entries this round" TEXT, "Leagues entering at this round" TEXT)
What is the round where winners from the previous round totals 8?
SELECT "Round" FROM table_22280 WHERE "Winners from previous round" = '8'
SELECT "Round" FROM "table_22280" WHERE "Winners from previous round" = '8'
0.073242
CREATE TABLE Reservations (Code INT, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate FLOAT, LastName TEXT, FirstName TEXT, Adults INT, Kids INT) CREATE TABLE Rooms (RoomId TEXT, roomName TEXT, beds INT, bedType TEXT, maxOccupancy INT, basePrice INT, decor TEXT)
A pie chart for what are the number of the name of rooms booked by customers whose first name has 'ROY' in part?
SELECT roomName, COUNT(roomName) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE FirstName LIKE '%ROY%' GROUP BY roomName
SELECT "roomName", COUNT("roomName") FROM "Reservations" AS "T1" JOIN "Rooms" AS "T2" ON "T1"."Room" = "T2"."RoomId" WHERE "FirstName" LIKE '%ROY%' GROUP BY "roomName"
0.163086
CREATE TABLE table_41523 ("Position" TEXT, "Jersey #" FLOAT, "Name" TEXT, "Height ( cm ) " FLOAT, "Weight ( kg ) " FLOAT, "Birthdate" TEXT, "Birthplace" TEXT, "Previous Club/Team" TEXT)
How many different Heights (cm) did Mark Fusco have, when his Jersey # was less than 16?
SELECT COUNT("Height (cm)") FROM table_41523 WHERE "Jersey #" < '16' AND "Name" = 'mark fusco'
SELECT COUNT("Height (cm)") FROM "table_41523" WHERE "Jersey #" < '16' AND "Name" = 'mark fusco'
0.09375
CREATE TABLE table_name_1 (catalog VARCHAR, region VARCHAR, label VARCHAR, date VARCHAR)
What's the catalog number for a December 11, 2007 record from columbia formatted in a that's from Canada?
SELECT catalog FROM table_name_1 WHERE label = "columbia" AND date = "december 11, 2007" AND region = "canada"
SELECT "catalog" FROM "table_name_1" WHERE "canada" = "region" AND "columbia" = "label" AND "date" = "december 11, 2007"
0.117188
CREATE TABLE table_45992 ("Team 1" TEXT, "Agg." TEXT, "Team 2" TEXT, "1st leg" TEXT, "2nd leg" TEXT)
Which Team 1 has a 2nd leg of 1 2?
SELECT "Team 1" FROM table_45992 WHERE "2nd leg" = '1–2'
SELECT "Team 1" FROM "table_45992" WHERE "2nd leg" = '1–2'
0.056641
CREATE TABLE table_name_80 (centerfold_model VARCHAR, date VARCHAR)
When Centerfold model is on 3-04?
SELECT centerfold_model FROM table_name_80 WHERE date = "3-04"
SELECT "centerfold_model" FROM "table_name_80" WHERE "3-04" = "date"
0.066406
CREATE TABLE table_24037660_2 (circuit VARCHAR, lmp_winning_team VARCHAR, gtc_winning_team VARCHAR)
How many circuits had a winning team of #1 patr n highcroft racing ang gtc winning team #81 alex job racing ?
SELECT COUNT(circuit) FROM table_24037660_2 WHERE lmp_winning_team = "#1 Patrón Highcroft Racing" AND gtc_winning_team = "#81 Alex Job Racing"
SELECT COUNT("circuit") FROM "table_24037660_2" WHERE "#1 Patrón Highcroft Racing" = "lmp_winning_team" AND "#81 Alex Job Racing" = "gtc_winning_team"
0.146484
CREATE TABLE table_train_231 ("id" INT, "hemoglobin_a1c_hba1c" FLOAT, "heart_disease" BOOLEAN, "stroke" BOOLEAN, "renal_disease" BOOLEAN, "estimated_glomerular_filtration_rate_egfr" INT, "allergy_to_milk" BOOLEAN, "NOUSE" FLOAT)
serious health problems such as heart disease or stroke
SELECT * FROM table_train_231 WHERE heart_disease = 1 OR stroke = 1
SELECT * FROM "table_train_231" WHERE "heart_disease" = 1 OR "stroke" = 1
0.071289
CREATE TABLE table_33163 ("Country" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalogue" TEXT)
What format does Japan use?
SELECT "Format" FROM table_33163 WHERE "Country" = 'japan'
SELECT "Format" FROM "table_33163" WHERE "Country" = 'japan'
0.058594
CREATE TABLE table_name_56 (crowd VARCHAR, away_team VARCHAR)
When North Melbourne played as the away team, what was the crowd numbers?
SELECT crowd FROM table_name_56 WHERE away_team = "north melbourne"
SELECT "crowd" FROM "table_name_56" WHERE "away_team" = "north melbourne"
0.071289
CREATE TABLE table_name_6 (seating VARCHAR, notes VARCHAR, introduced VARCHAR)
How many people can be seated on the aircraft that was introduced in 2008 and has notes of in service?
SELECT seating FROM table_name_6 WHERE notes = "in service" AND introduced = 2008
SELECT "seating" FROM "table_name_6" WHERE "in service" = "notes" AND "introduced" = 2008
0.086914
CREATE TABLE table_24966 ("No." FLOAT, "Season" TEXT, "Championship" FLOAT, "No. of teams" FLOAT, "Start ( reg. season ) " TEXT, "Finish ( incl. championship ) " TEXT, "Top record" TEXT, "National Champion" TEXT)
What is the year range of season 4?
SELECT "Season" FROM table_24966 WHERE "No." = '4'
SELECT "Season" FROM "table_24966" WHERE "No." = '4'
0.050781
CREATE TABLE table_203_721 (id DECIMAL, "school" TEXT, "location" TEXT, "control" TEXT, "type" TEXT, "enrollment" DECIMAL, "founded" DECIMAL)
which of the universities was founded first ?
SELECT "school" FROM table_203_721 ORDER BY "founded" LIMIT 1
SELECT "school" FROM "table_203_721" ORDER BY "founded" NULLS FIRST LIMIT 1
0.073242
CREATE TABLE Dorm (dormid INT, dorm_name VARCHAR, student_capacity INT, gender VARCHAR) CREATE TABLE Has_amenity (dormid INT, amenid INT) CREATE TABLE Dorm_amenity (amenid INT, amenity_name VARCHAR) CREATE TABLE Lives_in (stuid INT, dormid INT, room_number INT) CREATE TABLE Student (StuID INT, LName VARCHAR, Fname VARCHAR, Age INT, Sex VARCHAR, Major INT, Advisor INT, city_code VARCHAR)
Display a bar chart for how many students are from each city, and which cities have more than one cities?, and sort X-axis from high to low order.
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY city_code DESC
SELECT "city_code", COUNT(*) FROM "Student" GROUP BY "city_code" ORDER BY "city_code" DESC NULLS LAST
0.098633
CREATE TABLE table_203_695 (id DECIMAL, "draw" DECIMAL, "artist" TEXT, "song" TEXT, "points" DECIMAL, "place" TEXT)
in the irish national final for the eurovision song contest in 1990 , which artists did not receive at least 75 points ?
SELECT "artist" FROM table_203_695 WHERE "points" < 75
SELECT "artist" FROM "table_203_695" WHERE "points" < 75
0.054688
CREATE TABLE table_39508 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Game site" TEXT, "Kickoff ( ET ) " TEXT, "NFL Recap" TEXT, "Record" TEXT)
What is the kickoff time for the game that was at Ralph Wilson Stadium?
SELECT "Kickoff ( ET )" FROM table_39508 WHERE "Game site" = 'ralph wilson stadium'
SELECT "Kickoff ( ET )" FROM "table_39508" WHERE "Game site" = 'ralph wilson stadium'
0.083008
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 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 patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
what would be patient 032-32248's monthly minimum weight in 2105?
SELECT MIN(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-32248') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y', patient.unitadmittime) = '2105' GROUP BY STRFTIME('%y-%m', patient.unitadmittime)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '032-32248' GROUP BY "patienthealthsystemstayid") SELECT MIN("patient"."admissionweight") FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."admissionweight" IS NULL AND STRFTIME('%y', "patient"."unitadmittime") = '2105' GROUP BY STRFTIME('%y-%m', "patient"."unitadmittime")
0.459961
CREATE TABLE table_47456 ("Election" TEXT, "Candidate" TEXT, "Number of votes" TEXT, "Share of votes" TEXT, "Outcome of election" TEXT)
What is the outcome of the election with 43.3% share of votes?
SELECT "Outcome of election" FROM table_47456 WHERE "Share of votes" = '43.3%'
SELECT "Outcome of election" FROM "table_47456" WHERE "Share of votes" = '43.3%'
0.078125
CREATE TABLE resultsdata15 (sample_pk DECIMAL, commod TEXT, commtype TEXT, lab TEXT, pestcode TEXT, testclass TEXT, concen DECIMAL, lod DECIMAL, conunit TEXT, confmethod TEXT, confmethod2 TEXT, annotate TEXT, quantitate TEXT, mean TEXT, extract TEXT, determin TEXT) CREATE TABLE sampledata15 (sample_pk DECIMAL, state TEXT, year TEXT, month TEXT, day TEXT, site TEXT, commod TEXT, source_id TEXT, variety TEXT, origin TEXT, country TEXT, disttype TEXT, commtype TEXT, claim TEXT, quantity DECIMAL, growst TEXT, packst TEXT, distst TEXT)
what's the 4 digit collection code of sample 3763?
SELECT site FROM sampledata15 WHERE sample_pk = 3763
SELECT "site" FROM "sampledata15" WHERE "sample_pk" = 3763
0.056641
CREATE TABLE table_30073089_2 (date VARCHAR, location VARCHAR)
Name the date for s. valentino alla muta , italia
SELECT date FROM table_30073089_2 WHERE location = "S. Valentino Alla Muta , Italia"
SELECT "date" FROM "table_30073089_2" WHERE "S. Valentino Alla Muta , Italia" = "location"
0.087891
CREATE TABLE table_55392 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Record" TEXT)
What is the home team of the game on February 3?
SELECT "Home" FROM table_55392 WHERE "Date" = 'february 3'
SELECT "Home" FROM "table_55392" WHERE "Date" = 'february 3'
0.058594
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom 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 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 d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE 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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime 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)
what's the last diagnosis patient 15821 got on their first hospital visit?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15821 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) ORDER BY diagnoses_icd.charttime DESC LIMIT 1)
SELECT "d_icd_diagnoses"."short_title" FROM "d_icd_diagnoses" WHERE "d_icd_diagnoses"."icd9_code" IN (SELECT "diagnoses_icd"."icd9_code" FROM "diagnoses_icd" WHERE "diagnoses_icd"."hadm_id" IN (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 15821 AND NOT "admissions"."dischtime" IS NULL ORDER BY "admissions"."admittime" NULLS FIRST LIMIT 1) ORDER BY "diagnoses_icd"."charttime" DESC NULLS LAST LIMIT 1)
0.428711
CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT) CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT)
For those records from the products and each product's manufacturer, find name and manufacturer , and group by attribute name, and visualize them by a bar chart, and sort in descending by the X.
SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Name DESC
SELECT "T1"."Name", "T1"."Manufacturer" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T1"."Name", "T1"."Name" ORDER BY "T1"."Name" DESC NULLS LAST
0.195313
CREATE TABLE table_19744915_18 (rank INT, couple VARCHAR)
When roxanne and daniel are the couple what is the highest rank?
SELECT MAX(rank) FROM table_19744915_18 WHERE couple = "Roxanne and Daniel"
SELECT MAX("rank") FROM "table_19744915_18" WHERE "Roxanne and Daniel" = "couple"
0.079102
CREATE TABLE table_65757 ("Competition" TEXT, "Played" FLOAT, "Spartak" FLOAT, "Draw" FLOAT, "Dynamo" FLOAT)
what is the least dynamo when spartak is more than 9, competition is totals and draw is more than 24?
SELECT MIN("Dynamo") FROM table_65757 WHERE "Spartak" > '9' AND "Competition" = 'totals' AND "Draw" > '24'
SELECT MIN("Dynamo") FROM "table_65757" WHERE "Competition" = 'totals' AND "Draw" > '24' AND "Spartak" > '9'
0.105469
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE 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 procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is diagnoses short title of diagnoses icd9 code 04104?
SELECT diagnoses.short_title FROM diagnoses WHERE diagnoses.icd9_code = "04104"
SELECT "diagnoses"."short_title" FROM "diagnoses" WHERE "04104" = "diagnoses"."icd9_code"
0.086914
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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
have heparin 5,000 unit/ml ever been prescribed to patient 002-76184 since 4 years ago?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-76184')) AND medication.drugname = 'heparin 5,000 unit/ml' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-4 year')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '002-76184' 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 "medication" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "medication"."patientunitstayid" WHERE "medication"."drugname" = 'heparin 5,000 unit/ml' AND DATETIME("medication"."drugstarttime") >= DATETIME(CURRENT_TIME(), '-4 year') AND NOT "_u_1"."" IS NULL
0.619141
CREATE TABLE table_46437 ("Finish" TEXT, "Race" TEXT, "Distance" TEXT, "Jockey" TEXT, "Time" TEXT, "Victory Margin ( in lengths ) " TEXT, "Runner up" TEXT, "Track" TEXT, "Surface" TEXT, "Date" TEXT)
What was the finish of the Kentucky Derby?
SELECT "Finish" FROM table_46437 WHERE "Race" = 'kentucky derby'
SELECT "Finish" FROM "table_46437" WHERE "Race" = 'kentucky derby'
0.064453
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, 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 VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE FlagTypes (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 PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange 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 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 PostTags (PostId DECIMAL, TagId 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 TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
Questions per day on Stack Exchange since 2015-07-31.
SELECT DATEADD(d, 0, DATEDIFF(d, 0, CreationDate)), COUNT(*) FROM Posts AS p INNER JOIN Users AS u ON u.Id = p.OwnerUserId WHERE p.PostTypeId = 1 AND DATEADD(d, 0, DATEDIFF(d, 0, CreationDate)) > '2015-07-31 00:00:00' GROUP BY DATEADD(d, 0, DATEDIFF(d, 0, CreationDate)) ORDER BY DATEADD(d, 0, DATEDIFF(d, 0, CreationDate))
SELECT DATEADD(DAY, 0, DATEDIFF(CREATIONDATE, CAST(0 AS DATETIME), CAST("d" AS DATETIME))), COUNT(*) FROM "Posts" AS "p" JOIN "Users" AS "u" ON "p"."OwnerUserId" = "u"."Id" WHERE "p"."PostTypeId" = 1 AND DATEADD(DAY, 0, DATEDIFF(CREATIONDATE, CAST(0 AS DATETIME), CAST("d" AS DATETIME))) > '2015-07-31 00:00:00' GROUP BY DATEADD(DAY, 0, DATEDIFF(CREATIONDATE, CAST(0 AS DATETIME), CAST("d" AS DATETIME))) ORDER BY DATEADD(DAY, 0, DATEDIFF(CREATIONDATE, CAST(0 AS DATETIME), CAST("d" AS DATETIME))) NULLS FIRST
0.49707
CREATE TABLE table_78133 ("Tallangatta DFL" TEXT, "Wins" FLOAT, "Byes" FLOAT, "Losses" FLOAT, "Draws" FLOAT, "Against" FLOAT)
What are the draws when wins are fwewer than 9 and byes fewer than 2?
SELECT COUNT("Draws") FROM table_78133 WHERE "Wins" < '9' AND "Byes" < '2'
SELECT COUNT("Draws") FROM "table_78133" WHERE "Byes" < '2' AND "Wins" < '9'
0.074219
CREATE TABLE table_name_70 (date_of_vacancy VARCHAR, position_in_table VARCHAR, team VARCHAR)
what is the date of vacancy when the position in table is 10th and the team is balboa?
SELECT date_of_vacancy FROM table_name_70 WHERE position_in_table = "10th" AND team = "balboa"
SELECT "date_of_vacancy" FROM "table_name_70" WHERE "10th" = "position_in_table" AND "balboa" = "team"
0.099609
CREATE TABLE table_name_68 (quantity_preserved VARCHAR, manufacturer VARCHAR, class VARCHAR)
How many did alco -schenectady preserve of class b-3?
SELECT quantity_preserved FROM table_name_68 WHERE manufacturer = "alco -schenectady" AND class = "b-3"
SELECT "quantity_preserved" FROM "table_name_68" WHERE "alco -schenectady" = "manufacturer" AND "b-3" = "class"
0.108398
CREATE TABLE table_7468 ("Year" FLOAT, "Entrant" TEXT, "Chassis" TEXT, "Engine" TEXT, "Points" FLOAT)
How many points total are there later than 2003?
SELECT SUM("Points") FROM table_7468 WHERE "Year" > '2003'
SELECT SUM("Points") FROM "table_7468" WHERE "Year" > '2003'
0.058594
CREATE TABLE table_name_43 (abbr VARCHAR, name VARCHAR)
What is the abbreviation for the University of Tartu?
SELECT abbr FROM table_name_43 WHERE name = "university of tartu"
SELECT "abbr" FROM "table_name_43" WHERE "name" = "university of tartu"
0.069336
CREATE TABLE table_11959669_3 (location_attendance VARCHAR, date VARCHAR)
What was the attendance of the game November 24
SELECT location_attendance FROM table_11959669_3 WHERE date = "November 24"
SELECT "location_attendance" FROM "table_11959669_3" WHERE "November 24" = "date"
0.079102
CREATE TABLE Payments (customer_id VARCHAR, amount_paid INT)
What is the maximum total amount paid by a customer? List the customer id and amount.
SELECT customer_id, SUM(amount_paid) FROM Payments GROUP BY customer_id ORDER BY SUM(amount_paid) DESC LIMIT 1
SELECT "customer_id", SUM("amount_paid") FROM "Payments" GROUP BY "customer_id" ORDER BY SUM("amount_paid") DESC NULLS LAST LIMIT 1
0.12793
CREATE TABLE train_station (Train_ID INT, Station_ID INT) CREATE TABLE station (Station_ID INT, Name TEXT, Annual_entry_exit FLOAT, Annual_interchanges FLOAT, Total_Passengers FLOAT, Location TEXT, Main_Services TEXT, Number_of_Platforms INT) CREATE TABLE train (Train_ID INT, Name TEXT, Time TEXT, Service TEXT)
Show all locations and the total number of platforms for all train stations in each location in a pie chart.
SELECT Location, SUM(Number_of_Platforms) FROM station GROUP BY Location
SELECT "Location", SUM("Number_of_Platforms") FROM "station" GROUP BY "Location"
0.078125
CREATE TABLE table_69276 ("Date" TEXT, "Visiting Team" TEXT, "Final Score" TEXT, "Host Team" TEXT, "Stadium" TEXT)
What was the final score for the date of December 30?
SELECT "Final Score" FROM table_69276 WHERE "Date" = 'december 30'
SELECT "Final Score" FROM "table_69276" WHERE "Date" = 'december 30'
0.066406
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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)
give me the number of patients whose admission type is emergency and diagnoses long title is unspecified congenital anomaly of heart?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Unspecified congenital anomaly of heart"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Unspecified congenital anomaly of heart" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "EMERGENCY" = "demographic"."admission_type"
0.253906
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
count the number of patients whose insurance is private and procedure long title is percutaneous [endoscopic] gastrostomy [peg].
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.long_title = "Percutaneous [endoscopic] gastrostomy [PEG]"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Percutaneous [endoscopic] gastrostomy [PEG]" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "Private" = "demographic"."insurance"
0.253906
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE 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 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)
how many hours have elapsed since patient 006-172277's entry time in the icu?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '006-172277' AND patient.unitdischargetime IS NULL
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "patient"."unitadmittime")) FROM "patient" WHERE "patient"."uniquepid" = '006-172277' AND "patient"."unitdischargetime" IS NULL
0.183594
CREATE TABLE table_55885 ("Software" TEXT, "Latest stable date ( version ) " TEXT, "Cost ( USD ) " TEXT, "Open source" TEXT, "License" TEXT)
What is the free sotware with the latest stable date version of 1.1?
SELECT "Software" FROM table_55885 WHERE "Cost ( USD )" = 'free' AND "Latest stable date (version)" = '1.1'
SELECT "Software" FROM "table_55885" WHERE "Cost ( USD )" = 'free' AND "Latest stable date (version)" = '1.1'
0.106445
CREATE TABLE table_34369 ("Game" FLOAT, "November" FLOAT, "Opponent" TEXT, "Score" TEXT, "Record" TEXT)
What was the rangers' record on Game 14?
SELECT "Record" FROM table_34369 WHERE "Game" = '14'
SELECT "Record" FROM "table_34369" WHERE "Game" = '14'
0.052734
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) 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_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
how many patients have undergone aortocor bypas-2 cor art within 2 months during this year after the previous procedure of parent infus nutrit sub?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'parent infus nutrit sub') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t1 JOIN (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'aortocor bypas-2 cor art') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND DATETIME(t2.charttime) BETWEEN DATETIME(t1.charttime) AND DATETIME(t1.charttime, '+2 month')
WITH "t2" AS (SELECT "admissions"."subject_id", "procedures_icd"."charttime" FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'aortocor bypas-2 cor art' JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'parent infus nutrit sub' JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id" JOIN "t2" AS "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND "procedures_icd"."charttime" < "t2"."charttime" AND DATETIME("procedures_icd"."charttime") <= DATETIME("t2"."charttime") AND DATETIME("procedures_icd"."charttime", '+2 month') >= DATETIME("t2"."charttime") WHERE DATETIME("procedures_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
1.109375
CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) 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 (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 date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) 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 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 airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE 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 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)
show me airports near WASHINGTON
SELECT DISTINCT airport.airport_code FROM airport, airport_service, city WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'WASHINGTON'
SELECT DISTINCT "airport"."airport_code" FROM "airport" JOIN "airport_service" ON "airport"."airport_code" = "airport_service"."airport_code" JOIN "city" ON "airport_service"."city_code" = "city"."city_code" AND "city"."city_name" = 'WASHINGTON'
0.239258
CREATE TABLE Album (AlbumId INT, Title VARCHAR, ArtistId INT) CREATE TABLE Genre (GenreId INT, Name VARCHAR) CREATE TABLE Invoice (InvoiceId INT, CustomerId INT, InvoiceDate DATETIME, BillingAddress VARCHAR, BillingCity VARCHAR, BillingState VARCHAR, BillingCountry VARCHAR, BillingPostalCode VARCHAR, Total DECIMAL) CREATE TABLE Track (TrackId INT, Name VARCHAR, AlbumId INT, MediaTypeId INT, GenreId INT, Composer VARCHAR, Milliseconds INT, Bytes INT, UnitPrice DECIMAL) CREATE TABLE Employee (EmployeeId INT, LastName VARCHAR, FirstName VARCHAR, Title VARCHAR, ReportsTo INT, BirthDate DATETIME, HireDate DATETIME, Address VARCHAR, City VARCHAR, State VARCHAR, Country VARCHAR, PostalCode VARCHAR, Phone VARCHAR, Fax VARCHAR, Email VARCHAR) CREATE TABLE Artist (ArtistId INT, Name VARCHAR) CREATE TABLE MediaType (MediaTypeId INT, Name VARCHAR) CREATE TABLE InvoiceLine (InvoiceLineId INT, InvoiceId INT, TrackId INT, UnitPrice DECIMAL, Quantity INT) CREATE TABLE Playlist (PlaylistId INT, Name VARCHAR) CREATE TABLE Customer (CustomerId INT, FirstName VARCHAR, LastName VARCHAR, Company VARCHAR, Address VARCHAR, City VARCHAR, State VARCHAR, Country VARCHAR, PostalCode VARCHAR, Phone VARCHAR, Fax VARCHAR, Email VARCHAR, SupportRepId INT) CREATE TABLE PlaylistTrack (PlaylistId INT, TrackId INT)
Show me a bar chart for what are the first names and support rep ids for employees serving 10 or more customers?, display by the x-axis in descending please.
SELECT T1.FirstName, T1.SupportRepId FROM Customer AS T1 JOIN Employee AS T2 ON T1.SupportRepId = T2.EmployeeId ORDER BY T1.FirstName DESC
SELECT "T1"."FirstName", "T1"."SupportRepId" FROM "Customer" AS "T1" JOIN "Employee" AS "T2" ON "T1"."SupportRepId" = "T2"."EmployeeId" ORDER BY "T1"."FirstName" DESC NULLS LAST
0.172852
CREATE TABLE table_name_74 (notes VARCHAR, competition VARCHAR, position VARCHAR)
Which Notes have a Competition of world championships, and a Position of 2nd?
SELECT notes FROM table_name_74 WHERE competition = "world championships" AND position = "2nd"
SELECT "notes" FROM "table_name_74" WHERE "2nd" = "position" AND "competition" = "world championships"
0.099609
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
how many patients are diagnosed with icd9 code 53390 and tested for cerebrospinal fluid in lab?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "53390" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "53390" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "Cerebrospinal Fluid (CSF)" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.271484
CREATE TABLE table_65367 ("Year" FLOAT, "Competition" TEXT, "Venue" TEXT, "Position" TEXT, "Notes" TEXT)
Which year was held in beijing?
SELECT "Year" FROM table_65367 WHERE "Venue" = 'beijing'
SELECT "Year" FROM "table_65367" WHERE "Venue" = 'beijing'
0.056641
CREATE TABLE table_49743 ("Game" FLOAT, "January" FLOAT, "Opponent" TEXT, "Score" TEXT, "Record" TEXT)
What is the sum of the games before January 19 with a 27-6-6 record?
SELECT SUM("Game") FROM table_49743 WHERE "January" < '19' AND "Record" = '27-6-6'
SELECT SUM("Game") FROM "table_49743" WHERE "January" < '19' AND "Record" = '27-6-6'
0.082031
CREATE TABLE table_204_910 (id DECIMAL, "rank" DECIMAL, "name" TEXT, "nationality" TEXT, "result" DECIMAL, "notes" TEXT)
which country had the most competitors ranked in the top three in the event ?
SELECT "nationality" FROM table_204_910 WHERE id <= 3 GROUP BY "nationality" ORDER BY COUNT(*) DESC LIMIT 1
SELECT "nationality" FROM "table_204_910" WHERE "id" <= 3 GROUP BY "nationality" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1
0.119141
CREATE TABLE storm (storm_id DECIMAL, name TEXT, dates_active TEXT, max_speed DECIMAL, damage_millions_usd DECIMAL, number_deaths DECIMAL) CREATE TABLE region (region_id DECIMAL, region_code TEXT, region_name TEXT) CREATE TABLE affected_region (region_id DECIMAL, storm_id DECIMAL, number_city_affected DECIMAL)
How many storms occured in each region?
SELECT T1.region_name, COUNT(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id
SELECT "T1"."region_name", COUNT(*) FROM "region" AS "T1" JOIN "affected_region" AS "T2" ON "T1"."region_id" = "T2"."region_id" GROUP BY "T1"."region_id"
0.149414
CREATE TABLE table_name_81 (home_team VARCHAR, venue VARCHAR)
What home team plays at princes park?
SELECT home_team FROM table_name_81 WHERE venue = "princes park"
SELECT "home_team" FROM "table_name_81" WHERE "princes park" = "venue"
0.068359
CREATE TABLE table_203_69 (id DECIMAL, "representative" TEXT, "title" TEXT, "from" DECIMAL, "to" DECIMAL, "appointed by" TEXT)
how many years has does this table cover ?
SELECT MAX("to") - MIN("from") FROM table_203_69
SELECT MAX("to") - MIN("from") FROM "table_203_69"
0.048828
CREATE TABLE table_5744 ("Records" TEXT, "Pct." FLOAT, "MRC Championships" FLOAT, "Solo" FLOAT, "Co-Champions" FLOAT, "State Champions" FLOAT)
What is the average Pct value when state champions is less than 1, MRC Championships is 10, and co-champions are greater than 4?
SELECT AVG("Pct.") FROM table_5744 WHERE "State Champions" < '1' AND "MRC Championships" = '10' AND "Co-Champions" > '4'
SELECT AVG("Pct.") FROM "table_5744" WHERE "Co-Champions" > '4' AND "MRC Championships" = '10' AND "State Champions" < '1'
0.119141
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
give me the number of white-russian ethnic background patients who have base type drug prescription.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.drug_type = "BASE"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "BASE" = "prescriptions"."drug_type" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "WHITE - RUSSIAN" = "demographic"."ethnicity"
0.231445
CREATE TABLE Physician (EmployeeID INT, Name VARCHAR, Position VARCHAR, SSN INT) CREATE TABLE Room (RoomNumber INT, RoomType VARCHAR, BlockFloor INT, BlockCode INT, Unavailable BOOLEAN) CREATE TABLE Nurse (EmployeeID INT, Name VARCHAR, Position VARCHAR, Registered BOOLEAN, SSN INT) CREATE TABLE Block (BlockFloor INT, BlockCode INT) CREATE TABLE Procedures (Code INT, Name VARCHAR, Cost FLOAT) CREATE TABLE Trained_In (Physician INT, Treatment INT, CertificationDate DATETIME, CertificationExpires DATETIME) CREATE TABLE Department (DepartmentID INT, Name VARCHAR, Head INT) CREATE TABLE Stay (StayID INT, Patient INT, Room INT, StayStart DATETIME, StayEnd DATETIME) CREATE TABLE Prescribes (Physician INT, Patient INT, Medication INT, Date DATETIME, Appointment INT, Dose VARCHAR) CREATE TABLE Medication (Code INT, Name VARCHAR, Brand VARCHAR, Description VARCHAR) CREATE TABLE Affiliated_With (Physician INT, Department INT, PrimaryAffiliation BOOLEAN) CREATE TABLE Undergoes (Patient INT, Procedures INT, Stay INT, DateUndergoes DATETIME, Physician INT, AssistingNurse INT) CREATE TABLE On_Call (Nurse INT, BlockFloor INT, BlockCode INT, OnCallStart DATETIME, OnCallEnd DATETIME) CREATE TABLE Appointment (AppointmentID INT, Patient INT, PrepNurse INT, Physician INT, Start DATETIME, End DATETIME, ExaminationRoom TEXT) CREATE TABLE Patient (SSN INT, Name VARCHAR, Address VARCHAR, Phone VARCHAR, InsuranceID INT, PCP INT)
What are names of patients who made an appointment, and count them by a bar chart, and display by the X-axis in desc.
SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Patient AS T2 ON T1.Patient = T2.SSN GROUP BY Name ORDER BY Name DESC
SELECT "Name", COUNT("Name") FROM "Appointment" AS "T1" JOIN "Patient" AS "T2" ON "T1"."Patient" = "T2"."SSN" GROUP BY "Name" ORDER BY "Name" DESC NULLS LAST
0.15332
CREATE TABLE table_name_5 (opposing_team VARCHAR, status VARCHAR)
What was the opposing team for the second test?
SELECT opposing_team FROM table_name_5 WHERE status = "second test"
SELECT "opposing_team" FROM "table_name_5" WHERE "second test" = "status"
0.071289
CREATE TABLE table_17839_1 (avg_trips_per_mile__ VARCHAR, map_colour VARCHAR)
When turquoise is the map colour how many avg. trips per mile ( 1000) are there?
SELECT COUNT(avg_trips_per_mile__) AS ×1000_ FROM table_17839_1 WHERE map_colour = "Turquoise"
SELECT COUNT("avg_trips_per_mile__") AS "×1000_" FROM "table_17839_1" WHERE "Turquoise" = "map_colour"
0.099609
CREATE TABLE table_24759 ("Year" FLOAT, "Tournaments played" FLOAT, "Cuts made" FLOAT, "Wins" FLOAT, "3rds" FLOAT, "Top 10s" FLOAT, "Best finish" TEXT, "Earnings ( $ ) " TEXT, "Money list rank" FLOAT, "Scoring average" TEXT)
If the earning amount is $309,886, what is the money list ranking?
SELECT "Money list rank" FROM table_24759 WHERE "Earnings ($)" = '309,886'
SELECT "Money list rank" FROM "table_24759" WHERE "Earnings ($)" = '309,886'
0.074219
CREATE TABLE table_65674 ("Country" TEXT, "Matches" FLOAT, "Wins" FLOAT, "Wins %" TEXT, "Draws" FLOAT, "Draws %" TEXT, "Loses" FLOAT, "Loses %" TEXT, "Against" FLOAT, "For & Against Ratio" TEXT)
What is the highest number of matches for a nation with a Loses percentage of 26.67% and fewer than 90 draws?
SELECT MAX("Matches") FROM table_65674 WHERE "Loses %" = '26.67%' AND "Draws" < '90'
SELECT MAX("Matches") FROM "table_65674" WHERE "Draws" < '90' AND "Loses %" = '26.67%'
0.083984
CREATE TABLE orders (order_id DECIMAL, customer_id DECIMAL, date_order_placed TIME, order_details TEXT) CREATE TABLE customers (customer_id DECIMAL, customer_first_name TEXT, customer_middle_initial TEXT, customer_last_name TEXT, gender TEXT, email_address TEXT, login_name TEXT, login_password TEXT, phone_number TEXT, town_city TEXT, state_county_province TEXT, country TEXT) CREATE TABLE products (product_id DECIMAL, parent_product_id DECIMAL, production_type_code TEXT, unit_price DECIMAL, product_name TEXT, product_color TEXT, product_size TEXT) CREATE TABLE invoice_line_items (order_item_id DECIMAL, invoice_number DECIMAL, product_id DECIMAL, product_title TEXT, product_quantity TEXT, product_price DECIMAL, derived_product_cost DECIMAL, derived_vat_payable DECIMAL, derived_total_cost DECIMAL) CREATE TABLE invoices (invoice_number DECIMAL, order_id DECIMAL, invoice_date TIME) CREATE TABLE accounts (account_id DECIMAL, customer_id DECIMAL, date_account_opened TIME, account_name TEXT, other_account_details TEXT) CREATE TABLE order_items (order_item_id DECIMAL, order_id DECIMAL, product_id DECIMAL, product_quantity TEXT, other_order_item_details TEXT) CREATE TABLE financial_transactions (transaction_id DECIMAL, account_id DECIMAL, invoice_number DECIMAL, transaction_type TEXT, transaction_date TIME, transaction_amount DECIMAL, transaction_comment TEXT, other_transaction_details TEXT) CREATE TABLE product_categories (production_type_code TEXT, product_type_description TEXT, vat_rating DECIMAL)
What are the ids for transactions that have an amount greater than the average amount of a transaction?
SELECT transaction_id FROM financial_transactions WHERE transaction_amount > (SELECT AVG(transaction_amount) FROM financial_transactions)
SELECT "transaction_id" FROM "financial_transactions" WHERE "transaction_amount" > (SELECT AVG("transaction_amount") FROM "financial_transactions")
0.143555
CREATE TABLE table_204_212 (id DECIMAL, "wager" TEXT, "winner" TEXT, "loser" TEXT, "location" TEXT, "date" TEXT, "notes" TEXT)
what is the only wager that is not hair ?
SELECT "wager" FROM table_204_212 WHERE "wager" <> 'hair'
SELECT "wager" FROM "table_204_212" WHERE "wager" <> 'hair'
0.057617
CREATE TABLE table_name_77 (pages INT, isbn VARCHAR)
I want the average pages for ISBN of 978-0-9766580-5-4
SELECT AVG(pages) FROM table_name_77 WHERE isbn = "978-0-9766580-5-4"
SELECT AVG("pages") FROM "table_name_77" WHERE "978-0-9766580-5-4" = "isbn"
0.073242
CREATE TABLE department (Department_ID INT, Name TEXT, Creation TEXT, Ranking INT, Budget_in_Billions FLOAT, Num_Employees FLOAT) CREATE TABLE head (head_ID INT, name TEXT, born_state TEXT, age FLOAT) CREATE TABLE management (department_ID INT, head_ID INT, temporary_acting TEXT)
Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes' Visualize by bar chart, list from high to low by the Y.
SELECT Name, AVG(Num_Employees) FROM department AS T1 JOIN management AS T2 ON T1.department_ID = T2.department_ID WHERE T2.temporary_acting = 'Yes' GROUP BY Name ORDER BY AVG(Num_Employees) DESC
SELECT "Name", AVG("Num_Employees") FROM "department" AS "T1" JOIN "management" AS "T2" ON "T1"."department_ID" = "T2"."department_ID" AND "T2"."temporary_acting" = 'Yes' GROUP BY "Name" ORDER BY AVG("Num_Employees") DESC NULLS LAST
0.226563
CREATE TABLE table_56848 ("Rd #" FLOAT, "Pick #" FLOAT, "Player" TEXT, "Team ( League ) " TEXT, "Reg GP" FLOAT, "Pl GP" FLOAT)
Tell me the highest PI GP with pick # greater than 159 and reg GP more than 0
SELECT MAX("Pl GP") FROM table_56848 WHERE "Pick #" > '159' AND "Reg GP" > '0'
SELECT MAX("Pl GP") FROM "table_56848" WHERE "Pick #" > '159' AND "Reg GP" > '0'
0.078125
CREATE TABLE table_31080 ("Year" FLOAT, "Number of tropical storms" FLOAT, "Number of hurricanes" FLOAT, "Number of major hurricanes" FLOAT, "Deaths" TEXT, "Strongest storm" TEXT)
How many years saw 3 hurricanes wherein the strongest storm was level three?
SELECT COUNT("Year") FROM table_31080 WHERE "Number of hurricanes" = '3' AND "Strongest storm" = 'Three'
SELECT COUNT("Year") FROM "table_31080" WHERE "Number of hurricanes" = '3' AND "Strongest storm" = 'Three'
0.103516
CREATE TABLE table_29901 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
How many times was the high assists andre miller (7)?
SELECT COUNT("Date") FROM table_29901 WHERE "High assists" = 'Andre Miller (7)'
SELECT COUNT("Date") FROM "table_29901" WHERE "High assists" = 'Andre Miller (7)'
0.079102