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 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) 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 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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
what intake did patient 035-4312 have the first time since 12/26/2105.
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-4312')) AND intakeoutput.cellpath LIKE '%intake%' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2105-12-26' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '035-4312' 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 "intakeoutput"."celllabel" FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."cellpath" LIKE '%intake%' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m-%d', "intakeoutput"."intakeoutputtime") >= '2105-12-26' ORDER BY "intakeoutput"."intakeoutputtime" NULLS FIRST LIMIT 1
0.683594
CREATE TABLE table_21001903_2 (tour VARCHAR, mixed_doubles VARCHAR, womens_singles VARCHAR)
when mixed doubles is zheng bo ma jin and womens singles is wang yihan, what was the tour?
SELECT tour FROM table_21001903_2 WHERE mixed_doubles = "Zheng Bo Ma Jin" AND womens_singles = "Wang Yihan"
SELECT "tour" FROM "table_21001903_2" WHERE "Wang Yihan" = "womens_singles" AND "Zheng Bo Ma Jin" = "mixed_doubles"
0.112305
CREATE TABLE table_40481 ("Name" TEXT, "Rank" FLOAT, "Out of" TEXT, "Source" TEXT, "Year" FLOAT)
Can you tell me the Name that has the Rank smaller than 71, and the Year larger than 2005, and the Out of 220?
SELECT "Name" FROM table_40481 WHERE "Rank" < '71' AND "Year" > '2005' AND "Out of" = '220'
SELECT "Name" FROM "table_40481" WHERE "Out of" = '220' AND "Rank" < '71' AND "Year" > '2005'
0.09082
CREATE TABLE faculty_participates_in (facid DECIMAL, actid DECIMAL) CREATE TABLE participates_in (stuid DECIMAL, actid DECIMAL) CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT) CREATE TABLE faculty (facid DECIMAL, lname TEXT, fname TEXT, rank TEXT, sex TEXT, phone DECIMAL, room TEXT, building TEXT) CREATE TABLE activity (actid DECIMAL, activity_name TEXT)
Show all the buildings along with the number of faculty members the buildings have.
SELECT building, COUNT(*) FROM faculty GROUP BY building
SELECT "building", COUNT(*) FROM "faculty" GROUP BY "building"
0.060547
CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) 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 state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) 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 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 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 compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT)
show flights FIRST class on AA between DALLAS and PHILADELPHIA
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, fare, fare_basis, flight, flight_fare WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND fare_basis.class_type = 'FIRST' AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id) AND flight.airline_code = 'AA'
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'DALLAS' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."airline_code" = 'AA' JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "flight_fare" ON "flight"."flight_id" = "flight_fare"."flight_id" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'PHILADELPHIA' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" JOIN "fare_basis" ON "fare"."fare_basis_code" = "fare_basis"."fare_basis_code" AND "fare_basis"."class_type" = 'FIRST'
0.774414
CREATE TABLE city (City_ID INT, Official_Name TEXT, Status TEXT, Area_km_2 FLOAT, Population FLOAT, Census_Ranking TEXT) CREATE TABLE farm (Farm_ID INT, Year INT, Total_Horses FLOAT, Working_Horses FLOAT, Total_Cattle FLOAT, Oxen FLOAT, Bulls FLOAT, Cows FLOAT, Pigs FLOAT, Sheep_and_Goats FLOAT) CREATE TABLE competition_record (Competition_ID INT, Farm_ID INT, Rank INT) CREATE TABLE farm_competition (Competition_ID INT, Year INT, Theme TEXT, Host_city_ID INT, Hosts TEXT)
What are the statuses and average populations of each city.
SELECT Status, AVG(Population) FROM city GROUP BY Status
SELECT "Status", AVG("Population") FROM "city" GROUP BY "Status"
0.0625
CREATE TABLE table_17003 ("Disaster" TEXT, "Year" TEXT, "Countries Affected" TEXT, "Scale of Disaster" TEXT, "People Assisted" TEXT, "Nature of Help" TEXT)
In 2005-06 what was the disaster?
SELECT "Disaster" FROM table_17003 WHERE "Year" = '2005-06'
SELECT "Disaster" FROM "table_17003" WHERE "Year" = '2005-06'
0.05957
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom 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 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 inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount 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) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE 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 prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_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 icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
among the patients of age 40s in 2101, what are the top four most frequent lab tests?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 40 AND 49) AND STRFTIME('%y', labevents.charttime) = '2101' GROUP BY labevents.itemid) AS t1 WHERE t1.c1 <= 4)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."age" <= 49 AND "admissions"."age" >= 40 GROUP BY "hadm_id"), "t1" AS (SELECT "labevents"."itemid", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y', "labevents"."charttime") = '2101' GROUP BY "labevents"."itemid"), "_u_1" AS (SELECT "t1"."itemid" FROM "t1" AS "t1" WHERE "t1"."c1" <= 4 GROUP BY "itemid") SELECT "d_labitems"."label" FROM "d_labitems" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "d_labitems"."itemid" WHERE NOT "_u_1"."" IS NULL
0.650391
CREATE TABLE table_name_43 (record VARCHAR, attendance INT)
Which record has an attendance larger than 28,459?
SELECT record FROM table_name_43 WHERE attendance > 28 OFFSET 459
SELECT "record" FROM "table_name_43" WHERE "attendance" > 28 OFFSET 459
0.069336
CREATE TABLE Course_Authors_and_Tutors (author_id INT, author_tutor_ATB VARCHAR, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR, gender_mf VARCHAR, address_line_1 VARCHAR) CREATE TABLE Student_Tests_Taken (registration_id INT, date_test_taken DATETIME, test_result VARCHAR) CREATE TABLE Courses (course_id INT, author_id INT, subject_id INT, course_name VARCHAR, course_description VARCHAR) CREATE TABLE Student_Course_Enrolment (registration_id INT, student_id INT, course_id INT, date_of_enrolment DATETIME, date_of_completion DATETIME) CREATE TABLE Students (student_id INT, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR) CREATE TABLE Subjects (subject_id INT, subject_name VARCHAR)
Give me the comparison about author_tutor_ATB over the family_name by a bar chart.
SELECT family_name, author_tutor_ATB FROM Course_Authors_and_Tutors ORDER BY personal_name
SELECT "family_name", "author_tutor_ATB" FROM "Course_Authors_and_Tutors" ORDER BY "personal_name" NULLS FIRST
0.107422
CREATE TABLE volume (volume_id DECIMAL, volume_issue TEXT, issue_date TEXT, weeks_on_top DECIMAL, song TEXT, artist_id DECIMAL) CREATE TABLE artist (artist_id DECIMAL, artist TEXT, age DECIMAL, famous_title TEXT, famous_release_date TEXT) CREATE TABLE music_festival (id DECIMAL, music_festival TEXT, date_of_ceremony TEXT, category TEXT, volume DECIMAL, result TEXT)
Please show the categories of the music festivals with count more than 1.
SELECT category FROM music_festival GROUP BY category HAVING COUNT(*) > 1
SELECT "category" FROM "music_festival" GROUP BY "category" HAVING COUNT(*) > 1
0.077148
CREATE TABLE table_name_35 (res VARCHAR, record VARCHAR)
Which res has a Record of 3-0?
SELECT res FROM table_name_35 WHERE record = "3-0"
SELECT "res" FROM "table_name_35" WHERE "3-0" = "record"
0.054688
CREATE TABLE table_28891101_3 (postal_code INT, administrative_capital VARCHAR)
What is the postal code when the administrative capital in Bori?
SELECT MAX(postal_code) FROM table_28891101_3 WHERE administrative_capital = "Bori"
SELECT MAX("postal_code") FROM "table_28891101_3" WHERE "Bori" = "administrative_capital"
0.086914
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 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE CloseReasonTypes (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 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 ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE 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 ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId 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 PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
Test: List of Users in a given location.
SELECT Id AS "user_link", Location, Reputation FROM Users WHERE LOWER(Location) LIKE LOWER('%##location##%') ORDER BY Location
SELECT "Id" AS "user_link", "Location", "Reputation" FROM "Users" WHERE LOWER("Location") LIKE LOWER('%##location##%') ORDER BY "Location" NULLS FIRST
0.146484
CREATE TABLE table_26382 ("Year" FLOAT, "Starts" FLOAT, "Wins" FLOAT, "Top 5" FLOAT, "Top 10" FLOAT, "Poles" FLOAT, "Avg. Start" TEXT, "Avg. Finish" TEXT, "Winnings" TEXT, "Position" TEXT, "Team ( s ) " TEXT)
what are the maximum wins where the poles are 2?
SELECT MAX("Wins") FROM table_26382 WHERE "Poles" = '2'
SELECT MAX("Wins") FROM "table_26382" WHERE "Poles" = '2'
0.055664
CREATE TABLE table_11912 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What away team played at VFL Park with more than 10,530 spectators?
SELECT "Away team" FROM table_11912 WHERE "Crowd" > '10,530' AND "Venue" = 'vfl park'
SELECT "Away team" FROM "table_11912" WHERE "Crowd" > '10,530' AND "Venue" = 'vfl park'
0.084961
CREATE TABLE table_11206 ("Region" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalogue" TEXT)
What region has vinyl record listed as its format?
SELECT "Region" FROM table_11206 WHERE "Format" = 'vinyl record'
SELECT "Region" FROM "table_11206" WHERE "Format" = 'vinyl record'
0.064453
CREATE TABLE table_29753 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
What game number was played on april 8?
SELECT MIN("Game") FROM table_29753 WHERE "Date" = 'April 8'
SELECT MIN("Game") FROM "table_29753" WHERE "Date" = 'April 8'
0.060547
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE 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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
what was the dosage of ezetimibe that was last prescribed to patient 82159 during their last hospital encounter?
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 82159 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.drug = 'ezetimibe' ORDER BY prescriptions.startdate DESC LIMIT 1
SELECT "prescriptions"."dose_val_rx" FROM "prescriptions" WHERE "prescriptions"."drug" = 'ezetimibe' AND "prescriptions"."hadm_id" IN (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 82159 AND NOT "admissions"."dischtime" IS NULL ORDER BY "admissions"."admittime" DESC NULLS LAST LIMIT 1) ORDER BY "prescriptions"."startdate" DESC NULLS LAST LIMIT 1
0.374023
CREATE TABLE table_58918 ("Week 9 Oct 29" TEXT, "Week 10 Nov 5" TEXT, "Week 11 Nov 12" TEXT, "Week 12 Nov 19" TEXT, "Week 13 Nov 26" TEXT, "Week 14 Dec 3" TEXT, "Week 15 ( Final ) Dec 9" TEXT)
What is the week 10 result for the tean when the week 15 result is Illinois (10-1)?
SELECT "Week 10 Nov 5" FROM table_58918 WHERE "Week 15 (Final) Dec 9" = 'illinois (10-1)'
SELECT "Week 10 Nov 5" FROM "table_58918" WHERE "Week 15 (Final) Dec 9" = 'illinois (10-1)'
0.088867
CREATE TABLE table_70272 ("Name" TEXT, "League" FLOAT, "Play-offs" FLOAT, "FA Cup" FLOAT, "League Cup" FLOAT, "Total" FLOAT)
What's the total number of League Cup with a Play-off larger than 2, and a Name of Mitch Cook Category:Articles with hCards?
SELECT COUNT("League Cup") FROM table_70272 WHERE "Play-offs" > '2' AND "Name" = 'mitch cook category:articles with hcards'
SELECT COUNT("League Cup") FROM "table_70272" WHERE "Name" = 'mitch cook category:articles with hcards' AND "Play-offs" > '2'
0.12207
CREATE TABLE table_203_426 (id DECIMAL, "year" DECIMAL, "title" TEXT, "peak chart positions\ aus" DECIMAL, "peak chart positions\ nz" DECIMAL, "peak chart positions\ uk" DECIMAL, "album" TEXT)
what was the last single released by the triffids ?
SELECT "title" FROM table_203_426 ORDER BY "year" DESC LIMIT 1
SELECT "title" FROM "table_203_426" ORDER BY "year" DESC NULLS LAST LIMIT 1
0.073242
CREATE TABLE table_2679061_7 (nationality VARCHAR, nhl_team VARCHAR)
What country do the Winnipeg Jets come from?
SELECT nationality FROM table_2679061_7 WHERE nhl_team = "Winnipeg Jets"
SELECT "nationality" FROM "table_2679061_7" WHERE "Winnipeg Jets" = "nhl_team"
0.076172
CREATE TABLE table_name_54 (category VARCHAR, for_the_show VARCHAR, year VARCHAR)
For 2006 what category has the Show of kasautii zindagii kay?
SELECT category FROM table_name_54 WHERE for_the_show = "kasautii zindagii kay" AND year = 2006
SELECT "category" FROM "table_name_54" WHERE "for_the_show" = "kasautii zindagii kay" AND "year" = 2006
0.100586
CREATE TABLE constructorStandings (constructorStandingsId INT, raceId INT, constructorId INT, points FLOAT, position INT, positionText TEXT, wins INT) CREATE TABLE status (statusId INT, status TEXT) CREATE TABLE qualifying (qualifyId INT, raceId INT, driverId INT, constructorId INT, number INT, position INT, q1 TEXT, q2 TEXT, q3 TEXT) CREATE TABLE results (resultId INT, raceId INT, driverId INT, constructorId INT, number INT, grid INT, position TEXT, positionText TEXT, positionOrder INT, points FLOAT, laps TEXT, time TEXT, milliseconds TEXT, fastestLap TEXT, rank TEXT, fastestLapTime TEXT, fastestLapSpeed TEXT, statusId INT) CREATE TABLE seasons (year INT, url TEXT) CREATE TABLE pitStops (raceId INT, driverId INT, stop INT, lap INT, time TEXT, duration TEXT, milliseconds INT) CREATE TABLE circuits (circuitId INT, circuitRef TEXT, name TEXT, location TEXT, country TEXT, lat FLOAT, lng FLOAT, alt TEXT, url TEXT) CREATE TABLE lapTimes (raceId INT, driverId INT, lap INT, position INT, time TEXT, milliseconds INT) CREATE TABLE driverStandings (driverStandingsId INT, raceId INT, driverId INT, points FLOAT, position INT, positionText TEXT, wins INT) CREATE TABLE drivers (driverId INT, driverRef TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT) CREATE TABLE constructorResults (constructorResultsId INT, raceId INT, constructorId INT, points FLOAT, status TEXT) CREATE TABLE constructors (constructorId INT, constructorRef TEXT, name TEXT, nationality TEXT, url TEXT) CREATE TABLE races (raceId INT, year INT, round INT, circuitId INT, name TEXT, date TEXT, time TEXT, url TEXT)
How many races are held in each year after 2014? Show me a bar chart, and rank in desc by the bar please.
SELECT year, COUNT(year) FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T1.year > 2014 GROUP BY year ORDER BY year DESC
SELECT "year", COUNT("year") FROM "races" AS "T1" JOIN "results" AS "T2" ON "T1"."raceId" = "T2"."raceId" WHERE "T1"."year" > 2014 GROUP BY "year" ORDER BY "year" DESC NULLS LAST
0.173828
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
how many patients whose diagnoses icd9 code is 2984 and drug type is main?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "2984" AND prescriptions.drug_type = "MAIN"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "2984" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "prescriptions" ON "MAIN" = "prescriptions"."drug_type" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.283203
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
give me the number of patients whose days of hospital stay is greater than 8 and drug route is both eyes?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "8" AND prescriptions.route = "BOTH EYES"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "BOTH EYES" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "8" < "demographic"."days_stay"
0.21875
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)
what is the number of patients whose diagnosis icd9 code is 30390 and with pb drug route?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "30390" AND prescriptions.route = "PB"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "30390" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "prescriptions" ON "PB" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.27832
CREATE TABLE table_name_24 (singular_word VARCHAR, plural_word VARCHAR)
The plural word of hands uses what singular word?
SELECT singular_word FROM table_name_24 WHERE plural_word = "hands"
SELECT "singular_word" FROM "table_name_24" WHERE "hands" = "plural_word"
0.071289
CREATE TABLE table_53707 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
In which venue did a home team score 15.5 (95)?
SELECT "Venue" FROM table_53707 WHERE "Home team score" = '15.5 (95)'
SELECT "Venue" FROM "table_53707" WHERE "Home team score" = '15.5 (95)'
0.069336
CREATE TABLE table_10007452_3 (fleet_series__quantity_ VARCHAR, fuel_propulsion VARCHAR)
how many times is the fuel propulsion is cng?
SELECT COUNT(fleet_series__quantity_) FROM table_10007452_3 WHERE fuel_propulsion = "CNG"
SELECT COUNT("fleet_series__quantity_") FROM "table_10007452_3" WHERE "CNG" = "fuel_propulsion"
0.092773
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE 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) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
on the current intensive care unit visit has patient 28447 had any or out pacu urine output?
SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28447) AND icustays.outtime IS NULL) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'or out pacu urine' AND d_items.linksto = 'outputevents')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 28447 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 "icustays"."outtime" IS NULL AND NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'or out pacu urine' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "outputevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
0.701172
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime 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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
when was the first time patient 033-42758 got prescribed for pantoprazole 40 mg iv recon soln and meropenem 500 mg iv solr at the same time in 11/2104?
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'pantoprazole 40 mg iv recon soln' AND patient.uniquepid = '033-42758' AND STRFTIME('%y-%m', medication.drugstarttime) = '2104-11') AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'meropenem 500 mg iv solr' AND patient.uniquepid = '033-42758' AND STRFTIME('%y-%m', medication.drugstarttime) = '2104-11') AS t2 ON t1.uniquepid = t2.uniquepid WHERE DATETIME(t1.drugstarttime) = DATETIME(t2.drugstarttime) ORDER BY t1.drugstarttime LIMIT 1
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."uniquepid" = '033-42758' WHERE "medication"."drugname" = 'meropenem 500 mg iv solr' AND STRFTIME('%y-%m', "medication"."drugstarttime") = '2104-11') SELECT "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."uniquepid" = '033-42758' JOIN "t2" AS "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("medication"."drugstarttime") = DATETIME("t2"."drugstarttime") WHERE "medication"."drugname" = 'pantoprazole 40 mg iv recon soln' AND STRFTIME('%y-%m', "medication"."drugstarttime") = '2104-11' ORDER BY "medication"."drugstarttime" NULLS FIRST LIMIT 1
0.821289
CREATE TABLE room (blockcode VARCHAR, unavailable VARCHAR)
What are the unique block codes that have available rooms?
SELECT DISTINCT blockcode FROM room WHERE unavailable = 0
SELECT DISTINCT "blockcode" FROM "room" WHERE "unavailable" = 0
0.061523
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime 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 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 allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
what are the five most commonly given diagnoses for patients who have received esophagogastroduodenoscopy - with biopsy previously within 2 months until 2102?
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'esophagogastroduodenoscopy - with biopsy' AND STRFTIME('%y', treatment.treatmenttime) <= '2102') AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', diagnosis.diagnosistime) <= '2102') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.diagnosistime AND DATETIME(t2.diagnosistime) BETWEEN DATETIME(t1.treatmenttime) AND DATETIME(t1.treatmenttime, '+2 month') GROUP BY t2.diagnosisname) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosisname", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE STRFTIME('%y', "diagnosis"."diagnosistime") <= '2102'), "t3" AS (SELECT "t2"."diagnosisname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" JOIN "t2" AS "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND "t2"."diagnosistime" > "treatment"."treatmenttime" AND DATETIME("t2"."diagnosistime") <= DATETIME("treatment"."treatmenttime", '+2 month') AND DATETIME("t2"."diagnosistime") >= DATETIME("treatment"."treatmenttime") WHERE "treatment"."treatmentname" = 'esophagogastroduodenoscopy - with biopsy' AND STRFTIME('%y', "treatment"."treatmenttime") <= '2102' GROUP BY "t2"."diagnosisname") SELECT "t3"."diagnosisname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 5
0.953125
CREATE TABLE table_59912 ("Squad No." FLOAT, "Name" TEXT, "Position" TEXT, "League Apps" TEXT, "League Goals" FLOAT, "FA Cup Apps" TEXT, "FA Cup Goals" FLOAT, "League Cup Apps" TEXT, "League Cup Goals" FLOAT, "FLT Apps" TEXT, "FLT Goals" FLOAT, "Total Apps" TEXT, "Total Goals" FLOAT)
What is the total number of FA Cup Goals, when FLT Goals is greater than 0?
SELECT COUNT("FA Cup Goals") FROM table_59912 WHERE "FLT Goals" > '0'
SELECT COUNT("FA Cup Goals") FROM "table_59912" WHERE "FLT Goals" > '0'
0.069336
CREATE TABLE table_11677691_11 (hometown VARCHAR, school VARCHAR)
What is the hometown of the player who attended American Heritage School?
SELECT hometown FROM table_11677691_11 WHERE school = "American Heritage school"
SELECT "hometown" FROM "table_11677691_11" WHERE "American Heritage school" = "school"
0.083984
CREATE TABLE table_name_99 (spine VARCHAR, number_of_issues VARCHAR)
Which spine has 12 issues?
SELECT spine FROM table_name_99 WHERE number_of_issues = 12
SELECT "spine" FROM "table_name_99" WHERE "number_of_issues" = 12
0.063477
CREATE TABLE table_name_65 (score VARCHAR, date VARCHAR)
What is Score, when Date is 10 July 2011?
SELECT score FROM table_name_65 WHERE date = "10 july 2011"
SELECT "score" FROM "table_name_65" WHERE "10 july 2011" = "date"
0.063477
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 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 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 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_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE 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 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 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
has patient 77676 had any surgeries until 1 year ago?
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 77676) AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 77676 GROUP BY "hadm_id") SELECT COUNT(*) > 0 FROM "procedures_icd" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime") <= DATETIME(CURRENT_TIME(), '-1 year') AND NOT "_u_0"."" IS NULL
0.335938
CREATE TABLE table_train_274 ("id" INT, "gender" TEXT, "serum_bicarbonate" INT, "randomization_bg" INT, "positive_serum" BOOLEAN, "diabetic_ketoacidosis" BOOLEAN, "urinary_ketones" BOOLEAN, "diastolic_blood_pressure_dbp" INT, "heart_rate" INT, "body_mass_index_bmi" FLOAT, "age" FLOAT, "NOUSE" FLOAT)
bmi range: > 25 kg / m^2 and < 45 kg / m^2
SELECT * FROM table_train_274 WHERE body_mass_index_bmi > 25 AND body_mass_index_bmi < 45
SELECT * FROM "table_train_274" WHERE "body_mass_index_bmi" < 45 AND "body_mass_index_bmi" > 25
0.092773
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseReasonTypes (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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE 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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskTypes (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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
GROUP BY - Most popular user locations.
SELECT Location, COUNT(*) AS Population FROM dbo.Users GROUP BY Location ORDER BY Population DESC
SELECT "Location", COUNT(*) AS "Population" FROM "dbo"."Users" GROUP BY "Location" ORDER BY "Population" DESC NULLS LAST
0.117188
CREATE TABLE table_name_60 (score VARCHAR, home VARCHAR, leading_scorer VARCHAR)
What is the score of the home game for the Cavaliers where Lebron James (46) was the lead scorer?
SELECT score FROM table_name_60 WHERE home = "cavaliers" AND leading_scorer = "lebron james (46)"
SELECT "score" FROM "table_name_60" WHERE "cavaliers" = "home" AND "leading_scorer" = "lebron james (46)"
0.102539
CREATE TABLE table_203_804 (id DECIMAL, "pos" TEXT, "no" DECIMAL, "driver" TEXT, "constructor" TEXT, "laps" DECIMAL, "time/retired" TEXT, "grid" DECIMAL)
what driver was below jo vonlanthen in the grid ?
SELECT "driver" FROM table_203_804 WHERE id = (SELECT id FROM table_203_804 WHERE "driver" = 'jo vonlanthen') + 1
SELECT "driver" FROM "table_203_804" WHERE "id" = (SELECT "id" FROM "table_203_804" WHERE "driver" = 'jo vonlanthen') + 1
0.118164
CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR)
Are there any easy ARTDES classes that I can take ?
SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department LIKE '%ARTDES%' AND program_course.course_id = course.course_id AND program_course.workload < 3
SELECT DISTINCT "course"."name", "course"."number", "program_course"."workload" FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."workload" < 3 WHERE "course"."department" LIKE '%ARTDES%'
0.244141
CREATE TABLE table_name_66 (tonnage VARCHAR, date VARCHAR)
Which Tonnage is on 25 july 1942?
SELECT tonnage FROM table_name_66 WHERE date = "25 july 1942"
SELECT "tonnage" FROM "table_name_66" WHERE "25 july 1942" = "date"
0.06543
CREATE TABLE table_name_72 (country VARCHAR, iata VARCHAR)
Which country's IATA is ika?
SELECT country FROM table_name_72 WHERE iata = "ika"
SELECT "country" FROM "table_name_72" WHERE "iata" = "ika"
0.056641
CREATE TABLE table_2114238_1 (archive VARCHAR, run_time VARCHAR)
Which archive has a run time of 23:48?
SELECT archive FROM table_2114238_1 WHERE run_time = "23:48"
SELECT "archive" FROM "table_2114238_1" WHERE "23:48" = "run_time"
0.064453
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value 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_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) 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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
how many times has patient 20801 come into icu?
SELECT COUNT(DISTINCT icustays.icustay_id) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20801)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 20801 GROUP BY "hadm_id") SELECT COUNT(DISTINCT "icustays"."icustay_id") FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL
0.270508
CREATE TABLE table_2439728_1 (school VARCHAR, location VARCHAR)
name the school located at Milton, ma.
SELECT school FROM table_2439728_1 WHERE location = "Milton, MA"
SELECT "school" FROM "table_2439728_1" WHERE "Milton, MA" = "location"
0.068359
CREATE TABLE table_14903999_1 (womens_doubles VARCHAR, mixed_doubles VARCHAR)
How many womens doubles had champions the years broddi kristj nsson dr fa har ard ttir won mixed doubles
SELECT COUNT(womens_doubles) FROM table_14903999_1 WHERE mixed_doubles = "Broddi Kristjánsson Drífa Harðardóttir"
SELECT COUNT("womens_doubles") FROM "table_14903999_1" WHERE "Broddi Kristjánsson Drífa Harðardóttir" = "mixed_doubles"
0.116211
CREATE TABLE table_45869 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Location" TEXT, "Record" TEXT)
What is the score at the forum location?
SELECT "Score" FROM table_45869 WHERE "Location" = 'the forum'
SELECT "Score" FROM "table_45869" WHERE "Location" = 'the forum'
0.0625
CREATE TABLE table_32509 ("Year" FLOAT, "Game" TEXT, "Team" TEXT, "Runner-up" TEXT, "Score" TEXT)
What team lost a game by a score of 6-0?
SELECT "Runner-up" FROM table_32509 WHERE "Score" = '6-0'
SELECT "Runner-up" FROM "table_32509" WHERE "Score" = '6-0'
0.057617
CREATE TABLE table_214920_1 (regional_county_municipality__rcm_ VARCHAR, density__pop_per_km2_ VARCHAR)
What is the RCM that has a density of 9.7?
SELECT regional_county_municipality__rcm_ FROM table_214920_1 WHERE density__pop_per_km2_ = "9.7"
SELECT "regional_county_municipality__rcm_" FROM "table_214920_1" WHERE "9.7" = "density__pop_per_km2_"
0.100586
CREATE TABLE table_7079 ("Name" TEXT, "Built by HM Dockyard" TEXT, "Ordered" TEXT, "Laid down" TEXT, "Launched" TEXT)
What ordered has algerine (2nd of name) as the name?
SELECT "Ordered" FROM table_7079 WHERE "Name" = 'algerine (2nd of name)'
SELECT "Ordered" FROM "table_7079" WHERE "Name" = 'algerine (2nd of name)'
0.072266
CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT) CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT) CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT) CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT)
Find Nationality and the average of meter_100 , and group by attribute Nationality, and visualize them by a bar chart.
SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality
SELECT "Nationality", AVG("meter_100") FROM "swimmer" GROUP BY "Nationality"
0.074219
CREATE TABLE table_6429 ("Make/ Model" TEXT, "length" TEXT, "Year" FLOAT, "Numbers ( Quantity Ordered ) " TEXT, "Fuel Propulsion" TEXT)
Which Numbers (Quantity Ordered) have a Make/ Model of eldorado national passport?
SELECT "Numbers (Quantity Ordered)" FROM table_6429 WHERE "Make/ Model" = 'eldorado national passport'
SELECT "Numbers (Quantity Ordered)" FROM "table_6429" WHERE "Make/ Model" = 'eldorado national passport'
0.101563
CREATE TABLE weather (date TEXT, max_temperature_f INT, mean_temperature_f INT, min_temperature_f INT, max_dew_point_f INT, mean_dew_point_f INT, min_dew_point_f INT, max_humidity INT, mean_humidity INT, min_humidity INT, max_sea_level_pressure_inches DECIMAL, mean_sea_level_pressure_inches DECIMAL, min_sea_level_pressure_inches DECIMAL, max_visibility_miles INT, mean_visibility_miles INT, min_visibility_miles INT, max_wind_Speed_mph INT, mean_wind_speed_mph INT, max_gust_speed_mph INT, precipitation_inches INT, cloud_cover INT, events TEXT, wind_dir_degrees INT, zip_code INT) CREATE TABLE trip (id INT, duration INT, start_date TEXT, start_station_name TEXT, start_station_id INT, end_date TEXT, end_station_name TEXT, end_station_id INT, bike_id INT, subscription_type TEXT, zip_code INT) CREATE TABLE station (id INT, name TEXT, lat DECIMAL, long DECIMAL, dock_count INT, city TEXT, installation_date TEXT) CREATE TABLE status (station_id INT, bikes_available INT, docks_available INT, time TEXT)
What is the name of every city that has at least 15 stations and how many stations does it have. Show the proportion.
SELECT city, COUNT(*) FROM station GROUP BY city
SELECT "city", COUNT(*) FROM "station" GROUP BY "city"
0.052734
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId 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 ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense 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 ReviewTaskTypes (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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name 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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE CloseReasonTypes (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 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 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
user profiles that are probably broken due to accountid being null.
SELECT * FROM Users WHERE AccountId IS NULL
SELECT * FROM "Users" WHERE "AccountId" IS NULL
0.045898
CREATE TABLE table_53364 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
Where did a home team score 8.14 (62)?
SELECT "Venue" FROM table_53364 WHERE "Home team score" = '8.14 (62)'
SELECT "Venue" FROM "table_53364" WHERE "Home team score" = '8.14 (62)'
0.069336
CREATE TABLE table_name_95 (date VARCHAR, record VARCHAR)
Which Date has a Record of 8:39.49?
SELECT date FROM table_name_95 WHERE record = "8:39.49"
SELECT "date" FROM "table_name_95" WHERE "8:39.49" = "record"
0.05957
CREATE TABLE table_name_26 (category VARCHAR, result VARCHAR, award VARCHAR)
Name the category for nominated at the british comedy awards
SELECT category FROM table_name_26 WHERE result = "nominated" AND award = "british comedy awards"
SELECT "category" FROM "table_name_26" WHERE "award" = "british comedy awards" AND "nominated" = "result"
0.102539
CREATE TABLE table_2384 ("\\u2116" FLOAT, "#" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" TEXT, "U.S. viewers ( millions ) " TEXT)
What is every director with production code of NABF13?
SELECT "Directed by" FROM table_2384 WHERE "Production code" = 'NABF13'
SELECT "Directed by" FROM "table_2384" WHERE "Production code" = 'NABF13'
0.071289
CREATE TABLE Player (LOCATION VARCHAR, School_ID VARCHAR) CREATE TABLE school (LOCATION VARCHAR, School_ID VARCHAR)
List the locations of schools that do not have any player.
SELECT LOCATION FROM school WHERE NOT School_ID IN (SELECT School_ID FROM Player)
SELECT "LOCATION" FROM "school" WHERE NOT "School_ID" IN (SELECT "School_ID" FROM "Player")
0.088867
CREATE TABLE table_204_590 (id DECIMAL, "year" DECIMAL, "division" DECIMAL, "league" TEXT, "regular season" TEXT, "playoffs" TEXT, "open cup" TEXT, "avg. attendance" DECIMAL)
what is the average number of attendance in 2007 ?
SELECT "avg. attendance" FROM table_204_590 WHERE "year" = 2007
SELECT "avg. attendance" FROM "table_204_590" WHERE "year" = 2007
0.063477
CREATE TABLE table_name_74 (bronze VARCHAR, total VARCHAR, competitors VARCHAR)
What is the Bronze in the year there was a Total of 0 medals and 6 Competitors?
SELECT bronze FROM table_name_74 WHERE total = "0" AND competitors = "6"
SELECT "bronze" FROM "table_name_74" WHERE "0" = "total" AND "6" = "competitors"
0.078125
CREATE TABLE home_game (year DECIMAL, league_id TEXT, team_id TEXT, park_id TEXT, span_first TEXT, span_last TEXT, games DECIMAL, openings DECIMAL, attendance DECIMAL) CREATE TABLE salary (year DECIMAL, team_id TEXT, league_id TEXT, player_id TEXT, salary DECIMAL) CREATE TABLE postseason (year DECIMAL, round TEXT, team_id_winner TEXT, league_id_winner TEXT, team_id_loser TEXT, league_id_loser TEXT, wins DECIMAL, losses DECIMAL, ties DECIMAL) CREATE TABLE fielding_outfield (player_id TEXT, year DECIMAL, stint DECIMAL, glf DECIMAL, gcf DECIMAL, grf DECIMAL) CREATE TABLE fielding (player_id TEXT, year DECIMAL, stint DECIMAL, team_id TEXT, league_id TEXT, pos TEXT, g DECIMAL, 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 team_half (year DECIMAL, league_id TEXT, team_id TEXT, half DECIMAL, div_id TEXT, div_win TEXT, rank DECIMAL, g DECIMAL, w DECIMAL, l DECIMAL) CREATE TABLE pitching (player_id TEXT, year DECIMAL, stint DECIMAL, team_id TEXT, league_id TEXT, w DECIMAL, l DECIMAL, g DECIMAL, gs DECIMAL, cg DECIMAL, sho DECIMAL, sv DECIMAL, ipouts DECIMAL, h DECIMAL, er DECIMAL, hr DECIMAL, bb DECIMAL, so DECIMAL, baopp DECIMAL, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk DECIMAL, bfp DECIMAL, gf DECIMAL, r DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE appearances (year DECIMAL, team_id TEXT, league_id TEXT, player_id TEXT, g_all DECIMAL, gs DECIMAL, g_batting DECIMAL, g_defense DECIMAL, g_p DECIMAL, g_c DECIMAL, g_1b DECIMAL, g_2b DECIMAL, g_3b DECIMAL, g_ss DECIMAL, g_lf DECIMAL, g_cf DECIMAL, g_rf DECIMAL, g_of DECIMAL, g_dh DECIMAL, g_ph DECIMAL, g_pr DECIMAL) CREATE TABLE batting (player_id TEXT, year DECIMAL, stint DECIMAL, team_id TEXT, league_id TEXT, g DECIMAL, 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 manager (player_id TEXT, year DECIMAL, team_id TEXT, league_id TEXT, inseason DECIMAL, g DECIMAL, w DECIMAL, l DECIMAL, rank DECIMAL, plyr_mgr TEXT) CREATE TABLE manager_award (player_id TEXT, award_id TEXT, year DECIMAL, league_id TEXT, tie TEXT, notes DECIMAL) CREATE TABLE fielding_postseason (player_id TEXT, year DECIMAL, team_id TEXT, league_id TEXT, round TEXT, pos TEXT, g DECIMAL, gs DECIMAL, inn_outs DECIMAL, po DECIMAL, a DECIMAL, e DECIMAL, dp DECIMAL, tp DECIMAL, pb DECIMAL, sb DECIMAL, cs DECIMAL) CREATE TABLE player_college (player_id TEXT, college_id TEXT, year DECIMAL) CREATE TABLE team_franchise (franchise_id TEXT, franchise_name TEXT, active TEXT, na_assoc TEXT) CREATE TABLE all_star (player_id TEXT, year DECIMAL, game_num DECIMAL, game_id TEXT, team_id TEXT, league_id TEXT, gp DECIMAL, starting_pos DECIMAL) CREATE TABLE hall_of_fame (player_id TEXT, yearid DECIMAL, 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 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 park (park_id TEXT, park_name TEXT, park_alias TEXT, city TEXT, state TEXT, country TEXT) CREATE TABLE batting_postseason (year DECIMAL, round TEXT, player_id TEXT, team_id TEXT, league_id TEXT, g DECIMAL, 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 player_award_vote (award_id TEXT, year DECIMAL, league_id TEXT, player_id TEXT, points_won DECIMAL, points_max DECIMAL, votes_first DECIMAL) CREATE TABLE manager_half (player_id TEXT, year DECIMAL, team_id TEXT, league_id TEXT, inseason DECIMAL, half DECIMAL, g DECIMAL, w DECIMAL, l DECIMAL, rank DECIMAL) CREATE TABLE manager_award_vote (award_id TEXT, year DECIMAL, league_id TEXT, player_id TEXT, points_won DECIMAL, points_max DECIMAL, votes_first DECIMAL) CREATE TABLE player_award (player_id TEXT, award_id TEXT, year DECIMAL, league_id TEXT, tie TEXT, notes TEXT) CREATE TABLE team (year DECIMAL, league_id TEXT, team_id TEXT, franchise_id TEXT, div_id TEXT, rank DECIMAL, g DECIMAL, ghome DECIMAL, w DECIMAL, l DECIMAL, div_win TEXT, wc_win TEXT, lg_win TEXT, ws_win TEXT, r DECIMAL, ab DECIMAL, h DECIMAL, double DECIMAL, triple DECIMAL, hr DECIMAL, bb DECIMAL, so DECIMAL, sb DECIMAL, cs DECIMAL, hbp DECIMAL, sf DECIMAL, ra DECIMAL, er DECIMAL, era DECIMAL, cg DECIMAL, sho DECIMAL, sv DECIMAL, ipouts DECIMAL, ha DECIMAL, hra DECIMAL, bba DECIMAL, soa DECIMAL, e DECIMAL, dp DECIMAL, fp DECIMAL, name TEXT, park TEXT, attendance DECIMAL, bpf DECIMAL, ppf DECIMAL, team_id_br TEXT, team_id_lahman45 TEXT, team_id_retro TEXT) CREATE TABLE pitching_postseason (player_id TEXT, year DECIMAL, round TEXT, team_id TEXT, league_id TEXT, w DECIMAL, l DECIMAL, g DECIMAL, gs DECIMAL, cg DECIMAL, sho DECIMAL, sv DECIMAL, ipouts DECIMAL, h DECIMAL, er DECIMAL, hr DECIMAL, bb DECIMAL, so DECIMAL, baopp TEXT, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk DECIMAL, bfp DECIMAL, gf DECIMAL, r DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL)
Compute the average salary of the players in the team called 'Boston Red Stockings'.
SELECT AVG(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'
SELECT AVG("T1"."salary") FROM "salary" AS "T1" JOIN "team" AS "T2" ON "T1"."team_id" = "T2"."team_id_br" AND "T2"."name" = 'Boston Red Stockings'
0.142578
CREATE TABLE table_204_877 (id DECIMAL, "place" DECIMAL, "position" TEXT, "number" DECIMAL, "name" TEXT, "league two" DECIMAL, "fa cup" DECIMAL, "league cup" DECIMAL, "fl trophy" DECIMAL, "total" DECIMAL)
who scored more , grant or benyon ?
SELECT "name" FROM table_204_877 WHERE "name" IN ('anthony grant', 'elliot benyon') ORDER BY "total" DESC LIMIT 1
SELECT "name" FROM "table_204_877" WHERE "name" IN ('anthony grant', 'elliot benyon') ORDER BY "total" DESC NULLS LAST LIMIT 1
0.123047
CREATE TABLE table_39159 ("Year" FLOAT, "Men's singles" TEXT, "Women's singles" TEXT, "Men's doubles" TEXT, "Women's doubles" TEXT, "Mixed doubles" TEXT)
What is the men's doubles for 2003?
SELECT "Men's doubles" FROM table_39159 WHERE "Year" = '2003'
SELECT "Men's doubles" FROM "table_39159" WHERE "Year" = '2003'
0.061523
CREATE TABLE table_24371 ("Type of Record" TEXT, "Attendance" FLOAT, "Date/Year" TEXT, "Stadium" TEXT, "Result/Games" TEXT)
Which type of record has result/games of b.c. 16 @ edmonton 22?
SELECT "Type of Record" FROM table_24371 WHERE "Result/Games" = 'B.C. 16 @ Edmonton 22'
SELECT "Type of Record" FROM "table_24371" WHERE "Result/Games" = 'B.C. 16 @ Edmonton 22'
0.086914
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) 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 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 lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
when was the last time that patient 002-1171 has the maximum temperature value on the first icu visit.
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-1171') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1) AND NOT vitalperiodic.temperature IS NULL ORDER BY vitalperiodic.temperature DESC, vitalperiodic.observationtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '002-1171' GROUP BY "patienthealthsystemstayid") SELECT "vitalperiodic"."observationtime" FROM "vitalperiodic" WHERE "vitalperiodic"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL ORDER BY "patient"."unitadmittime" NULLS FIRST LIMIT 1) AND NOT "vitalperiodic"."temperature" IS NULL ORDER BY "vitalperiodic"."temperature" DESC NULLS LAST, "vitalperiodic"."observationtime" DESC NULLS LAST LIMIT 1
0.667969
CREATE TABLE table_name_72 (year VARCHAR, points INT)
In which year were the points more than 0?
SELECT year FROM table_name_72 WHERE points > 0
SELECT "year" FROM "table_name_72" WHERE "points" > 0
0.051758
CREATE TABLE table_747 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Result" TEXT, "Candidates" TEXT)
What number of party had a candidate resigned when appointed judge democratic hold?
SELECT COUNT("Party") FROM table_747 WHERE "Result" = 'Resigned when appointed judge Democratic hold'
SELECT COUNT("Party") FROM "table_747" WHERE "Result" = 'Resigned when appointed judge Democratic hold'
0.100586
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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE 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 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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewTaskResultTypes (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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress 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 ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
Tumbleweeds: users with 1 question.
WITH a AS (SELECT q.OwnerUserId FROM Posts AS q INNER JOIN Badges AS b ON q.OwnerUserId = b.UserId WHERE q.PostTypeId = 1 AND b.Name = 'Tumbleweed' GROUP BY q.OwnerUserId HAVING COUNT(q.Id) = 1) SELECT COUNT(*) FROM a
WITH "a" AS (SELECT 1 AS "_" FROM "Posts" AS "q" JOIN "Badges" AS "b" ON "b"."Name" = 'Tumbleweed' AND "b"."UserId" = "q"."OwnerUserId" WHERE "q"."PostTypeId" = 1 GROUP BY "q"."OwnerUserId" HAVING COUNT("q"."Id") = 1) SELECT COUNT(*) FROM "a"
0.236328
CREATE TABLE customers (customer_id DECIMAL, customer_name TEXT) CREATE TABLE claims (claim_id DECIMAL, fnol_id DECIMAL, effective_date TIME) CREATE TABLE available_policies (policy_id DECIMAL, policy_type_code TEXT, customer_phone TEXT) CREATE TABLE services (service_id DECIMAL, service_name TEXT) CREATE TABLE settlements (settlement_id DECIMAL, claim_id DECIMAL, effective_date TIME, settlement_amount DECIMAL) CREATE TABLE customers_policies (customer_id DECIMAL, policy_id DECIMAL, date_opened TIME, date_closed TIME) CREATE TABLE first_notification_of_loss (fnol_id DECIMAL, customer_id DECIMAL, policy_id DECIMAL, service_id DECIMAL)
Which customer uses the most policies? Give me the customer name.
SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY COUNT(*) DESC LIMIT 1
SELECT "t1"."customer_name" FROM "customers" AS "t1" JOIN "customers_policies" AS "t2" ON "t1"."customer_id" = "t2"."customer_id" GROUP BY "t1"."customer_name" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1
0.196289
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE CloseReasonTypes (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 SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE 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 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 TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId 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 PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
Count number of answer posted in a given year from a user.
SELECT COUNT(*) FROM Posts WHERE OwnerUserId = @UserId AND CreationDate >= '2018/01/01'
SELECT COUNT(*) FROM "Posts" WHERE "CreationDate" >= '2018/01/01' AND "OwnerUserId" = $UserId
0.09082
CREATE TABLE table_name_86 (away_team VARCHAR)
When the away team was collingwood, what was the away team score?
SELECT away_team AS score FROM table_name_86 WHERE away_team = "collingwood"
SELECT "away_team" AS "score" FROM "table_name_86" WHERE "away_team" = "collingwood"
0.082031
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 patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE 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)
did patient 025-44495 have any results from the microbiology of the sputum, tracheal specimen this month?
SELECT COUNT(*) FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-44495')) AND microlab.culturesite = 'sputum, tracheal specimen' AND DATETIME(microlab.culturetakentime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '025-44495' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "microlab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "microlab"."patientunitstayid" WHERE "microlab"."culturesite" = 'sputum, tracheal specimen' AND DATETIME("microlab"."culturetakentime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND NOT "_u_1"."" IS NULL
0.652344
CREATE TABLE table_name_15 (architecture VARCHAR, vehicle_name VARCHAR)
What type of architecture does the Saturn Vue have?
SELECT architecture FROM table_name_15 WHERE vehicle_name = "saturn vue"
SELECT "architecture" FROM "table_name_15" WHERE "saturn vue" = "vehicle_name"
0.076172
CREATE TABLE table_name_38 (built INT, floors VARCHAR, rank VARCHAR)
What is the lowest Built, when Floors is greater than 23, and when Rank is 3?
SELECT MIN(built) FROM table_name_38 WHERE floors > 23 AND rank = 3
SELECT MIN("built") FROM "table_name_38" WHERE "floors" > 23 AND "rank" = 3
0.073242
CREATE TABLE table_name_22 (Highest INT, album_title VARCHAR, sales VARCHAR)
What is the lowest high position for 10 years of hits, and over 870,000 sales?
SELECT MIN(Highest) AS position FROM table_name_22 WHERE album_title = "10 years of hits" AND sales > 870 OFFSET 000
SELECT MIN("Highest") AS "position" FROM "table_name_22" WHERE "10 years of hits" = "album_title" AND "sales" > 870 OFFSET 000
0.123047
CREATE TABLE table_name_8 (drawn INT, played INT)
What is the largest drawn that has a played less than 38?
SELECT MAX(drawn) FROM table_name_8 WHERE played < 38
SELECT MAX("drawn") FROM "table_name_8" WHERE "played" < 38
0.057617
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime 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)
did any hydralazine 20 mg/1 ml 1 ml inj ever been prescribed to patient 021-43538 since 06/2103?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-43538')) AND medication.drugname = 'hydralazine 20 mg/1 ml 1 ml inj' AND STRFTIME('%y-%m', medication.drugstarttime) >= '2103-06'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '021-43538' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "medication" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "medication"."patientunitstayid" WHERE "medication"."drugname" = 'hydralazine 20 mg/1 ml 1 ml inj' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m', "medication"."drugstarttime") >= '2103-06'
0.612305
CREATE TABLE table_59317 ("Date" TEXT, "Time" TEXT, "Opponent#" TEXT, "Rank #" TEXT, "Result" TEXT, "Attendance" TEXT)
What was the result when the opponent was at 2 usc?
SELECT "Result" FROM table_59317 WHERE "Opponent#" = 'at 2 usc'
SELECT "Result" FROM "table_59317" WHERE "Opponent#" = 'at 2 usc'
0.063477
CREATE TABLE table_203_51 (id DECIMAL, "channel" TEXT, "definition" TEXT, "organisation" TEXT, "ownership" TEXT, "notes" TEXT)
whats is the number of channel 's that broadcast in hd ?
SELECT COUNT("channel") FROM table_203_51 WHERE "definition" = 'hd'
SELECT COUNT("channel") FROM "table_203_51" WHERE "definition" = 'hd'
0.067383
CREATE TABLE table_10565 ("Week" TEXT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Kickoff [a ]" TEXT, "Game site" TEXT, "Attendance" TEXT, "Record" TEXT)
Which date did 64,443 people attend a game?
SELECT "Date" FROM table_10565 WHERE "Attendance" = '64,443'
SELECT "Date" FROM "table_10565" WHERE "Attendance" = '64,443'
0.060547
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId 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 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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name 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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount 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 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
new answers from the last 48 hours.
SELECT a.Id AS "post_link", CAST((JULIANDAY(CURRENT_TIMESTAMP()) - JULIANDAY(a.CreationDate)) * 24.0 AS INT) AS "time_difference", a.CreationDate FROM Posts AS a INNER JOIN Posts AS q ON a.ParentId = q.Id WHERE CAST((JULIANDAY(CURRENT_TIMESTAMP()) - JULIANDAY(a.CreationDate)) * 24.0 AS INT) <= 48 ORDER BY a.CreationDate DESC
SELECT "a"."Id" AS "post_link", CAST((JULIANDAY(CURRENT_TIMESTAMP()) - JULIANDAY("a"."CreationDate")) * 24.0 AS INT) AS "time_difference", "a"."CreationDate" FROM "Posts" AS "a" JOIN "Posts" AS "q" ON "a"."ParentId" = "q"."Id" WHERE CAST((JULIANDAY(CURRENT_TIMESTAMP()) - JULIANDAY("a"."CreationDate")) * 24.0 AS INT) <= 48 ORDER BY "a"."CreationDate" DESC NULLS LAST
0.358398
CREATE TABLE table_20325 ("Year" FLOAT, "Matches" FLOAT, "Wins" FLOAT, "Losses" FLOAT, "No Result" FLOAT, "Tied" FLOAT, "Success Rate" TEXT, "Position" TEXT, "Summary" TEXT)
Name the least matches for year 2008
SELECT MIN("Matches") FROM table_20325 WHERE "Year" = '2008'
SELECT MIN("Matches") FROM "table_20325" WHERE "Year" = '2008'
0.060547
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 procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
how many of the patients with opioid type dependence, unspecified were admitted on phys referral/normal deli?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND diagnoses.long_title = "Opioid type dependence, unspecified"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Opioid type dependence, unspecified" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "PHYS REFERRAL/NORMAL DELI" = "demographic"."admission_location"
0.269531
CREATE TABLE table_41893 ("Name" TEXT, "Level" FLOAT, "Digits" FLOAT, "Average size ( square miles ) " TEXT, "Number of HUs ( approximate ) " FLOAT, "Example name" TEXT, "Example code ( HUC ) " FLOAT)
What is the mean huc example code when the example name's lower snake, there are 6 digits, and less than 3 levels?
SELECT AVG("Example code (HUC)") FROM table_41893 WHERE "Example name" = 'lower snake' AND "Digits" = '6' AND "Level" < '3'
SELECT AVG("Example code (HUC)") FROM "table_41893" WHERE "Digits" = '6' AND "Example name" = 'lower snake' AND "Level" < '3'
0.12207
CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) 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 equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) 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 city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) 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 time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) 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 compartment_class (compartment VARCHAR, class_type VARCHAR)
from WASHINGTON to ATLANTA
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'WASHINGTON' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'ATLANTA'
0.49707
CREATE TABLE table_28360 ("Road race" TEXT, "Distance" TEXT, "Location" TEXT, "Country" TEXT, "Month held" TEXT)
In which city was the berlin marathon?
SELECT "Location" FROM table_28360 WHERE "Road race" = 'Berlin Marathon'
SELECT "Location" FROM "table_28360" WHERE "Road race" = 'Berlin Marathon'
0.072266
CREATE TABLE table_62389 ("Position" FLOAT, "Club" TEXT, "Games played" FLOAT, "Wins" FLOAT, "Draws" FLOAT, "Loses" FLOAT, "Goals scored" FLOAT, "Goals conceded" FLOAT, "Points" FLOAT)
What is the total number of Goals scored that has more than 45 Points?
SELECT COUNT("Goals scored") FROM table_62389 WHERE "Points" > '45'
SELECT COUNT("Goals scored") FROM "table_62389" WHERE "Points" > '45'
0.067383
CREATE TABLE table_203_377 (id DECIMAL, "rank" DECIMAL, "nation" TEXT, "gold" DECIMAL, "silver" DECIMAL, "bronze" DECIMAL, "total" DECIMAL)
what was the total number of medals the ivory coast won ?
SELECT "total" FROM table_203_377 WHERE "nation" = 'ivory coast'
SELECT "total" FROM "table_203_377" WHERE "nation" = 'ivory coast'
0.064453
CREATE TABLE Ship (Ship_ID INT, Name TEXT, Type TEXT, Built_Year FLOAT, Class TEXT, Flag TEXT) CREATE TABLE captain (Captain_ID INT, Name TEXT, Ship_ID INT, age TEXT, Class TEXT, Rank TEXT)
What are the different ship flags, and how many ships have each. Show a pie chart.
SELECT Flag, COUNT(*) FROM Ship GROUP BY Flag
SELECT "Flag", COUNT(*) FROM "Ship" GROUP BY "Flag"
0.049805
CREATE TABLE table_38210 ("Character Name" TEXT, "Voice Actor ( Japanese ) " TEXT, "Voice Actor ( English 1997 / Saban ) " TEXT, "Voice Actor ( English 1998 / Pioneer ) " TEXT, "Voice Actor ( English 2006 / FUNimation ) " TEXT)
what character did Masaharu satou play
SELECT "Character Name" FROM table_38210 WHERE "Voice Actor (Japanese)" = 'masaharu satou'
SELECT "Character Name" FROM "table_38210" WHERE "Voice Actor (Japanese)" = 'masaharu satou'
0.089844
CREATE TABLE table_name_81 (founded INT, enrollment VARCHAR)
What is the most recent year founded with an enrollment of 42,708?
SELECT MAX(founded) FROM table_name_81 WHERE enrollment = 42 OFFSET 708
SELECT MAX("founded") FROM "table_name_81" WHERE "enrollment" = 42 OFFSET 708
0.075195
CREATE TABLE table_name_82 (international_mail INT, total_freight_and_mail VARCHAR, year VARCHAR, domestic_freight VARCHAR, domestic_mail VARCHAR)
What is the international mail with the lowest number to have less than 72 domestic freight, 0 domestic mail later than 2012 with total freight and mail more than 4,695?
SELECT MIN(international_mail) FROM table_name_82 WHERE domestic_freight < 72 AND domestic_mail = 0 AND year < 2012 AND total_freight_and_mail > 4 OFFSET 695
SELECT MIN("international_mail") FROM "table_name_82" WHERE "domestic_freight" < 72 AND "domestic_mail" = 0 AND "total_freight_and_mail" > 4 AND "year" < 2012 OFFSET 695
0.165039
CREATE TABLE table_9823 ("Division" TEXT, "1999" FLOAT, "2000" FLOAT, "2001" FLOAT, "2002" FLOAT, "2003" FLOAT, "2004" FLOAT, "2005" FLOAT, "2006" FLOAT, "2007" FLOAT, "2008" FLOAT, "2009" FLOAT, "2010" FLOAT, "2011" FLOAT)
What is the 2010 figure for the district of Columbia where the 2004 figure is more than 12.3?
SELECT SUM("2010") FROM table_9823 WHERE "Division" = 'district of columbia' AND "2004" > '12.3'
SELECT SUM("2010") FROM "table_9823" WHERE "2004" > '12.3' AND "Division" = 'district of columbia'
0.095703
CREATE TABLE table_52678 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Series" TEXT)
Which game has a high rebound of Evans (7) and a high assist of Evans, Ollie (3)?
SELECT MAX("Game") FROM table_52678 WHERE "High rebounds" = 'evans (7)' AND "High assists" = 'evans, ollie (3)'
SELECT MAX("Game") FROM "table_52678" WHERE "High assists" = 'evans, ollie (3)' AND "High rebounds" = 'evans (7)'
0.110352