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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime 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) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE 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 lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
what was the daily maximum amount of enteral novasource renal in patient 005-68848's body on their first hospital encounter?
SELECT MAX(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-68848' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) AND intakeoutput.celllabel = 'enteral novasource renal' AND intakeoutput.cellpath LIKE '%intake%' GROUP BY STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime)
SELECT MAX("intakeoutput"."cellvaluenumeric") FROM "intakeoutput" WHERE "intakeoutput"."celllabel" = 'enteral novasource renal' AND "intakeoutput"."cellpath" LIKE '%intake%' AND "intakeoutput"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."patienthealthsystemstayid" IN (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '005-68848' AND NOT "patient"."hospitaldischargetime" IS NULL ORDER BY "patient"."hospitaladmittime" NULLS FIRST LIMIT 1)) GROUP BY STRFTIME('%y-%m-%d', "intakeoutput"."intakeoutputtime")
0.580078
CREATE TABLE table_name_13 (average INT, wickets VARCHAR, matches VARCHAR)
What is the average of someone with more than 19 wickets and less than 16 matches?
SELECT AVG(average) FROM table_name_13 WHERE wickets > 19 AND matches < 16
SELECT AVG("average") FROM "table_name_13" WHERE "matches" < 16 AND "wickets" > 19
0.080078
CREATE TABLE table_name_96 (to_par VARCHAR, place VARCHAR, player VARCHAR)
What was Nolan Henke's To par when he placed in t3?
SELECT to_par FROM table_name_96 WHERE place = "t3" AND player = "nolan henke"
SELECT "to_par" FROM "table_name_96" WHERE "nolan henke" = "player" AND "place" = "t3"
0.083984
CREATE TABLE table_name_66 (pick__number VARCHAR, position VARCHAR, round VARCHAR)
What are the total number of picks for a guard with fewer than 6 rounds?
SELECT COUNT(pick__number) FROM table_name_66 WHERE position = "guard" AND round < 6
SELECT COUNT("pick__number") FROM "table_name_66" WHERE "guard" = "position" AND "round" < 6
0.089844
CREATE TABLE table_name_6 (model VARCHAR, number_of_cpus VARCHAR, performance__mips_ VARCHAR)
Which Model has a Number of CPUs of 1 10, and a Performance (MIPS) of 49 447?
SELECT model FROM table_name_6 WHERE number_of_cpus = "1–10" AND performance__mips_ = "49–447"
SELECT "model" FROM "table_name_6" WHERE "1–10" = "number_of_cpus" AND "49–447" = "performance__mips_"
0.099609
CREATE TABLE table_65331 ("Vessel" TEXT, "Origin" TEXT, "Type" TEXT, "In service" FLOAT, "Unit" TEXT)
For the vessel with a listed In service of 1, what is the origin given?
SELECT "Origin" FROM table_65331 WHERE "In service" = '1'
SELECT "Origin" FROM "table_65331" WHERE "In service" = '1'
0.057617
CREATE TABLE table_5887 ("Year" FLOAT, "Men's singles" TEXT, "Women's singles" TEXT, "Men's doubles" TEXT, "Women's doubles" TEXT, "Mixed doubles" TEXT)
Men's singles of kilian pfister, and a Women's doubles of astrid eidenbenz claudia jehle has what average year?
SELECT AVG("Year") FROM table_5887 WHERE "Men's singles" = 'kilian pfister' AND "Women's doubles" = 'astrid eidenbenz claudia jehle'
SELECT AVG("Year") FROM "table_5887" WHERE "Men's singles" = 'kilian pfister' AND "Women's doubles" = 'astrid eidenbenz claudia jehle'
0.130859
CREATE TABLE table_33977 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Attendance" FLOAT, "Record" TEXT, "Points" FLOAT)
For the game with 6,126 in attendance, how many points did both teams have in the standings?
SELECT COUNT("Points") FROM table_33977 WHERE "Attendance" = '6,126'
SELECT COUNT("Points") FROM "table_33977" WHERE "Attendance" = '6,126'
0.068359
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE 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 procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
what is the prescription drug patient 808 has been prescribed two times this month?
SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 808) AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 = 2
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 808 GROUP BY "hadm_id"), "t1" AS (SELECT "prescriptions"."drug", COUNT("prescriptions"."startdate") AS "c1" FROM "prescriptions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE DATETIME("prescriptions"."startdate", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND NOT "_u_0"."" IS NULL GROUP BY "prescriptions"."drug") SELECT "t1"."drug" FROM "t1" AS "t1" WHERE "t1"."c1" = 2
0.516602
CREATE TABLE table_name_56 (planet VARCHAR, radial_velocity__m_s_ INT)
What type of planet has a radial velocity of 45.2 m/s?
SELECT planet AS Type FROM table_name_56 WHERE radial_velocity__m_s_ > 45.2
SELECT "planet" AS "Type" FROM "table_name_56" WHERE "radial_velocity__m_s_" > 45.2
0.081055
CREATE TABLE Roles (Role_Code CHAR, Role_Name VARCHAR, Role_Description VARCHAR) CREATE TABLE All_Documents (Document_ID INT, Date_Stored DATETIME, Document_Type_Code CHAR, Document_Name CHAR, Document_Description CHAR, Other_Details VARCHAR) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR, Document_Type_Description VARCHAR) CREATE TABLE Employees (Employee_ID INT, Role_Code CHAR, Employee_Name VARCHAR, Gender_MFU CHAR, Date_of_Birth DATETIME, Other_Details VARCHAR) CREATE TABLE Document_Locations (Document_ID INT, Location_Code CHAR, Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME) CREATE TABLE Documents_to_be_Destroyed (Document_ID INT, Destruction_Authorised_by_Employee_ID INT, Destroyed_by_Employee_ID INT, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR) CREATE TABLE Ref_Locations (Location_Code CHAR, Location_Name VARCHAR, Location_Description VARCHAR) CREATE TABLE Ref_Calendar (Calendar_Date DATETIME, Day_Number INT)
Show all calendar dates and bin by year in a line chart, and order by the x-axis in desc.
SELECT Calendar_Date, COUNT(Calendar_Date) FROM Ref_Calendar ORDER BY Calendar_Date DESC
SELECT "Calendar_Date", COUNT("Calendar_Date") FROM "Ref_Calendar" ORDER BY "Calendar_Date" DESC NULLS LAST
0.104492
CREATE TABLE table_1342379_45 (first_elected INT)
What year was someone first elected?
SELECT MIN(first_elected) FROM table_1342379_45
SELECT MIN("first_elected") FROM "table_1342379_45"
0.049805
CREATE TABLE table_name_41 (song VARCHAR, place INT)
What song placed higher than#4?
SELECT song FROM table_name_41 WHERE place > 4
SELECT "song" FROM "table_name_41" WHERE "place" > 4
0.050781
CREATE TABLE table_23614 ("Divisions" TEXT, "Prize ( EUR ) " TEXT, "Odds of winning ( 1in ) " TEXT, "Number of winning tickets" FLOAT, "In order to win" TEXT)
What are the prizes when 1 is the number of winning tickets?
SELECT "Prize (EUR)" FROM table_23614 WHERE "Number of winning tickets" = '1'
SELECT "Prize (EUR)" FROM "table_23614" WHERE "Number of winning tickets" = '1'
0.077148
CREATE TABLE table_20174050_7 (release_date VARCHAR, reader VARCHAR)
If the reader is Syal, Meera Meera Syal, what was the release date?
SELECT release_date FROM table_20174050_7 WHERE reader = "Syal, Meera Meera Syal"
SELECT "release_date" FROM "table_20174050_7" WHERE "Syal, Meera Meera Syal" = "reader"
0.084961
CREATE TABLE table_12594 ("Year" FLOAT, "Date" TEXT, "Home Team" TEXT, "Result" TEXT, "Visiting Team" TEXT, "Venue" TEXT, "Attendance" FLOAT)
What is the number in attendance at Los Angeles Memorial Coliseum?
SELECT COUNT("Attendance") FROM table_12594 WHERE "Venue" = 'los angeles memorial coliseum'
SELECT COUNT("Attendance") FROM "table_12594" WHERE "Venue" = 'los angeles memorial coliseum'
0.09082
CREATE TABLE table_name_45 (to_par VARCHAR, tournament VARCHAR)
What is the to par when the tournament involved was the Transitions Championship?
SELECT to_par FROM table_name_45 WHERE tournament = "transitions championship"
SELECT "to_par" FROM "table_name_45" WHERE "tournament" = "transitions championship"
0.082031
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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) 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 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 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 ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (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 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 Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewTaskTypes (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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description 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 PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
vba questions daily, 60 days.
SELECT DATEPART(ww, CreationDate) AS "week", COUNT(*) AS "vba_questions" FROM Posts WHERE Tags LIKE '%vba>%' AND PostTypeId = 1 AND CreationDate >= DATEADD(d, -60, GETDATE()) AND DATEPART(ww, CreationDate) < DATEPART(ww, GETDATE()) - 1 GROUP BY DATEPART(ww, CreationDate) ORDER BY DATEPART(ww, CreationDate)
SELECT DATEPART("ww", "CreationDate") AS "week", COUNT(*) AS "vba_questions" FROM "Posts" WHERE "CreationDate" >= DATEADD(DAY, -60, GETDATE()) AND "PostTypeId" = 1 AND "Tags" LIKE '%vba>%' AND DATEPART("ww", "CreationDate") < DATEPART("ww", GETDATE()) - 1 GROUP BY DATEPART("ww", "CreationDate") ORDER BY DATEPART("ww", "CreationDate") NULLS FIRST
0.338867
CREATE TABLE band (id DECIMAL, firstname TEXT, lastname TEXT) CREATE TABLE performance (songid DECIMAL, bandmate DECIMAL, stageposition TEXT) CREATE TABLE vocals (songid DECIMAL, bandmate DECIMAL, type TEXT) CREATE TABLE songs (songid DECIMAL, title TEXT) CREATE TABLE albums (aid DECIMAL, title TEXT, year DECIMAL, label TEXT, type TEXT) CREATE TABLE tracklists (albumid DECIMAL, position DECIMAL, songid DECIMAL) CREATE TABLE instruments (songid DECIMAL, bandmateid DECIMAL, instrument TEXT)
What is the last name of the artist who sang the most songs?
SELECT T2.lastname FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid GROUP BY lastname ORDER BY COUNT(*) DESC LIMIT 1
SELECT "T2"."lastname" FROM "performance" AS "T1" JOIN "band" AS "T2" ON "T1"."bandmate" = "T2"."id" JOIN "songs" AS "T3" ON "T1"."songid" = "T3"."songid" GROUP BY "lastname" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1
0.210938
CREATE TABLE Rooms (RoomId TEXT, roomName TEXT, beds INT, bedType TEXT, maxOccupancy INT, basePrice INT, decor TEXT) CREATE TABLE Reservations (Code INT, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate FLOAT, LastName TEXT, FirstName TEXT, Adults INT, Kids INT)
Show me the average of baseprice by bedtype in a histogram, and could you sort in ascending by the bars?
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType ORDER BY bedType
SELECT "bedType", AVG("basePrice") FROM "Rooms" GROUP BY "bedType" ORDER BY "bedType" NULLS FIRST
0.094727
CREATE TABLE table_20239 ("Date" TEXT, "Cover model" TEXT, "Centerfold model" TEXT, "Interview subject" TEXT, "20 Questions" TEXT, "Pictorials" TEXT)
Who were the cover model(s) on the 4-05 issue?
SELECT "Cover model" FROM table_20239 WHERE "Date" = '4-05'
SELECT "Cover model" FROM "table_20239" WHERE "Date" = '4-05'
0.05957
CREATE TABLE shop (Shop_ID INT, Address TEXT, Num_of_staff TEXT, Score FLOAT, Open_Year TEXT) CREATE TABLE happy_hour (HH_ID INT, Shop_ID INT, Month TEXT, Num_of_shaff_in_charge INT) CREATE TABLE member (Member_ID INT, Name TEXT, Membership_card TEXT, Age INT, Time_of_purchase INT, Level_of_membership INT, Address TEXT) CREATE TABLE happy_hour_member (HH_ID INT, Member_ID INT, Total_amount FLOAT)
Find the number of members living in each address. Show bar chart.
SELECT Address, COUNT(*) FROM member GROUP BY Address
SELECT "Address", COUNT(*) FROM "member" GROUP BY "Address"
0.057617
CREATE TABLE table_name_5 (score VARCHAR, lineup VARCHAR)
What is the score with the Lineup match reports?
SELECT score FROM table_name_5 WHERE lineup = "match reports"
SELECT "score" FROM "table_name_5" WHERE "lineup" = "match reports"
0.06543
CREATE TABLE staff (staff_id DECIMAL, first_name TEXT, last_name TEXT, address_id DECIMAL, picture others, email TEXT, store_id DECIMAL, active BOOLEAN, username TEXT, password TEXT, last_update TIME) CREATE TABLE category (category_id DECIMAL, name TEXT, last_update TIME) CREATE TABLE language (language_id DECIMAL, name TEXT, last_update TIME) CREATE TABLE address (address_id DECIMAL, address TEXT, address2 TEXT, district TEXT, city_id DECIMAL, postal_code TEXT, phone TEXT, last_update TIME) CREATE TABLE film_category (film_id DECIMAL, category_id DECIMAL, last_update TIME) CREATE TABLE film (film_id DECIMAL, title TEXT, description TEXT, release_year TIME, language_id DECIMAL, original_language_id DECIMAL, rental_duration DECIMAL, rental_rate DECIMAL, length DECIMAL, replacement_cost DECIMAL, rating TEXT, special_features TEXT, last_update TIME) CREATE TABLE film_text (film_id DECIMAL, title TEXT, description TEXT) CREATE TABLE rental (rental_id DECIMAL, rental_date TIME, inventory_id DECIMAL, customer_id DECIMAL, return_date TIME, staff_id DECIMAL, last_update TIME) CREATE TABLE store (store_id DECIMAL, manager_staff_id DECIMAL, address_id DECIMAL, last_update TIME) CREATE TABLE film_actor (actor_id DECIMAL, film_id DECIMAL, last_update TIME) CREATE TABLE actor (actor_id DECIMAL, first_name TEXT, last_name TEXT, last_update TIME) CREATE TABLE city (city_id DECIMAL, city TEXT, country_id DECIMAL, last_update TIME) CREATE TABLE customer (customer_id DECIMAL, store_id DECIMAL, first_name TEXT, last_name TEXT, email TEXT, address_id DECIMAL, active BOOLEAN, create_date TIME, last_update TIME) CREATE TABLE inventory (inventory_id DECIMAL, film_id DECIMAL, store_id DECIMAL, last_update TIME) CREATE TABLE payment (payment_id DECIMAL, customer_id DECIMAL, staff_id DECIMAL, rental_id DECIMAL, amount DECIMAL, payment_date TIME, last_update TIME) CREATE TABLE country (country_id DECIMAL, country TEXT, last_update TIME)
Give the full name and staff id of the staff who has handled the fewest payments.
SELECT T1.first_name, T1.last_name, T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY COUNT(*) LIMIT 1
SELECT "T1"."first_name", "T1"."last_name", "T1"."staff_id" FROM "staff" AS "T1" JOIN "payment" AS "T2" ON "T1"."staff_id" = "T2"."staff_id" GROUP BY "T1"."staff_id" ORDER BY COUNT(*) NULLS FIRST LIMIT 1
0.198242
CREATE TABLE table_2071 ("#" FLOAT, "Volume line" TEXT, "Volume title" TEXT, "Creators" TEXT, "Material collected" TEXT, "Publication date" TEXT, "ISBN" TEXT)
Name the total number for material collected for 978-1401221935
SELECT COUNT("Material collected") FROM table_2071 WHERE "ISBN" = '978-1401221935'
SELECT COUNT("Material collected") FROM "table_2071" WHERE "ISBN" = '978-1401221935'
0.082031
CREATE TABLE table_203_522 (id DECIMAL, "week" DECIMAL, "date" TEXT, "opponent" TEXT, "results\ final score" TEXT, "results\ team record" TEXT, "venue" TEXT, "attendance" DECIMAL)
which game date shows the least in the final score for a win ?
SELECT "date" FROM table_203_522 WHERE "results\nfinal score" = 'w' ORDER BY "results\nfinal score" LIMIT 1
SELECT "date" FROM "table_203_522" WHERE "results\nfinal score" = 'w' ORDER BY "results\nfinal score" NULLS FIRST LIMIT 1
0.118164
CREATE TABLE table_44173 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT)
what is the place when the score is 68-70-68=206?
SELECT "Place" FROM table_44173 WHERE "Score" = '68-70-68=206'
SELECT "Place" FROM "table_44173" WHERE "Score" = '68-70-68=206'
0.0625
CREATE TABLE table_name_50 (location VARCHAR, year VARCHAR)
What was the location in 2009?
SELECT location FROM table_name_50 WHERE year = "2009"
SELECT "location" FROM "table_name_50" WHERE "2009" = "year"
0.058594
CREATE TABLE table_24097 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Wildcats points" FLOAT, "Opponents" FLOAT, "Record" TEXT)
Who did the team play against in the game that resulted with a loss?
SELECT "Opponent" FROM table_24097 WHERE "Result" = 'Loss'
SELECT "Opponent" FROM "table_24097" WHERE "Result" = 'Loss'
0.058594
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 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 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)
what is the minimum age of patients primairly suffering from cancer/sda who were admitted in or after the year 2107?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.diagnosis = "BLADDER CANCER/SDA" AND demographic.admityear >= "2107"
SELECT MIN("demographic"."age") FROM "demographic" WHERE "2107" <= "demographic"."admityear" AND "BLADDER CANCER/SDA" = "demographic"."diagnosis"
0.141602
CREATE TABLE table_22446 ("Position" FLOAT, "Team" TEXT, "Played" FLOAT, "Wins" FLOAT, "Draws" FLOAT, "Losses" FLOAT, "Scored" FLOAT, "Conceded" FLOAT, "Points" FLOAT)
How many wins have conceded as 18?
SELECT MAX("Wins") FROM table_22446 WHERE "Conceded" = '18'
SELECT MAX("Wins") FROM "table_22446" WHERE "Conceded" = '18'
0.05957
CREATE TABLE table_74139 ("Game" FLOAT, "November" FLOAT, "Opponent" TEXT, "Score" TEXT, "Location/Attendance" TEXT, "Record" TEXT, "Points" FLOAT)
what is the record for score 1-3?
SELECT "Record" FROM table_74139 WHERE "Score" = '1-3'
SELECT "Record" FROM "table_74139" WHERE "Score" = '1-3'
0.054688
CREATE TABLE table_name_91 (team_2 VARCHAR)
What is the 1st leg when team 2 is Asil Lysi?
SELECT 1 AS st_leg FROM table_name_91 WHERE team_2 = "asil lysi"
SELECT 1 AS "st_leg" FROM "table_name_91" WHERE "asil lysi" = "team_2"
0.068359
CREATE TABLE table_14256 ("Model number" TEXT, "sSpec number" TEXT, "Cores" FLOAT, "Frequency" TEXT, "Turbo" TEXT, "L2 cache" TEXT, "L3 cache" TEXT, "GPU model" TEXT, "GPU frequency" TEXT, "Socket" TEXT, "I/O bus" TEXT, "Release date" TEXT, "Part number ( s ) " TEXT, "Release price ( USD ) " TEXT)
what is the gpu frequency when the part number is cw8064701470702?
SELECT "GPU frequency" FROM table_14256 WHERE "Part number(s)" = 'cw8064701470702'
SELECT "GPU frequency" FROM "table_14256" WHERE "Part number(s)" = 'cw8064701470702'
0.082031
CREATE TABLE table_48574 ("Position" FLOAT, "Driver / Passenger" TEXT, "Equipment" TEXT, "Bike No" FLOAT, "Points" FLOAT)
What is the highest Points, when Position is less than 4, when Equipment is Zabel - VMC, and when Bike No is less than 1?
SELECT MAX("Points") FROM table_48574 WHERE "Position" < '4' AND "Equipment" = 'zabel - vmc' AND "Bike No" < '1'
SELECT MAX("Points") FROM "table_48574" WHERE "Bike No" < '1' AND "Equipment" = 'zabel - vmc' AND "Position" < '4'
0.111328
CREATE TABLE table_name_66 (date__from_ VARCHAR, location VARCHAR)
On what date did the event at Zaltbommel begin?
SELECT date__from_ FROM table_name_66 WHERE location = "zaltbommel"
SELECT "date__from_" FROM "table_name_66" WHERE "location" = "zaltbommel"
0.071289
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 flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE 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 (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 code_description (code VARCHAR, description TEXT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name 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) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) 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 airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT)
what is the earliest flight from DENVER to SAN FRANCISCO on the morning of 8 27
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 0 AND 1200) AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, date_day AS DATE_DAYalias1, days AS DAYSalias1, flight AS FLIGHTalias1 WHERE ((CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'SAN FRANCISCO' AND DATE_DAYalias1.day_number = 27 AND DATE_DAYalias1.month_number = 8 AND DATE_DAYalias1.year = 1991 AND DAYSalias1.day_name = DATE_DAYalias1.day_name AND FLIGHTalias1.flight_days = DAYSalias1.days_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'DENVER' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code) AND FLIGHTalias1.departure_time BETWEEN 0 AND 1200)
WITH "_u_0" AS (SELECT MIN("FLIGHTalias1"."departure_time") FROM "airport_service" AS "AIRPORT_SERVICEalias2" JOIN "date_day" AS "DATE_DAYalias1" ON "DATE_DAYalias1"."day_number" = 27 AND "DATE_DAYalias1"."month_number" = 8 AND "DATE_DAYalias1"."year" = 1991 JOIN "city" AS "CITYalias2" ON "AIRPORT_SERVICEalias2"."city_code" = "CITYalias2"."city_code" AND "CITYalias2"."city_name" = 'DENVER' JOIN "days" AS "DAYSalias1" ON "DATE_DAYalias1"."day_name" = "DAYSalias1"."day_name" JOIN "flight" AS "FLIGHTalias1" ON "AIRPORT_SERVICEalias2"."airport_code" = "FLIGHTalias1"."from_airport" AND "DAYSalias1"."days_code" = "FLIGHTalias1"."flight_days" AND "FLIGHTalias1"."departure_time" <= 1200 AND "FLIGHTalias1"."departure_time" >= 0 JOIN "airport_service" AS "AIRPORT_SERVICEalias3" ON "AIRPORT_SERVICEalias3"."airport_code" = "FLIGHTalias1"."to_airport" JOIN "city" AS "CITYalias3" ON "AIRPORT_SERVICEalias3"."city_code" = "CITYalias3"."city_code" AND "CITYalias3"."city_name" = 'SAN FRANCISCO') SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 27 AND "date_day"."month_number" = 8 AND "date_day"."year" = 1991 JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'DENVER' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days" AND "flight"."departure_time" <= 1200 AND "flight"."departure_time" >= 0 JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "flight"."departure_time" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SAN FRANCISCO'
1.8125
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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE 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 intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime 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)
calculate how many times patient 009-2181 has had a bun test in the lab during the last hospital visit.
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-2181' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)) AND lab.labname = 'bun'
SELECT COUNT(*) FROM "lab" WHERE "lab"."labname" = 'bun' AND "lab"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."patienthealthsystemstayid" IN (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '009-2181' AND NOT "patient"."hospitaldischargetime" IS NULL ORDER BY "patient"."hospitaladmittime" DESC NULLS LAST LIMIT 1))
0.396484
CREATE TABLE table_name_1 (area__km_2__ VARCHAR, telephone__052_ VARCHAR)
Which area has a telephone of (052) of 3862279?
SELECT area__km_2__ FROM table_name_1 WHERE telephone__052_ = "3862279"
SELECT "area__km_2__" FROM "table_name_1" WHERE "3862279" = "telephone__052_"
0.075195
CREATE TABLE Acceptance (Submission_ID INT, Workshop_ID INT, Result TEXT) CREATE TABLE submission (Submission_ID INT, Scores FLOAT, Author TEXT, College TEXT) CREATE TABLE workshop (Workshop_ID INT, Date TEXT, Venue TEXT, Name TEXT)
Show the authors of their total submissions with a bar chart, and display x axis from high to low order.
SELECT Author, COUNT(Author) FROM submission GROUP BY Author ORDER BY Author DESC
SELECT "Author", COUNT("Author") FROM "submission" GROUP BY "Author" ORDER BY "Author" DESC NULLS LAST
0.099609
CREATE TABLE table_name_12 (round INT, time VARCHAR)
What is the lowest round number for the fight that had a time of 1:09?
SELECT MIN(round) FROM table_name_12 WHERE time = "1:09"
SELECT MIN("round") FROM "table_name_12" WHERE "1:09" = "time"
0.060547
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 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)
what is the date of birth and religion of patient no. 14755?
SELECT demographic.dob, demographic.religion FROM demographic WHERE demographic.subject_id = "14755"
SELECT "demographic"."dob", "demographic"."religion" FROM "demographic" WHERE "14755" = "demographic"."subject_id"
0.111328
CREATE TABLE table_26976615_3 (outgoing_manager VARCHAR, incoming_manager VARCHAR)
Who was the outgoing manager when the incoming manager was lauren iu reghecampf?
SELECT outgoing_manager FROM table_26976615_3 WHERE incoming_manager = "Laurenţiu Reghecampf"
SELECT "outgoing_manager" FROM "table_26976615_3" WHERE "Laurenţiu Reghecampf" = "incoming_manager"
0.09668
CREATE TABLE table_name_24 (season VARCHAR, premier_division VARCHAR, division_three VARCHAR)
Which year were both the Premier Division Ewyas Harold and Division Three Stoke Prior champions?
SELECT season FROM table_name_24 WHERE premier_division = "ewyas harold" AND division_three = "stoke prior"
SELECT "season" FROM "table_name_24" WHERE "division_three" = "stoke prior" AND "ewyas harold" = "premier_division"
0.112305
CREATE TABLE table_name_57 (score VARCHAR, home_team VARCHAR)
What was the final score for the match where Hereford United was the home team?
SELECT score FROM table_name_57 WHERE home_team = "hereford united"
SELECT "score" FROM "table_name_57" WHERE "hereford united" = "home_team"
0.071289
CREATE TABLE products (product_name VARCHAR, color_code VARCHAR) CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR)
What is the name of the product with the color description 'yellow'?
SELECT T1.product_name FROM products AS T1 JOIN ref_colors AS T2 ON T1.color_code = T2.color_code WHERE T2.color_description = 'yellow'
SELECT "T1"."product_name" FROM "products" AS "T1" JOIN "ref_colors" AS "T2" ON "T1"."color_code" = "T2"."color_code" AND "T2"."color_description" = 'yellow'
0.15332
CREATE TABLE table_name_77 (surface VARCHAR, outcome VARCHAR, date VARCHAR)
What is the Surface when Todd Woodbridge was the runner-up, and a Date of 24 february 1997?
SELECT surface FROM table_name_77 WHERE outcome = "runner-up" AND date = "24 february 1997"
SELECT "surface" FROM "table_name_77" WHERE "24 february 1997" = "date" AND "outcome" = "runner-up"
0.09668
CREATE TABLE table_name_13 (country VARCHAR, place VARCHAR, player VARCHAR)
WHAT COUNTRY HAS A T7 PLACE, WITH IAN WOOSNAM?
SELECT country FROM table_name_13 WHERE place = "t7" AND player = "ian woosnam"
SELECT "country" FROM "table_name_13" WHERE "ian woosnam" = "player" AND "place" = "t7"
0.084961
CREATE TABLE table_name_86 (position VARCHAR, team VARCHAR, college VARCHAR)
Name the position that has baltimore bullets and college of texas tech
SELECT position FROM table_name_86 WHERE team = "baltimore bullets" AND college = "texas tech"
SELECT "position" FROM "table_name_86" WHERE "baltimore bullets" = "team" AND "college" = "texas tech"
0.099609
CREATE TABLE ref_incident_type (incident_type_code TEXT, incident_type_description TEXT) CREATE TABLE teachers (teacher_id DECIMAL, address_id DECIMAL, first_name TEXT, middle_name TEXT, last_name TEXT, gender TEXT, cell_mobile_number TEXT, email_address TEXT, other_details TEXT) CREATE TABLE behavior_incident (incident_id DECIMAL, incident_type_code TEXT, student_id DECIMAL, date_incident_start TIME, date_incident_end TIME, incident_summary TEXT, recommendations TEXT, other_details TEXT) CREATE TABLE student_addresses (student_id DECIMAL, address_id DECIMAL, date_address_from TIME, date_address_to TIME, monthly_rental DECIMAL, other_details TEXT) CREATE TABLE students_in_detention (student_id DECIMAL, detention_id DECIMAL, incident_id DECIMAL) CREATE TABLE assessment_notes (notes_id DECIMAL, student_id DECIMAL, teacher_id DECIMAL, date_of_notes TIME, text_of_notes TEXT, other_details TEXT) CREATE TABLE detention (detention_id DECIMAL, detention_type_code TEXT, teacher_id DECIMAL, datetime_detention_start TIME, datetime_detention_end TIME, detention_summary TEXT, other_details TEXT) CREATE TABLE students (student_id DECIMAL, address_id DECIMAL, first_name TEXT, middle_name TEXT, last_name TEXT, cell_mobile_number TEXT, email_address TEXT, date_first_rental TIME, date_left_university TIME, other_student_details TEXT) CREATE TABLE ref_detention_type (detention_type_code TEXT, detention_type_description TEXT) CREATE TABLE ref_address_types (address_type_code TEXT, address_type_description TEXT) CREATE TABLE addresses (address_id DECIMAL, line_1 TEXT, line_2 TEXT, line_3 TEXT, city TEXT, zip_postcode TEXT, state_province_county TEXT, country TEXT, other_address_details TEXT)
Find the id and last name of the teacher that has the most detentions with detention type code 'AFTER'?
SELECT T1.teacher_id, T2.last_name FROM detention AS T1 JOIN teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T1.detention_type_code = "AFTER" GROUP BY T1.teacher_id ORDER BY COUNT(*) DESC LIMIT 1
SELECT "T1"."teacher_id", "T2"."last_name" FROM "detention" AS "T1" JOIN "teachers" AS "T2" ON "T1"."teacher_id" = "T2"."teacher_id" WHERE "AFTER" = "T1"."detention_type_code" GROUP BY "T1"."teacher_id" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1
0.238281
CREATE TABLE Customers (first_name VARCHAR, last_name VARCHAR, amount_outstanding INT)
List the first name and last name of customers have the amount of outstanding between 1000 and 3000.
SELECT first_name, last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000
SELECT "first_name", "last_name" FROM "Customers" WHERE "amount_outstanding" <= 3000 AND "amount_outstanding" >= 1000
0.114258
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE 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)
what procedure was first taken to patient 017-49375?
SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-49375')) ORDER BY treatment.treatmenttime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '017-49375' 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 "treatment"."treatmentname" FROM "treatment" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "treatment"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL ORDER BY "treatment"."treatmenttime" NULLS FIRST LIMIT 1
0.554688
CREATE TABLE table_17369472_2 (won VARCHAR, points VARCHAR)
How many were won when there were 49 points?
SELECT won FROM table_17369472_2 WHERE points = "49"
SELECT "won" FROM "table_17369472_2" WHERE "49" = "points"
0.056641
CREATE TABLE table_name_71 (score VARCHAR, date VARCHAR, record VARCHAR)
What is the Score on July 18 that has Record of 41-51?
SELECT score FROM table_name_71 WHERE date = "july 18" AND record = "41-51"
SELECT "score" FROM "table_name_71" WHERE "41-51" = "record" AND "date" = "july 18"
0.081055
CREATE TABLE table_658 ("Department" TEXT, "Acronym" TEXT, "Office" TEXT, "Incumbent" TEXT, "in Office since" TEXT)
what's the acronym with department being department of finance kagawaran ng pananalapi
SELECT "Acronym" FROM table_658 WHERE "Department" = 'Department of Finance Kagawaran ng Pananalapi'
SELECT "Acronym" FROM "table_658" WHERE "Department" = 'Department of Finance Kagawaran ng Pananalapi'
0.099609
CREATE TABLE table_name_84 (loss VARCHAR, coach VARCHAR, pts VARCHAR)
What is the number of losses that coach John Kowalski has with a PTS smaller than 9?
SELECT COUNT(loss) FROM table_name_84 WHERE coach = "john kowalski" AND pts < 9
SELECT COUNT("loss") FROM "table_name_84" WHERE "coach" = "john kowalski" AND "pts" < 9
0.084961
CREATE TABLE table_66476 ("City of license" TEXT, "Identifier" TEXT, "Frequency" TEXT, "Power" TEXT, "Class" TEXT, "RECNet" TEXT)
What power has thunder bay as the city of license?
SELECT "Power" FROM table_66476 WHERE "City of license" = 'thunder bay'
SELECT "Power" FROM "table_66476" WHERE "City of license" = 'thunder bay'
0.071289
CREATE TABLE table_74169 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
Name the location attendance april 5
SELECT "Location Attendance" FROM table_74169 WHERE "Date" = 'April 5'
SELECT "Location Attendance" FROM "table_74169" WHERE "Date" = 'April 5'
0.070313
CREATE TABLE table_204_60 (id DECIMAL, "sl no" DECIMAL, "constituency\ name" TEXT, "constituency\ number" DECIMAL, "member of legislative assembly" TEXT, "political party" TEXT)
which constituencies have only one representative ?
SELECT "constituency\nname" FROM table_204_60 WHERE "constituency\nnumber" = 1
SELECT "constituency\nname" FROM "table_204_60" WHERE "constituency\nnumber" = 1
0.078125
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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
tell me what the total output the previous day is for patient 006-2586.
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586')) AND intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-2586' 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 SUM("intakeoutput"."cellvaluenumeric") FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."cellpath" LIKE '%output%' AND DATETIME("intakeoutput"."intakeoutputtime", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day') AND NOT "_u_1"."" IS NULL
0.673828
CREATE TABLE postseason (year INT, round TEXT, team_id_winner TEXT, league_id_winner TEXT, team_id_loser TEXT, league_id_loser TEXT, wins INT, losses INT, ties INT) CREATE TABLE batting (player_id TEXT, year INT, stint INT, team_id TEXT, league_id TEXT, g INT, ab DECIMAL, r DECIMAL, h DECIMAL, double DECIMAL, triple DECIMAL, hr DECIMAL, rbi DECIMAL, sb DECIMAL, cs DECIMAL, bb DECIMAL, so DECIMAL, ibb DECIMAL, hbp DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE team_half (year INT, league_id TEXT, team_id TEXT, half INT, div_id TEXT, div_win TEXT, rank INT, g INT, w INT, l INT) CREATE TABLE manager_award (player_id TEXT, award_id TEXT, year INT, league_id TEXT, tie TEXT, notes DECIMAL) CREATE TABLE appearances (year INT, team_id TEXT, league_id TEXT, player_id TEXT, g_all DECIMAL, gs DECIMAL, g_batting INT, g_defense DECIMAL, g_p INT, g_c INT, g_1b INT, g_2b INT, g_3b INT, g_ss INT, g_lf INT, g_cf INT, g_rf INT, g_of INT, g_dh DECIMAL, g_ph DECIMAL, g_pr DECIMAL) CREATE TABLE batting_postseason (year INT, round TEXT, player_id TEXT, team_id TEXT, league_id TEXT, g INT, ab INT, r INT, h INT, double INT, triple INT, hr INT, rbi INT, sb INT, cs DECIMAL, bb INT, so INT, ibb DECIMAL, hbp DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE all_star (player_id TEXT, year INT, game_num INT, game_id TEXT, team_id TEXT, league_id TEXT, gp DECIMAL, starting_pos DECIMAL) CREATE TABLE fielding_postseason (player_id TEXT, year INT, team_id TEXT, league_id TEXT, round TEXT, pos TEXT, g INT, gs DECIMAL, inn_outs DECIMAL, po INT, a INT, e INT, dp INT, tp INT, pb DECIMAL, sb DECIMAL, cs DECIMAL) CREATE TABLE pitching_postseason (player_id TEXT, year INT, round TEXT, team_id TEXT, league_id TEXT, w INT, l INT, g INT, gs INT, cg INT, sho INT, sv INT, ipouts INT, h INT, er INT, hr INT, bb INT, so INT, baopp TEXT, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk DECIMAL, bfp DECIMAL, gf INT, r INT, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE pitching (player_id TEXT, year INT, stint INT, team_id TEXT, league_id TEXT, w INT, l INT, g INT, gs INT, cg INT, sho INT, sv INT, ipouts DECIMAL, h INT, er INT, hr INT, bb INT, so INT, baopp DECIMAL, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk INT, bfp DECIMAL, gf DECIMAL, r INT, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE team_franchise (franchise_id TEXT, franchise_name TEXT, active TEXT, na_assoc TEXT) CREATE TABLE manager_half (player_id TEXT, year INT, team_id TEXT, league_id TEXT, inseason INT, half INT, g INT, w INT, l INT, rank INT) CREATE TABLE park (park_id TEXT, park_name TEXT, park_alias TEXT, city TEXT, state TEXT, country TEXT) CREATE TABLE player_award (player_id TEXT, award_id TEXT, year INT, league_id TEXT, tie TEXT, notes TEXT) CREATE TABLE player (player_id TEXT, birth_year DECIMAL, birth_month DECIMAL, birth_day DECIMAL, birth_country TEXT, birth_state TEXT, birth_city TEXT, death_year DECIMAL, death_month DECIMAL, death_day DECIMAL, death_country TEXT, death_state TEXT, death_city TEXT, name_first TEXT, name_last TEXT, name_given TEXT, weight DECIMAL, height DECIMAL, bats TEXT, throws TEXT, debut TEXT, final_game TEXT, retro_id TEXT, bbref_id TEXT) CREATE TABLE salary (year INT, team_id TEXT, league_id TEXT, player_id TEXT, salary INT) CREATE TABLE hall_of_fame (player_id TEXT, yearid INT, votedby TEXT, ballots DECIMAL, needed DECIMAL, votes DECIMAL, inducted TEXT, category TEXT, needed_note TEXT) CREATE TABLE college (college_id TEXT, name_full TEXT, city TEXT, state TEXT, country TEXT) CREATE TABLE fielding (player_id TEXT, year INT, stint INT, team_id TEXT, league_id TEXT, pos TEXT, g INT, gs DECIMAL, inn_outs DECIMAL, po DECIMAL, a DECIMAL, e DECIMAL, dp DECIMAL, pb DECIMAL, wp DECIMAL, sb DECIMAL, cs DECIMAL, zr DECIMAL) CREATE TABLE player_award_vote (award_id TEXT, year INT, league_id TEXT, player_id TEXT, points_won DECIMAL, points_max INT, votes_first DECIMAL) CREATE TABLE player_college (player_id TEXT, college_id TEXT, year INT) CREATE TABLE manager_award_vote (award_id TEXT, year INT, league_id TEXT, player_id TEXT, points_won INT, points_max INT, votes_first INT) CREATE TABLE manager (player_id TEXT, year INT, team_id TEXT, league_id TEXT, inseason INT, g INT, w INT, l INT, rank DECIMAL, plyr_mgr TEXT) CREATE TABLE fielding_outfield (player_id TEXT, year INT, stint INT, glf DECIMAL, gcf DECIMAL, grf DECIMAL) CREATE TABLE home_game (year INT, league_id TEXT, team_id TEXT, park_id TEXT, span_first TEXT, span_last TEXT, games INT, openings INT, attendance INT) CREATE TABLE team (year INT, league_id TEXT, team_id TEXT, franchise_id TEXT, div_id TEXT, rank INT, g INT, ghome DECIMAL, w INT, l INT, div_win TEXT, wc_win TEXT, lg_win TEXT, ws_win TEXT, r INT, ab INT, h INT, double INT, triple INT, hr INT, bb INT, so DECIMAL, sb DECIMAL, cs DECIMAL, hbp DECIMAL, sf DECIMAL, ra INT, er INT, era DECIMAL, cg INT, sho INT, sv INT, ipouts INT, ha INT, hra INT, bba INT, soa INT, e INT, dp DECIMAL, fp DECIMAL, name TEXT, park TEXT, attendance DECIMAL, bpf INT, ppf INT, team_id_br TEXT, team_id_lahman45 TEXT, team_id_retro TEXT)
Show me a line chart for how many players enter hall of fame each year?, and rank X-axis in asc order please.
SELECT yearid, COUNT(*) FROM hall_of_fame GROUP BY yearid ORDER BY yearid
SELECT "yearid", COUNT(*) FROM "hall_of_fame" GROUP BY "yearid" ORDER BY "yearid" NULLS FIRST
0.09082
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE 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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE 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 ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE 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 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
ID questions to nominate for deletion.
SELECT p.Id, 'http://movies.stackexchange.com/questions/' + CAST(p.Id AS VARCHAR(20)) AS Link, p.Title, p.Score FROM Posts AS p LEFT OUTER JOIN (SELECT PostId, ROW_NUMBER() OVER (PARTITION BY PostId ORDER BY CreationDate DESC) AS rn FROM PostHistory AS ph WHERE PostHistoryTypeId = 10 AND Comment = '101') AS cdph ON p.Id = cdph.PostId AND cdph.rn = 1 WHERE p.PostTypeId = 1 AND p.Tags LIKE '%identify%' AND cdph.PostId IS NULL AND CreationDate <= DATEADD(yy, -1, GETDATE()) ORDER BY Score
WITH "cdph" AS (SELECT "PostId", ROW_NUMBER() OVER (PARTITION BY "PostId" ORDER BY "CreationDate" DESC NULLS LAST) AS "rn" FROM "PostHistory" AS "ph" WHERE "Comment" = '101' AND "PostHistoryTypeId" = 10) SELECT "p"."Id", CONCAT('http://movies.stackexchange.com/questions/', CAST("p"."Id" AS VARCHAR(20))) AS "Link", "p"."Title", "p"."Score" FROM "Posts" AS "p" LEFT JOIN "cdph" AS "cdph" ON "cdph"."PostId" = "p"."Id" AND "cdph"."rn" = 1 WHERE "CreationDate" <= DATEADD(YEAR, -1, GETDATE()) AND "cdph"."PostId" IS NULL AND "p"."PostTypeId" = 1 AND "p"."Tags" LIKE '%identify%' ORDER BY "Score" NULLS FIRST
0.59082
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
provide the number of patients whose primary disease is aortic insufficiency\re-do sternotomy; aortic valve replacement and procedure short title is cnt intraart bld gas mon?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " AND procedures.short_title = "Cnt intraart bld gas mon"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Cnt intraart bld gas mon" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " = "demographic"."diagnosis"
0.293945
CREATE TABLE table_name_11 (away_team VARCHAR, venue VARCHAR)
Who was the away team at Windy Hill?
SELECT away_team FROM table_name_11 WHERE venue = "windy hill"
SELECT "away_team" FROM "table_name_11" WHERE "venue" = "windy hill"
0.066406
CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT) CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT)
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the average of code , and group by attribute name, and display from high to low by the y-axis please.
SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Code DESC
SELECT "T2"."Name", "T1"."Code" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T2"."Name" ORDER BY "T1"."Code" DESC NULLS LAST
0.174805
CREATE TABLE faculty (lname VARCHAR, rank VARCHAR) CREATE TABLE Faculty (lname VARCHAR, facID VARCHAR) CREATE TABLE activity (activity_name VARCHAR) CREATE TABLE Faculty_participates_in (facID VARCHAR, actid VARCHAR)
Find the first names of professors who are not playing Canoeing or Kayaking.
SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname FROM faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
SELECT "lname" FROM "faculty" WHERE "rank" = 'Professor' EXCEPT SELECT DISTINCT "T1"."lname" FROM "faculty" AS "T1" JOIN "Faculty_participates_in" AS "T2" ON "T1"."facID" = "T2"."facID" JOIN "activity" AS "T3" ON "T2"."actid" = "T2"."actid" AND ("T3"."activity_name" = 'Canoeing' OR "T3"."activity_name" = 'Kayaking')
0.30957
CREATE TABLE table_name_87 (nhl_team VARCHAR, player VARCHAR)
I want the NHL team for wade belak
SELECT nhl_team FROM table_name_87 WHERE player = "wade belak"
SELECT "nhl_team" FROM "table_name_87" WHERE "player" = "wade belak"
0.066406
CREATE TABLE table_name_91 (venue VARCHAR, competition VARCHAR)
Which venue has a Competition of 2008 myanmar grand royal challenge cup?
SELECT venue FROM table_name_91 WHERE competition = "2008 myanmar grand royal challenge cup"
SELECT "venue" FROM "table_name_91" WHERE "2008 myanmar grand royal challenge cup" = "competition"
0.095703
CREATE TABLE table_name_40 (away_team VARCHAR, home_team VARCHAR)
What was home team North Melbourne's opponents score?
SELECT away_team AS score FROM table_name_40 WHERE home_team = "north melbourne"
SELECT "away_team" AS "score" FROM "table_name_40" WHERE "home_team" = "north melbourne"
0.085938
CREATE TABLE table_203_671 (id DECIMAL, "name" TEXT, "rank" TEXT, "age" DECIMAL, "years until mandatory retirement" TEXT, "appointed by" TEXT, "year appointed" DECIMAL)
who was the only associate justice appointed in 2010 ?
SELECT "name" FROM table_203_671 WHERE "rank" = 'associate justice' AND "year appointed" = 2010
SELECT "name" FROM "table_203_671" WHERE "rank" = 'associate justice' AND "year appointed" = 2010
0.094727
CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE 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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) 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) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
what is the last value of patient 006-227759's respiration until 1495 days ago?
SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-227759')) AND NOT vitalperiodic.respiration IS NULL AND DATETIME(vitalperiodic.observationtime) <= DATETIME(CURRENT_TIME(), '-1495 day') ORDER BY vitalperiodic.observationtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-227759' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "vitalperiodic"."respiration" FROM "vitalperiodic" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE DATETIME("vitalperiodic"."observationtime") <= DATETIME(CURRENT_TIME(), '-1495 day') AND NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."respiration" IS NULL ORDER BY "vitalperiodic"."observationtime" DESC NULLS LAST LIMIT 1
0.707031
CREATE TABLE table_name_36 (crowd INT, away_team VARCHAR)
What was the largest amount of spectators when St Kilda was the away team?
SELECT MAX(crowd) FROM table_name_36 WHERE away_team = "st kilda"
SELECT MAX("crowd") FROM "table_name_36" WHERE "away_team" = "st kilda"
0.069336
CREATE TABLE Rooms (bedType VARCHAR)
Find the number of rooms with a king bed.
SELECT COUNT(*) FROM Rooms WHERE bedType = "King"
SELECT COUNT(*) FROM "Rooms" WHERE "King" = "bedType"
0.051758
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
Find questions contain tag 'polls'. SET @TargTags = LTRIM (RTRIM (@TargTags) );
SELECT Q.Id, Q.Tags, Q.Score, Q.Title, CAST(TIME_TO_STR(Q.CreationDate, '%Y%m%d') AS TEXT(10)) AS "date_asked", Q.AnswerCount AS "num_answers" FROM Posts AS Q WHERE Q.PostTypeId = 1 AND Q.ClosedDate IS NULL AND Q.Tags LIKE '%<Mass-Effect-3>%' AND LENGTH(Q.Body) > 5 AND Q.AnswerCount > 5 ORDER BY Q.AnswerCount DESC LIMIT 10
SELECT "Q"."Id", "Q"."Tags", "Q"."Score", "Q"."Title", CAST(TO_CHAR(CAST("Q"."CreationDate" AS TIMESTAMPNTZ), 'yyyymmDD') AS TEXT(10)) AS "date_asked", "Q"."AnswerCount" AS "num_answers" FROM "Posts" AS "Q" WHERE "Q"."AnswerCount" > 5 AND "Q"."ClosedDate" IS NULL AND "Q"."PostTypeId" = 1 AND "Q"."Tags" LIKE '%<Mass-Effect-3>%' AND LENGTH("Q"."Body") > 5 ORDER BY "Q"."AnswerCount" DESC NULLS LAST LIMIT 10
0.397461
CREATE TABLE table_52830 ("Name" TEXT, "Species" TEXT, "Overview" TEXT, "Introduced" TEXT, "Feral" TEXT, "Threat level" TEXT)
What is the Overview with a medium Threat Level?
SELECT "Overview" FROM table_52830 WHERE "Threat level" = 'medium'
SELECT "Overview" FROM "table_52830" WHERE "Threat level" = 'medium'
0.066406
CREATE TABLE table_name_37 (money___ INT, score VARCHAR)
What was the highest money when the score was 69-68-67-69=273?
SELECT MAX(money___) AS $__ FROM table_name_37 WHERE score = 69 - 68 - 67 - 69 = 273
SELECT MAX("money___") AS $__ FROM "table_name_37" WHERE "score" = FALSE
0.070313
CREATE TABLE table_50086 ("Game" FLOAT, "February" FLOAT, "Opponent" TEXT, "Score" TEXT, "Record" TEXT)
What day in February had an opponent of @ Colorado Rockies?
SELECT SUM("February") FROM table_50086 WHERE "Opponent" = '@ colorado rockies'
SELECT SUM("February") FROM "table_50086" WHERE "Opponent" = '@ colorado rockies'
0.079102
CREATE TABLE table_41408 ("Name" TEXT, "Status" TEXT, "Authors" TEXT, "Location" TEXT, "Notes" TEXT)
What is the Status of primitive confuciusornithid .?
SELECT "Status" FROM table_41408 WHERE "Notes" = 'primitive confuciusornithid .'
SELECT "Status" FROM "table_41408" WHERE "Notes" = 'primitive confuciusornithid .'
0.080078
CREATE TABLE table_1198175_1 (name VARCHAR, position VARCHAR, college VARCHAR)
What is the name when the position is de and college is ohio state?
SELECT name FROM table_1198175_1 WHERE position = "DE" AND college = "Ohio State"
SELECT "name" FROM "table_1198175_1" WHERE "DE" = "position" AND "Ohio State" = "college"
0.086914
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 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 lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
What is the number of american indian/alaska native ethnic background patients who have a benz1i drug code?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND prescriptions.formulary_drug_cd = "BENZ1I"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "BENZ1I" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "AMERICAN INDIAN/ALASKA NATIVE" = "demographic"."ethnicity"
0.254883
CREATE TABLE table_name_29 (network VARCHAR, model VARCHAR)
Which network has model nForce Professional 3400 MCP?
SELECT network FROM table_name_29 WHERE model = "nforce professional 3400 mcp"
SELECT "network" FROM "table_name_29" WHERE "model" = "nforce professional 3400 mcp"
0.082031
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 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)
provide the number of patients whose death status is 1 and diagnoses long title is unspecified osteomyelitis, other specified sites?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.long_title = "Unspecified osteomyelitis, other specified sites"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Unspecified osteomyelitis, other specified sites" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "1" = "demographic"."expire_flag"
0.251953
CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR)
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the average of department_id , and group by attribute job_id, could you list by the Y-axis in asc?
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID)
SELECT "JOB_ID", AVG("DEPARTMENT_ID") FROM "employees" WHERE "FIRST_NAME" LIKE '%D%' OR "FIRST_NAME" LIKE '%S%' GROUP BY "JOB_ID" ORDER BY AVG("DEPARTMENT_ID") NULLS FIRST
0.166992
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) 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 PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId 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 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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId 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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description 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 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
how many entries in comment.
SELECT COUNT(*) FROM Comments
SELECT COUNT(*) FROM "Comments"
0.030273
CREATE TABLE table_48082 ("Res." TEXT, "Record" TEXT, "Opponent" TEXT, "Method" TEXT, "Event" TEXT, "Round" FLOAT, "Time" TEXT, "Location" TEXT)
Which Round has a Record of 10-6?
SELECT MIN("Round") FROM table_48082 WHERE "Record" = '10-6'
SELECT MIN("Round") FROM "table_48082" WHERE "Record" = '10-6'
0.060547
CREATE TABLE table_name_87 (home_team VARCHAR, away_team VARCHAR)
What is the home teams score when north melbourne is the away team?
SELECT home_team AS score FROM table_name_87 WHERE away_team = "north melbourne"
SELECT "home_team" AS "score" FROM "table_name_87" WHERE "away_team" = "north melbourne"
0.085938
CREATE TABLE people (People_ID INT, Sex TEXT, Name TEXT, Date_of_Birth TEXT, Height FLOAT, Weight FLOAT) CREATE TABLE candidate (Candidate_ID INT, People_ID INT, Poll_Source TEXT, Date TEXT, Support_rate FLOAT, Consider_rate FLOAT, Oppose_rate FLOAT, Unsure_rate FLOAT)
Bar chart of total number of height from each sex, could you order in ascending by the x-axis?
SELECT Sex, SUM(Height) FROM people GROUP BY Sex ORDER BY Sex
SELECT "Sex", SUM("Height") FROM "people" GROUP BY "Sex" ORDER BY "Sex" NULLS FIRST
0.081055
CREATE TABLE table_63105 ("Rank" FLOAT, "Lane" FLOAT, "Name" TEXT, "Nationality" TEXT, "Time" FLOAT)
Which Time has a Lane smaller than 4, and a Rank larger than 6?
SELECT AVG("Time") FROM table_63105 WHERE "Lane" < '4' AND "Rank" > '6'
SELECT AVG("Time") FROM "table_63105" WHERE "Lane" < '4' AND "Rank" > '6'
0.071289
CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR, Document_Type_Description VARCHAR) CREATE TABLE Document_Locations (Document_ID INT, Location_Code CHAR, Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME) CREATE TABLE Employees (Employee_ID INT, Role_Code CHAR, Employee_Name VARCHAR, Gender_MFU CHAR, Date_of_Birth DATETIME, Other_Details VARCHAR) CREATE TABLE Ref_Calendar (Calendar_Date DATETIME, Day_Number INT) CREATE TABLE Documents_to_be_Destroyed (Document_ID INT, Destruction_Authorised_by_Employee_ID INT, Destroyed_by_Employee_ID INT, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR) CREATE TABLE All_Documents (Document_ID INT, Date_Stored DATETIME, Document_Type_Code CHAR, Document_Name CHAR, Document_Description CHAR, Other_Details VARCHAR) CREATE TABLE Ref_Locations (Location_Code CHAR, Location_Name VARCHAR, Location_Description VARCHAR) CREATE TABLE Roles (Role_Code CHAR, Role_Name VARCHAR, Role_Description VARCHAR)
Show all calendar dates and day Numbers in a line chart, list in asc by the x-axis.
SELECT Calendar_Date, Day_Number FROM Ref_Calendar ORDER BY Calendar_Date
SELECT "Calendar_Date", "Day_Number" FROM "Ref_Calendar" ORDER BY "Calendar_Date" NULLS FIRST
0.09082
CREATE TABLE Services (Service_ID INT, Service_Type_Code CHAR) CREATE TABLE Participants_in_Events (Event_ID INT, Participant_ID INT) CREATE TABLE Events (Event_ID INT, Service_ID INT, Event_Details VARCHAR) CREATE TABLE Participants (Participant_ID INT, Participant_Type_Code CHAR, Participant_Details VARCHAR)
what are the event details of the services that have the type code 'Marriage', and count them by a pie chart
SELECT Event_Details, COUNT(Event_Details) FROM Events AS T1 JOIN Services AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Service_Type_Code = 'Marriage' GROUP BY Event_Details
SELECT "Event_Details", COUNT("Event_Details") FROM "Events" AS "T1" JOIN "Services" AS "T2" ON "T1"."Service_ID" = "T2"."Service_ID" AND "T2"."Service_Type_Code" = 'Marriage' GROUP BY "Event_Details"
0.195313
CREATE TABLE table_name_74 (winner VARCHAR, rider_status VARCHAR, year VARCHAR)
Who was the winner in 1973 with an amateur rider status?
SELECT winner FROM table_name_74 WHERE rider_status = "amateur" AND year = 1973
SELECT "winner" FROM "table_name_74" WHERE "amateur" = "rider_status" AND "year" = 1973
0.084961
CREATE TABLE table_name_30 (Id VARCHAR)
When in 2008 that has a 2007 of f?
SELECT 2008 FROM table_name_30 WHERE 2007 = "f"
SELECT 2008 FROM "table_name_30" WHERE "f" = 2007
0.047852
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value 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_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 procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount 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 prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE 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 was patient 25312 first height until 07/2105?
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25312)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht' AND d_items.linksto = 'chartevents') AND STRFTIME('%y-%m', chartevents.charttime) <= '2105-07' ORDER BY chartevents.charttime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 25312 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'admit ht' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT "chartevents"."valuenum" FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m', "chartevents"."charttime") <= '2105-07' ORDER BY "chartevents"."charttime" NULLS FIRST LIMIT 1
0.782227
CREATE TABLE table_11677100_8 (mlb_draft VARCHAR, hometown VARCHAR)
What pick was the player from Apopka, FL in the 2002 MLB draft
SELECT mlb_draft FROM table_11677100_8 WHERE hometown = "Apopka, FL"
SELECT "mlb_draft" FROM "table_11677100_8" WHERE "Apopka, FL" = "hometown"
0.072266
CREATE TABLE teachers (lastname TEXT, firstname TEXT, classroom DECIMAL) CREATE TABLE list (lastname TEXT, firstname TEXT, grade DECIMAL, classroom DECIMAL)
Find the number of students in one classroom.
SELECT COUNT(*), classroom FROM list GROUP BY classroom
SELECT COUNT(*), "classroom" FROM "list" GROUP BY "classroom"
0.05957
CREATE TABLE table_47249 ("Barangay" TEXT, "Urban/rural" TEXT, "Geographic character" TEXT, "Population ( 2007 ) " FLOAT, "Population ( 2010 ) " FLOAT)
WHAT IS THE TYPE OF LAND WITH A 2010 POPULATION GREATER THAN 2539, A RURAL AREA, AND A 2007 POPULATION OF 2572?
SELECT "Geographic character" FROM table_47249 WHERE "Population (2010)" > '2539' AND "Urban/rural" = 'rural' AND "Population (2007)" = '2572'
SELECT "Geographic character" FROM "table_47249" WHERE "Population (2007)" = '2572' AND "Population (2010)" > '2539' AND "Urban/rural" = 'rural'
0.140625
CREATE TABLE table_name_33 (home VARCHAR, date VARCHAR)
on january 7 what is home?
SELECT home FROM table_name_33 WHERE date = "january 7"
SELECT "home" FROM "table_name_33" WHERE "date" = "january 7"
0.05957
CREATE TABLE table_name_7 (year INT, location VARCHAR)
For how many years was the location at Beijing?
SELECT SUM(year) FROM table_name_7 WHERE location = "beijing"
SELECT SUM("year") FROM "table_name_7" WHERE "beijing" = "location"
0.06543
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE 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 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 d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
when was patient 15945 for the last time received intake on this month/28?
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15945)) AND DATETIME(inputevents_cv.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND STRFTIME('%d', inputevents_cv.charttime) = '28' ORDER BY inputevents_cv.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 15945 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id") SELECT "inputevents_cv"."charttime" FROM "inputevents_cv" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" WHERE DATETIME("inputevents_cv"."charttime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND NOT "_u_1"."" IS NULL AND STRFTIME('%d', "inputevents_cv"."charttime") = '28' ORDER BY "inputevents_cv"."charttime" DESC NULLS LAST LIMIT 1
0.673828
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 PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate 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) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE 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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
How much do I use StackExchange?.
SELECT SUBSTRING(CAST(TIME_TO_STR(CreationDate, '%H:%M:%S') AS TEXT(30)), 0, 6), COUNT(Id) FROM Posts WHERE OwnerUserId = '##UserId##' GROUP BY SUBSTRING(CAST(TIME_TO_STR(CreationDate, '%H:%M:%S') AS TEXT(30)), 0, 6)
SELECT SUBSTRING(CAST(TO_CHAR(CAST("CreationDate" AS TIMESTAMPNTZ), 'hh24:mi:ss') AS TEXT(30)), 0, 6), COUNT("Id") FROM "Posts" WHERE "OwnerUserId" = '##UserId##' GROUP BY SUBSTRING(CAST(TO_CHAR(CAST("CreationDate" AS TIMESTAMPNTZ), 'hh24:mi:ss') AS TEXT(30)), 0, 6)
0.259766