schema
stringlengths
29
5.42k
question
stringlengths
0
752
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
8.94k
weight
float64
0
8.73
CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB)
Most related, correlated or anticorrelated tags. Calculates the correlation coefficient between all tag pairs. 0 correlation means that the tags are independent from each other. Negative correlation means that having a tag makes unlikely to have the other tag. Positive correlation means that a question tagged with one of them, makes likely to be tagged by the other.
WITH Raw AS (SELECT A.TagId AS TagA, B.TagId AS TagB, COUNT(*) AS Count FROM PostTags AS A, PostTags AS B WHERE A.PostId = B.PostId AND A.TagId != B.TagId GROUP BY A.TagId, B.TagId) SELECT A.TagName AS TagNameA, A.Count AS CountA, B.TagName AS TagNameB, B.Count AS CountB, Raw.Count AS BothCount, (1.0 * Raw.Count * @TotalQ - 1.0 * A.Count * B.Count) / SQRT(1.0 * A.Count * (@TotalQ - A.Count) * B.Count * (@TotalQ - B.Count)) AS Corr FROM Tags AS A, Tags AS B, Raw WHERE Raw.TagA = A.Id AND Raw.TagB = B.Id AND A.Count > 5 AND B.Count > 5 AND A.TagName < B.TagName ORDER BY Corr DESC LIMIT 100
WITH "Raw" AS (SELECT "A"."TagId" AS "TagA", "B"."TagId" AS "TagB", COUNT(*) AS "Count" FROM "PostTags" "A" JOIN "PostTags" "B" ON "A"."PostId" = "B"."PostId" AND "A"."TagId" <> "B"."TagId" GROUP BY "A"."TagId", "B"."TagId") SELECT "A"."TagName" AS "TagNameA", "A"."Count" AS "CountA", "B"."TagName" AS "TagNameB", "B"."Count" AS "CountB", "Raw"."Count" AS "BothCount", (1.0 * "Raw"."Count" * @TotalQ - 1.0 * "A"."Count" * "B"."Count") / NULLIF(SQRT(1.0 * "A"."Count" * (@TotalQ - "A"."Count") * "B"."Count" * (@TotalQ - "B"."Count")), 0) AS "Corr" FROM "Tags" "A" JOIN "Tags" "B" ON "A"."TagName" < "B"."TagName" AND "B"."Count" > 5 JOIN "Raw" ON "A"."Id" = "Raw"."TagA" AND "B"."Id" = "Raw"."TagB" WHERE "A"."Count" > 5 ORDER BY "Corr" DESC FETCH FIRST 100 ROWS ONLY
0.75
CREATE TABLE table_74285 ("#" CLOB, "Player" CLOB, "Country" CLOB, "Score" CLOB, "To par" CLOB, "Winnings ( $ ) " FLOAT, "After" FLOAT, "Before" FLOAT)
What is the player listed when the score is 68-70-68-69=275
SELECT "Player" FROM table_74285 WHERE "Score" = '68-70-68-69=275'
SELECT "Player" FROM "table_74285" WHERE "Score" = '68-70-68-69=275'
0.066406
CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE flight_stop (flight_id NUMBER, stop_number NUMBER, stop_days CLOB, stop_airport CLOB, arrival_time NUMBER, arrival_airline CLOB, arrival_flight_number NUMBER, departure_time NUMBER, departure_airline CLOB, departure_flight_number NUMBER, stop_time NUMBER) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE restriction (restriction_code CLOB, advance_purchase NUMBER, stopovers CLOB, saturday_stay_required CLOB, minimum_stay NUMBER, maximum_stay NUMBER, application CLOB, no_discounts CLOB) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE airport (airport_code VARCHAR2, airport_name CLOB, airport_location CLOB, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2, minimum_connect_time NUMBER) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE aircraft (aircraft_code VARCHAR2, aircraft_description VARCHAR2, manufacturer VARCHAR2, basic_type VARCHAR2, engines NUMBER, propulsion VARCHAR2, wide_body VARCHAR2, wing_span NUMBER, length NUMBER, weight NUMBER, capacity NUMBER, pay_load NUMBER, cruising_speed NUMBER, range_miles NUMBER, pressurized VARCHAR2) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB)
i need a flight from SAN FRANCISCO to 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' 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
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" "AIRPORT_SERVICE_0" JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'SAN FRANCISCO' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'PHILADELPHIA'
0.493164
CREATE TABLE table_52942 ("State ranked in partisan order" CLOB, "Percentage Democrats" CLOB, "Percentage Republicans" CLOB, "Democratic/ Republican" CLOB, "Democratic seat plurality" CLOB)
What is the percent of republicans with 7/6 democrat/republican?
SELECT "Percentage Republicans" FROM table_52942 WHERE "Democratic/ Republican" = '7/6'
SELECT "Percentage Republicans" FROM "table_52942" WHERE "Democratic/ Republican" = '7/6'
0.086914
CREATE TABLE table_10095 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
When the Away team scored 20.15 (135) on the Date of 23 april 1973, how many people were in the crowd?
SELECT "Crowd" FROM table_10095 WHERE "Date" = '23 april 1973' AND "Away team score" = '20.15 (135)'
SELECT "Crowd" FROM "table_10095" WHERE "Away team score" = '20.15 (135)' AND "Date" = '23 april 1973'
0.099609
CREATE TABLE representative (Representative_ID VARCHAR2, Party VARCHAR2) CREATE TABLE election (Votes NUMBER, Representative_ID VARCHAR2)
What is the average number of votes of representatives from party 'Republican'?
SELECT AVG(T1.Votes) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = "Republican"
SELECT AVG("T1"."Votes") FROM "election" "T1" JOIN "representative" "T2" ON "Republican" = "T2"."Party" AND "T1"."Representative_ID" = "T2"."Representative_ID"
0.155273
CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME)
What are the most viewed profiles?.
SELECT Id AS "user_link", Views, Reputation FROM Users WHERE Views > 6000 ORDER BY Views DESC
SELECT "Id" AS "user_link", "Views", "Reputation" FROM "Users" WHERE "Views" > 6000 ORDER BY "Views" DESC
0.102539
CREATE TABLE table_name_42 (mintage NUMBER, animal VARCHAR2, year VARCHAR2)
How many Red Breasted Nuthatch coins created before 2007 were minted, on average?
SELECT AVG(mintage) FROM table_name_42 WHERE animal = "red breasted nuthatch" AND year < 2007
SELECT AVG("mintage") FROM "table_name_42" WHERE "animal" = "red breasted nuthatch" AND "year" < 2007
0.098633
CREATE TABLE table_47821 ("Year" FLOAT, "Date" CLOB, "Winner" CLOB, "Result" CLOB, "Loser" CLOB, "Location" CLOB)
Who was the loser against the New York Giants in 2001?
SELECT "Loser" FROM table_47821 WHERE "Year" = '2001' AND "Winner" = 'new york giants'
SELECT "Loser" FROM "table_47821" WHERE "Winner" = 'new york giants' AND "Year" = '2001'
0.085938
CREATE TABLE table_76660 ("Season" CLOB, "Series" CLOB, "Team Name" CLOB, "Races" CLOB, "Wins" CLOB, "Poles" CLOB, "F.L." CLOB, "Podiums" CLOB, "Points" CLOB, "Position" CLOB)
What is the number of poles with 4 races?
SELECT "Poles" FROM table_76660 WHERE "Races" = '4'
SELECT "Poles" FROM "table_76660" WHERE "Races" = '4'
0.051758
CREATE TABLE table_3897 ("Position" FLOAT, "Driver" CLOB, "Points" FLOAT, "Winnings" CLOB, "Series" CLOB)
how many winnings does jeff gordon have?
SELECT "Winnings" FROM table_3897 WHERE "Driver" = 'Jeff Gordon'
SELECT "Winnings" FROM "table_3897" WHERE "Driver" = 'Jeff Gordon'
0.064453
CREATE TABLE table_72864 ("Fin. Pos" FLOAT, "Car No." FLOAT, "Driver" CLOB, "Team" CLOB, "Laps" FLOAT, "Time/Retired" CLOB, "Grid" FLOAT, "Laps Led" FLOAT, "Points" CLOB)
Name the drive for points being 13
SELECT "Driver" FROM table_72864 WHERE "Points" = '13'
SELECT "Driver" FROM "table_72864" WHERE "Points" = '13'
0.054688
CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME)
what are the five most common diagnosis of patients with age 20s in 2103?
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND STRFTIME('%y', diagnosis.diagnosistime) = '2103' GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 5
WITH "_u_0" AS (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."age" <= 29 AND "patient"."age" >= 20 GROUP BY "patientunitstayid"), "t1" AS (SELECT "diagnosis"."diagnosisname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "diagnosis" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "diagnosis"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y', "diagnosis"."diagnosistime") = '2103' GROUP BY "diagnosis"."diagnosisname") SELECT "t1"."diagnosisname" FROM "t1" "t1" WHERE "t1"."c1" <= 5
0.510742
CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME)
how many prescriptions of methylprednisolone na succ had been issued this year?
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.drug = 'methylprednisolone na succ' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
SELECT COUNT(*) FROM "prescriptions" WHERE "prescriptions"."drug" = 'methylprednisolone na succ' AND DATETIME("prescriptions"."startdate", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
0.205078
CREATE TABLE table_name_54 (country VARCHAR2, place VARCHAR2, player VARCHAR2)
Which country has is Len Mattiace in T10 place?
SELECT country FROM table_name_54 WHERE place = "t10" AND player = "len mattiace"
SELECT "country" FROM "table_name_54" WHERE "len mattiace" = "player" AND "place" = "t10"
0.086914
CREATE TABLE table_7131 ("Television service" CLOB, "Country" CLOB, "Language" CLOB, "Content" CLOB, "HDTV" CLOB, "Package/Option" CLOB)
What is the Language that has sky tg 24 active as the Television service?
SELECT "Language" FROM table_7131 WHERE "Television service" = 'sky tg 24 active'
SELECT "Language" FROM "table_7131" WHERE "Television service" = 'sky tg 24 active'
0.081055
CREATE TABLE table_name_42 (inhabitants VARCHAR2, election VARCHAR2, municipality VARCHAR2)
Which inhabitants have 2009 as the election, with cremona as the municipality?
SELECT inhabitants FROM table_name_42 WHERE election = 2009 AND municipality = "cremona"
SELECT "inhabitants" FROM "table_name_42" WHERE "cremona" = "municipality" AND "election" = 2009
0.09375
CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
what is the minimum total cost of the hospital, which includes the procedure under the name of anti-psychotic agent - haldol since 2105?
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'anti-psychotic agent - haldol')) AND STRFTIME('%y', cost.chargetime) >= '2105' GROUP BY cost.patienthealthsystemstayid) AS t1
WITH "_u_0" AS (SELECT "treatment"."patientunitstayid" FROM "treatment" WHERE "treatment"."treatmentname" = 'anti-psychotic agent - haldol' GROUP BY "patientunitstayid"), "_u_1" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patienthealthsystemstayid"), "t1" AS (SELECT SUM("cost"."cost") AS "c1" FROM "cost" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "cost"."patienthealthsystemstayid" WHERE NOT "_u_1"."" IS NULL AND STRFTIME('%y', "cost"."chargetime") >= '2105' GROUP BY "cost"."patienthealthsystemstayid") SELECT MIN("t1"."c1") FROM "t1" "t1"
0.650391
CREATE TABLE table_204_703 (id NUMBER, "rank" NUMBER, "nation" CLOB, "gold" NUMBER, "silver" NUMBER, "bronze" NUMBER, "total" NUMBER)
what country had the most medals total at the the 1994 winter olympics biathlon ?
SELECT "nation" FROM table_204_703 ORDER BY "total" DESC LIMIT 1
SELECT "nation" FROM "table_204_703" ORDER BY "total" DESC FETCH FIRST 1 ROWS ONLY
0.080078
CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER)
when was patient 015-60616's first diagnosis time during the first hospital encounter for spinal cord injury - with autonomic dysreflexia?
SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-60616' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) AND diagnosis.diagnosisname = 'spinal cord injury - with autonomic dysreflexia' ORDER BY diagnosis.diagnosistime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '015-60616' AND NOT "patient"."hospitaldischargetime" IS NULL GROUP BY "patienthealthsystemstayid" ORDER BY "patient"."hospitaladmittime" FETCH FIRST 1 ROWS ONLY), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "diagnosis"."diagnosistime" FROM "diagnosis" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "diagnosis"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 'spinal cord injury - with autonomic dysreflexia' AND NOT "_u_1"."" IS NULL ORDER BY "diagnosis"."diagnosistime" FETCH FIRST 1 ROWS ONLY
0.745117
CREATE TABLE table_5628 ("Stage" CLOB, "Winner" CLOB, "General classification" CLOB, "Points classification" CLOB, "Mountains classification" CLOB, "Team classification" CLOB)
Which winner has a P stage?
SELECT "Winner" FROM table_5628 WHERE "Stage" = 'p'
SELECT "Winner" FROM "table_5628" WHERE "Stage" = 'p'
0.051758
CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER)
on this hospital visit what was the marital status of patient 55360?
SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 55360 AND admissions.dischtime IS NULL
SELECT "admissions"."marital_status" FROM "admissions" WHERE "admissions"."dischtime" IS NULL AND "admissions"."subject_id" = 55360
0.12793
CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME)
how much is the maximum hospital cost with acute respiratory failure - due to atelectasis until 3 years ago?
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute respiratory failure - due to atelectasis')) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY cost.patienthealthsystemstayid) AS t1
WITH "_u_0" AS (SELECT "diagnosis"."patientunitstayid" FROM "diagnosis" WHERE "diagnosis"."diagnosisname" = 'acute respiratory failure - due to atelectasis' GROUP BY "patientunitstayid"), "_u_1" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patienthealthsystemstayid"), "t1" AS (SELECT SUM("cost"."cost") AS "c1" FROM "cost" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "cost"."patienthealthsystemstayid" WHERE DATETIME("cost"."chargetime") <= DATETIME(CURRENT_TIME(), '-3 year') AND NOT "_u_1"."" IS NULL GROUP BY "cost"."patienthealthsystemstayid") SELECT MAX("t1"."c1") FROM "t1" "t1"
0.689453
CREATE TABLE table_name_29 (years VARCHAR2, representative VARCHAR2)
When was Walter Evans a representative?
SELECT years FROM table_name_29 WHERE representative = "walter evans"
SELECT "years" FROM "table_name_29" WHERE "representative" = "walter evans"
0.073242
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB)
Which patients have been diagnosed with an exceptionally large baby?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Exceptionally large baby"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Exceptionally large baby" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id"
0.189453
CREATE TABLE table_72985 ("Game" FLOAT, "Date" CLOB, "Opponent" CLOB, "Result" CLOB, "Raiders points" FLOAT, "Opponents" FLOAT, "Raiders first downs" FLOAT, "Record" CLOB, "Attendance" FLOAT)
How many different counts of the Raiders first downs are there for the game number 9?
SELECT COUNT("Raiders first downs") FROM table_72985 WHERE "Game" = '9'
SELECT COUNT("Raiders first downs") FROM "table_72985" WHERE "Game" = '9'
0.071289
CREATE TABLE table_28857 ("District" CLOB, "Incumbent" CLOB, "Party" CLOB, "First elected" CLOB, "Result" CLOB, "Candidates" CLOB)
Who was the incumbent when the candidates were John banks (am) 52.2% samuel power (j) 47.8%?
SELECT "Incumbent" FROM table_28857 WHERE "Candidates" = 'John Banks (AM) 52.2% Samuel Power (J) 47.8%'
SELECT "Incumbent" FROM "table_28857" WHERE "Candidates" = 'John Banks (AM) 52.2% Samuel Power (J) 47.8%'
0.102539
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
how many of patients who underwent the procedure titled open reduction of fracture with internal fixation, femur also had the lab test category as blood gas?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Open reduction of fracture with internal fixation, femur" AND lab."CATEGORY" = "Blood Gas"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Blood Gas" = "lab"."CATEGORY" AND "demographic"."hadm_id" = "lab"."hadm_id" JOIN "procedures" ON "Open reduction of fracture with internal fixation, femur" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id"
0.3125
CREATE TABLE table_63491 ("Rank" FLOAT, "Peak" CLOB, "Country" CLOB, "Island" CLOB, "Elevation ( m ) " FLOAT, "Col ( m ) " FLOAT)
What is the elevation of Vanuatu, when the rank is smaller than 3?
SELECT AVG("Elevation (m)") FROM table_63491 WHERE "Country" = 'vanuatu' AND "Rank" < '3'
SELECT AVG("Elevation (m)") FROM "table_63491" WHERE "Country" = 'vanuatu' AND "Rank" < '3'
0.088867
CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE aircraft (aircraft_code VARCHAR2, aircraft_description VARCHAR2, manufacturer VARCHAR2, basic_type VARCHAR2, engines NUMBER, propulsion VARCHAR2, wide_body VARCHAR2, wing_span NUMBER, length NUMBER, weight NUMBER, capacity NUMBER, pay_load NUMBER, cruising_speed NUMBER, range_miles NUMBER, pressurized VARCHAR2) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE airport (airport_code VARCHAR2, airport_name CLOB, airport_location CLOB, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2, minimum_connect_time NUMBER) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE flight_stop (flight_id NUMBER, stop_number NUMBER, stop_days CLOB, stop_airport CLOB, arrival_time NUMBER, arrival_airline CLOB, arrival_flight_number NUMBER, departure_time NUMBER, departure_airline CLOB, departure_flight_number NUMBER, stop_time NUMBER) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE restriction (restriction_code CLOB, advance_purchase NUMBER, stopovers CLOB, saturday_stay_required CLOB, minimum_stay NUMBER, maximum_stay NUMBER, application CLOB, no_discounts CLOB)
in NEW YORK i'll need to RENTAL CAR
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'NEW YORK' AND ground_service.city_code = city.city_code AND ground_service.transport_type = 'RENTAL CAR'
SELECT DISTINCT "ground_service"."transport_type" FROM "city" JOIN "ground_service" ON "city"."city_code" = "ground_service"."city_code" AND "ground_service"."transport_type" = 'RENTAL CAR' WHERE "city"."city_name" = 'NEW YORK'
0.22168
CREATE TABLE table_191105_3 (first_aired NUMBER, performed_by VARCHAR2)
When zachary sanders is the performer what is the lowerst first aired?
SELECT MIN(first_aired) FROM table_191105_3 WHERE performed_by = "Zachary Sanders"
SELECT MIN("first_aired") FROM "table_191105_3" WHERE "Zachary Sanders" = "performed_by"
0.085938
CREATE TABLE table_66257 ("Rank" CLOB, "Nation" CLOB, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
How many gold medals were won by the nation that won over 4 silver medals, over 14 bronze, and 97 medals total?
SELECT COUNT("Gold") FROM table_66257 WHERE "Silver" > '4' AND "Bronze" > '14' AND "Total" = '97'
SELECT COUNT("Gold") FROM "table_66257" WHERE "Bronze" > '14' AND "Silver" > '4' AND "Total" = '97'
0.09668
CREATE TABLE table_name_16 (team_2 VARCHAR2, team_1 VARCHAR2)
What team 2 has lokomotiva as team 1?
SELECT team_2 FROM table_name_16 WHERE team_1 = "lokomotiva"
SELECT "team_2" FROM "table_name_16" WHERE "lokomotiva" = "team_1"
0.064453
CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2)
Is there a 16 -credit upper level class in Summer 2012 ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.credits = 16 AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Summer' AND semester.semester_id = course_offering.semester AND semester.year = 2012
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%ULCS%' JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'Summer' AND "semester"."year" = 2012 WHERE "course"."credits" = 16
0.449219
CREATE TABLE Apartment_Buildings (building_id NUMBER, building_short_name CHAR, building_full_name VARCHAR2, building_description VARCHAR2, building_address VARCHAR2, building_manager VARCHAR2, building_phone VARCHAR2) CREATE TABLE Apartments (apt_id NUMBER, building_id NUMBER, apt_type_code CHAR, apt_number CHAR, bathroom_count NUMBER, bedroom_count NUMBER, room_count CHAR) CREATE TABLE Guests (guest_id NUMBER, gender_code CHAR, guest_first_name VARCHAR2, guest_last_name VARCHAR2, date_of_birth DATETIME) CREATE TABLE Apartment_Bookings (apt_booking_id NUMBER, apt_id NUMBER, guest_id NUMBER, booking_status_code CHAR, booking_start_date DATETIME, booking_end_date DATETIME) CREATE TABLE Apartment_Facilities (apt_id NUMBER, facility_code CHAR) CREATE TABLE View_Unit_Status (apt_id NUMBER, apt_booking_id NUMBER, status_date DATETIME, available_yn BIT)
What is the booking start dates of the apartments with type code 'Duplex'? Bin the year into weekday interval with a bar chart.
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = "Duplex"
SELECT "booking_start_date", COUNT("booking_start_date") FROM "Apartment_Bookings" "T1" JOIN "Apartments" "T2" ON "Duplex" = "T2"."apt_type_code" AND "T1"."apt_id" = "T2"."apt_id"
0.174805
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
what is the gender and primary disease of patient name michael witt?
SELECT demographic.gender, demographic.diagnosis FROM demographic WHERE demographic.name = "Michael Witt"
SELECT "demographic"."gender", "demographic"."diagnosis" FROM "demographic" WHERE "Michael Witt" = "demographic"."name"
0.116211
CREATE TABLE Person (name VARCHAR2, age NUMBER, city CLOB, gender CLOB, job CLOB) CREATE TABLE PersonFriend (name VARCHAR2, friend VARCHAR2, year NUMBER)
What is average age for different job title Visualize by bar chart, I want to display by the job from high to low.
SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY job DESC
SELECT "job", AVG("age") FROM "Person" GROUP BY "job" ORDER BY "job" DESC
0.071289
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB)
how many patients whose diagnoses short title is seroma complicting proc and drug route is both eyes?
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.short_title = "Seroma complicting proc" AND prescriptions.route = "BOTH EYES"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Seroma complicting proc" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "prescriptions" ON "BOTH EYES" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.304688
CREATE TABLE table_203_383 (id NUMBER, "week" NUMBER, "date" CLOB, "opponent" CLOB, "time" CLOB, "game site" CLOB, "tv" CLOB, "result/score" CLOB, "record" CLOB, "bye" CLOB)
how many games started after 4:00 pm edt ?
SELECT COUNT(*) FROM table_203_383 WHERE "time" >= 4
SELECT COUNT(*) FROM "table_203_383" WHERE "time" >= 4
0.052734
CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER)
Question I answered with no accepted answer. Question I answered with no accepted answer
SELECT p2.Id AS QuestionId, P2.Title AS QuestionTitle, COUNT(p3.Id) AS NumberOfAnswer FROM Posts AS p1, Posts AS p2, Posts AS p3 WHERE p1.PostTypeId = 2 AND p1.OwnerUserId = '##UserId##' AND p1.ParentId = p2.Id AND P2.AcceptedAnswerId IS NULL AND p3.ParentId = p2.Id GROUP BY p2.Id, P2.Title ORDER BY NumberOfAnswer DESC
SELECT "p2"."Id" AS "QuestionId", "P2"."Title" AS "QuestionTitle", COUNT("p3"."Id") AS "NumberOfAnswer" FROM "Posts" "p1" JOIN "Posts" "p2" ON "p1"."ParentId" = "p2"."Id" JOIN "Posts" "p3" ON "p2"."Id" = "p3"."ParentId" WHERE "P2"."AcceptedAnswerId" IS NULL AND "p1"."OwnerUserId" = '##UserId##' AND "p1"."PostTypeId" = 2 GROUP BY "p2"."Id", "P2"."Title" ORDER BY "NumberOfAnswer" DESC
0.375977
CREATE TABLE table_1342370_23 (result VARCHAR2, incumbent VARCHAR2)
What was the result of the election featuring william madison whittington?
SELECT result FROM table_1342370_23 WHERE incumbent = "William Madison Whittington"
SELECT "result" FROM "table_1342370_23" WHERE "William Madison Whittington" = "incumbent"
0.086914
CREATE TABLE table_name_83 (frequency_mhz NUMBER, city_of_license VARCHAR2)
What is the average frequency mhz of the loomis, south dakota city license?
SELECT AVG(frequency_mhz) FROM table_name_83 WHERE city_of_license = "loomis, south dakota"
SELECT AVG("frequency_mhz") FROM "table_name_83" WHERE "city_of_license" = "loomis, south dakota"
0.094727
CREATE TABLE table_name_99 (team VARCHAR2, shirt_sponsor VARCHAR2)
What is the name of the team that Tulip Computers NV sponsors?
SELECT team FROM table_name_99 WHERE shirt_sponsor = "tulip computers nv"
SELECT "team" FROM "table_name_99" WHERE "shirt_sponsor" = "tulip computers nv"
0.077148
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB)
how many patients were diagnosed with rheumatoid arthritis and their drug type was base?
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.long_title = "Rheumatoid arthritis" AND prescriptions.drug_type = "BASE"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Rheumatoid arthritis" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "prescriptions" ON "BASE" = "prescriptions"."drug_type" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.299805
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
how many patients whose drug code is warf25 had elective admission type?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND prescriptions.formulary_drug_cd = "WARF25"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "WARF25" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "ELECTIVE" = "demographic"."admission_type"
0.239258
CREATE TABLE table_1949994_7 (premiere_air_dates VARCHAR2, country VARCHAR2)
When did the season located in the Netherlands premier?
SELECT premiere_air_dates FROM table_1949994_7 WHERE country = "The Netherlands"
SELECT "premiere_air_dates" FROM "table_1949994_7" WHERE "The Netherlands" = "country"
0.083984
CREATE TABLE table_name_75 (year_s__won VARCHAR2, total NUMBER)
What years did the player with a total larger than 157 have wins?
SELECT year_s__won FROM table_name_75 WHERE total > 157
SELECT "year_s__won" FROM "table_name_75" WHERE "total" > 157
0.05957
CREATE TABLE table_67522 ("Driver" CLOB, "Constructor" CLOB, "Laps" CLOB, "Time/Retired" CLOB, "Grid" CLOB)
Who was the driver when there were 35 laps?
SELECT "Driver" FROM table_67522 WHERE "Laps" = '35'
SELECT "Driver" FROM "table_67522" WHERE "Laps" = '35'
0.052734
CREATE TABLE table_53155 ("Year" FLOAT, "Winners" CLOB, "Grand Finalist" CLOB, "Scores" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Margin" FLOAT, "Season Result" CLOB)
What's the highest year than hawthorn won with a season result of preliminary finalist and a crowd smaller than 27,407?
SELECT MAX("Year") FROM table_53155 WHERE "Winners" = 'hawthorn' AND "Season Result" = 'preliminary finalist' AND "Crowd" < '27,407'
SELECT MAX("Year") FROM "table_53155" WHERE "Crowd" < '27,407' AND "Season Result" = 'preliminary finalist' AND "Winners" = 'hawthorn'
0.130859
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
what is lab test abnormal status of subject id 6983?
SELECT lab.flag FROM lab WHERE lab.subject_id = "6983"
SELECT "lab"."flag" FROM "lab" WHERE "6983" = "lab"."subject_id"
0.0625
CREATE TABLE table_242813_2 (league VARCHAR2, strikeouts VARCHAR2)
Name the league for strikeouts being 451
SELECT league FROM table_242813_2 WHERE strikeouts = 451
SELECT "league" FROM "table_242813_2" WHERE "strikeouts" = 451
0.060547
CREATE TABLE table_name_83 (avg NUMBER, yards VARCHAR2)
Which largest average had 1229 yards?
SELECT MAX(avg) FROM table_name_83 WHERE yards = 1229
SELECT MAX("avg") FROM "table_name_83" WHERE "yards" = 1229
0.057617
CREATE TABLE table_24825 ("Institution" CLOB, "Location" CLOB, "Enrollment" CLOB, "Athletic nickname" CLOB, "School Colors" CLOB, "Founded" FLOAT)
For the location of quezon city , metro manila what is the athletic nickname?
SELECT "Athletic nickname" FROM table_24825 WHERE "Location" = 'Quezon City , Metro Manila'
SELECT "Athletic nickname" FROM "table_24825" WHERE "Location" = 'Quezon City , Metro Manila'
0.09082
CREATE TABLE table_17289224_1 (poles NUMBER, team_name VARCHAR2)
How many poles did David Price Racing win?
SELECT MAX(poles) FROM table_17289224_1 WHERE team_name = "David Price Racing"
SELECT MAX("poles") FROM "table_17289224_1" WHERE "David Price Racing" = "team_name"
0.082031
CREATE TABLE table_name_90 (discs VARCHAR2, region_1_release VARCHAR2)
What discs has a region 1 release date of January 22, 2008?
SELECT discs FROM table_name_90 WHERE region_1_release = "january 22, 2008"
SELECT "discs" FROM "table_name_90" WHERE "january 22, 2008" = "region_1_release"
0.079102
CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT) CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER)
For those records from the products and each product's manufacturer, visualize a scatter chart about the correlation between code and manufacturer , and group by attribute headquarter.
SELECT T1.Code, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter
SELECT "T1"."Code", "T1"."Manufacturer" FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Headquarter"
0.142578
CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB)
Combined Reputation of Bottom X% of Users. Determines the combined reputation of all users, excluding the specified top percent
WITH Rankings AS (SELECT Id, Reputation, Ranking = ROW_NUMBER() OVER (ORDER BY Reputation DESC) FROM Users), Counts AS (SELECT Count = COUNT(*) FROM Users), RankedUsers AS (SELECT Reputation, CAST(Ranking AS FLOAT(10, 5)) / (SELECT Count FROM Counts) AS Percentile FROM Rankings) SELECT SUM(Reputation) AS "Combined Reputation", COUNT(*) AS "# Users Represented" FROM RankedUsers WHERE Percentile > '##ExcludingTopPercent##' / 100.0
SELECT SUM("Reputation") AS "Combined Reputation", COUNT(*) AS "# Users Represented" FROM "Users" WHERE "Percentile" > '##ExcludingTopPercent##' / NULLIF(100.0, 0)
0.15918
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER) CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and price , and group by attribute headquarter, and could you sort by the Name from low to high?
SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Name
SELECT "T1"."Name", "T1"."Price" FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Headquarter", "T1"."Name" ORDER BY "T1"."Name"
0.168945
CREATE TABLE table_name_7 (away_team VARCHAR2, tie_no VARCHAR2)
who is the away team when the tie no is 7?
SELECT away_team FROM table_name_7 WHERE tie_no = "7"
SELECT "away_team" FROM "table_name_7" WHERE "7" = "tie_no"
0.057617
CREATE TABLE table_name_48 (name VARCHAR2, title VARCHAR2)
What is the name of the queen regnant?
SELECT name FROM table_name_48 WHERE title = "queen regnant"
SELECT "name" FROM "table_name_48" WHERE "queen regnant" = "title"
0.064453
CREATE TABLE keyphrase (keyphraseid NUMBER, keyphrasename VARCHAR2) CREATE TABLE paper (paperid NUMBER, title VARCHAR2, venueid NUMBER, year NUMBER, numciting NUMBER, numcitedby NUMBER, journalid NUMBER) CREATE TABLE journal (journalid NUMBER, journalname VARCHAR2) CREATE TABLE field (fieldid NUMBER) CREATE TABLE dataset (datasetid NUMBER, datasetname VARCHAR2) CREATE TABLE author (authorid NUMBER, authorname VARCHAR2) CREATE TABLE paperdataset (paperid NUMBER, datasetid NUMBER) CREATE TABLE venue (venueid NUMBER, venuename VARCHAR2) CREATE TABLE paperkeyphrase (paperid NUMBER, keyphraseid NUMBER) CREATE TABLE cite (citingpaperid NUMBER, citedpaperid NUMBER) CREATE TABLE writes (paperid NUMBER, authorid NUMBER) CREATE TABLE paperfield (fieldid NUMBER, paperid NUMBER)
Show me IEEE Visualization papers .
SELECT DISTINCT paper.paperid FROM paper, venue WHERE venue.venueid = paper.venueid AND venue.venuename = 'IEEE Visualization'
SELECT DISTINCT "paper"."paperid" FROM "paper" JOIN "venue" ON "paper"."venueid" = "venue"."venueid" AND "venue"."venuename" = 'IEEE Visualization'
0.143555
CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB)
has patient 035-24054 excreted any output (ml)-nephrostomy left during yesterday.
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-24054')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'output (ml)-nephrostomy left' AND DATETIME(intakeoutput.intakeoutputtime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '035-24054' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "intakeoutput" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'output (ml)-nephrostomy left' AND "intakeoutput"."cellpath" LIKE '%output%' AND DATETIME("intakeoutput"."intakeoutputtime", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day') AND NOT "_u_1"."" IS NULL
0.706055
CREATE TABLE table_71469 ("Date" CLOB, "Visitor" CLOB, "Score" CLOB, "Home" CLOB, "Decision" CLOB, "Attendance" FLOAT, "Record" CLOB)
What was the score on December 3 when Detroit was the home team and Legace took the decision?
SELECT "Score" FROM table_71469 WHERE "Home" = 'detroit' AND "Decision" = 'legace' AND "Date" = 'december 3'
SELECT "Score" FROM "table_71469" WHERE "Date" = 'december 3' AND "Decision" = 'legace' AND "Home" = 'detroit'
0.107422
CREATE TABLE table_53943 ("City" CLOB, "Country" CLOB, "Continent" CLOB, "Summer" CLOB, "Winter" CLOB, "Season" CLOB, "Year" FLOAT)
What is the Winter in 1906?
SELECT "Winter" FROM table_53943 WHERE "Year" = '1906'
SELECT "Winter" FROM "table_53943" WHERE "Year" = '1906'
0.054688
CREATE TABLE table_name_10 (replaced_by VARCHAR2, team VARCHAR2)
who is the replacement when the team is milton keynes dons?
SELECT replaced_by FROM table_name_10 WHERE team = "milton keynes dons"
SELECT "replaced_by" FROM "table_name_10" WHERE "milton keynes dons" = "team"
0.075195
CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME)
what was the prescription drug that was prescribed to patient 007-8693 within 2 days after the diagnosis of sedated?
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-8693') AND diagnosis.diagnosisname = 'sedated') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-8693')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t2.drugstarttime) BETWEEN DATETIME(t1.diagnosistime) AND DATETIME(t1.diagnosistime, '+2 day')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '007-8693' GROUP BY "patienthealthsystemstayid"), "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" LEFT JOIN "_u_0" "_u_1" ON "_u_1"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_1"."" IS NULL) SELECT "t2"."drugname" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" JOIN "t2" "t2" ON "diagnosis"."diagnosistime" < "t2"."drugstarttime" AND "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("diagnosis"."diagnosistime") <= DATETIME("t2"."drugstarttime") AND DATETIME("diagnosis"."diagnosistime", '+2 day') >= DATETIME("t2"."drugstarttime") WHERE "diagnosis"."diagnosisname" = 'sedated' AND NOT "_u_0"."" IS NULL
0.978516
CREATE TABLE table_name_10 (nation VARCHAR2, silver VARCHAR2, bronze VARCHAR2, total VARCHAR2)
Which country had 1 Bronze, 1 Silver, with a total of 3 medals?
SELECT nation FROM table_name_10 WHERE bronze = 1 AND total = 3 AND silver = 1
SELECT "nation" FROM "table_name_10" WHERE "bronze" = 1 AND "silver" = 1 AND "total" = 3
0.085938
CREATE TABLE table_74489 ("Conference" CLOB, "# of Bids" FLOAT, "Record" CLOB, "Win %" FLOAT, "Regional Finals" FLOAT)
For the Hockey East conference, what is the total number of win percentages when there are less than 4 bids?
SELECT COUNT("Win %") FROM table_74489 WHERE "Conference" = 'hockey east' AND "# of Bids" < '4'
SELECT COUNT("Win %") FROM "table_74489" WHERE "# of Bids" < '4' AND "Conference" = 'hockey east'
0.094727
CREATE TABLE table_75041 ("Outcome" CLOB, "Event" CLOB, "Year" CLOB, "Venue" CLOB, "Opponent in the final" CLOB)
What Event has an Outcome of other open tournaments?
SELECT "Event" FROM table_75041 WHERE "Outcome" = 'other open tournaments'
SELECT "Event" FROM "table_75041" WHERE "Outcome" = 'other open tournaments'
0.074219
CREATE TABLE table_21907770_4 (date VARCHAR2, versus VARCHAR2)
What are the dates where the versus team is South Africa?
SELECT date FROM table_21907770_4 WHERE versus = "South Africa"
SELECT "date" FROM "table_21907770_4" WHERE "South Africa" = "versus"
0.067383
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
what is minimum age of patients whose discharge location is short term hospital and days of hospital stay is 16?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND demographic.days_stay = "16"
SELECT MIN("demographic"."age") FROM "demographic" WHERE "16" = "demographic"."days_stay" AND "SHORT TERM HOSPITAL" = "demographic"."discharge_location"
0.148438
CREATE TABLE table_4707 ("Tournament" CLOB, "1943" CLOB, "1944" CLOB, "1945" CLOB, "1948" CLOB, "1949" CLOB, "1951" CLOB, "1954" CLOB, "1956\\u20131968" CLOB, "1969" CLOB, "Career SR" CLOB)
What did the Tournament of Australian Championships, with an A in 1969, get in 1954?
SELECT "1954" FROM table_4707 WHERE "1969" = 'a' AND "Tournament" = 'australian championships'
SELECT "1954" FROM "table_4707" WHERE "1969" = 'a' AND "Tournament" = 'australian championships'
0.09375
CREATE TABLE table_12672 ("Mininera DFL" CLOB, "Wins" FLOAT, "Byes" FLOAT, "Losses" FLOAT, "Draws" FLOAT, "Against" FLOAT)
How many wins for the team with more than 1282 against and fewer than 14 losses?
SELECT MIN("Wins") FROM table_12672 WHERE "Against" > '1282' AND "Losses" < '14'
SELECT MIN("Wins") FROM "table_12672" WHERE "Against" > '1282' AND "Losses" < '14'
0.080078
CREATE TABLE table_18130 ("District" CLOB, "Incumbent" CLOB, "Party" CLOB, "First elected" FLOAT, "Results" CLOB, "Candidates" CLOB)
What's the first elected year of the district whose incumbent is Jim Greenwood?
SELECT MAX("First elected") FROM table_18130 WHERE "Incumbent" = 'Jim Greenwood'
SELECT MAX("First elected") FROM "table_18130" WHERE "Incumbent" = 'Jim Greenwood'
0.080078
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
provide the number of patients whose diagnoses short title is sec neuroendo tumor-bone and lab test category is blood gas?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Sec neuroendo tumor-bone" AND lab."CATEGORY" = "Blood Gas"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Sec neuroendo tumor-bone" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "Blood Gas" = "lab"."CATEGORY" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.279297
CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB)
what is the three most frequently prescribed drugs that were prescribed during the same month to the acute respiratory failure - drug related male patients with age 30s after they have been diagnosed with acute respiratory failure - drug related, until 2104?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'acute respiratory failure - drug related' AND STRFTIME('%y', diagnosis.diagnosistime) <= '2104') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.gender = 'male' AND patient.age BETWEEN 30 AND 39 AND STRFTIME('%y', medication.drugstarttime) <= '2104') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.drugstarttime, 'start of month') GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 3
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."age" <= 39 AND "patient"."age" >= 30 AND "patient"."gender" = 'male' WHERE STRFTIME('%y', "medication"."drugstarttime") <= '2104'), "t3" AS (SELECT "t2"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" "t2" ON "diagnosis"."diagnosistime" < "t2"."drugstarttime" AND "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("diagnosis"."diagnosistime", 'start of month') = DATETIME("t2"."drugstarttime", 'start of month') WHERE "diagnosis"."diagnosisname" = 'acute respiratory failure - drug related' AND STRFTIME('%y', "diagnosis"."diagnosistime") <= '2104' GROUP BY "t2"."drugname") SELECT "t3"."drugname" FROM "t3" "t3" WHERE "t3"."c1" <= 3
0.952148
CREATE TABLE table_14407512_24 (nationality VARCHAR2)
Name the 1st m for nor
SELECT 1 AS st__m_ FROM table_14407512_24 WHERE nationality = "NOR"
SELECT 1 AS "st__m_" FROM "table_14407512_24" WHERE "NOR" = "nationality"
0.071289
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER) CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
For those products with a price between 60 and 120, return a bar chart about the distribution of name and price , I want to display bars in asc order.
SELECT Name, Price FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Name
SELECT "Name", "Price" FROM "Products" WHERE "Price" <= 120 AND "Price" >= 60 ORDER BY "Name"
0.09082
CREATE TABLE table_62315 ("Pick" FLOAT, "Player" CLOB, "Team" CLOB, "Position" CLOB, "Hometown/School" CLOB)
What's the highest pick for SS position?
SELECT MAX("Pick") FROM table_62315 WHERE "Position" = 'ss'
SELECT MAX("Pick") FROM "table_62315" WHERE "Position" = 'ss'
0.05957
CREATE TABLE table_43254 ("Season" CLOB, "Staffel A" CLOB, "Staffel B" CLOB, "Staffel C" CLOB, "Staffel D" CLOB, "Staffel E" CLOB)
Which season has a Staffel E of Stahl Riesa?
SELECT "Season" FROM table_43254 WHERE "Staffel E" = 'stahl riesa'
SELECT "Season" FROM "table_43254" WHERE "Staffel E" = 'stahl riesa'
0.066406
CREATE TABLE table_25818630_1 (affiliation VARCHAR2, candidate VARCHAR2)
What is every affiliation for candidate Daren Ireland?
SELECT affiliation FROM table_25818630_1 WHERE candidate = "Daren Ireland"
SELECT "affiliation" FROM "table_25818630_1" WHERE "Daren Ireland" = "candidate"
0.078125
CREATE TABLE Student (StuID NUMBER, LName VARCHAR2, Fname VARCHAR2, Age NUMBER, Sex VARCHAR2, Major NUMBER, Advisor NUMBER, city_code VARCHAR2) CREATE TABLE Allergy_Type (Allergy VARCHAR2, AllergyType VARCHAR2) CREATE TABLE Has_Allergy (StuID NUMBER, Allergy VARCHAR2)
Show all cities and corresponding number of students Plot them as bar chart, and sort x-axis from low to high order.
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY city_code
SELECT "city_code", COUNT(*) FROM "Student" GROUP BY "city_code" ORDER BY "city_code"
0.083008
CREATE TABLE table_4823 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
What is the away team's score when south melbourne is the away team?
SELECT "Away team score" FROM table_4823 WHERE "Away team" = 'south melbourne'
SELECT "Away team score" FROM "table_4823" WHERE "Away team" = 'south melbourne'
0.078125
CREATE TABLE table_15740666_6 (games_played VARCHAR2, kansas_state_vs VARCHAR2)
how many games has kansas state and depaul played against each other
SELECT COUNT(games_played) FROM table_15740666_6 WHERE kansas_state_vs = "DePaul"
SELECT COUNT("games_played") FROM "table_15740666_6" WHERE "DePaul" = "kansas_state_vs"
0.084961
CREATE TABLE university (School_ID NUMBER, School CLOB, Location CLOB, Founded FLOAT, Affiliation CLOB, Enrollment FLOAT, Nickname CLOB, Primary_conference CLOB) CREATE TABLE basketball_match (Team_ID NUMBER, School_ID NUMBER, Team_Name CLOB, ACC_Regular_Season CLOB, ACC_Percent CLOB, ACC_Home CLOB, ACC_Road CLOB, All_Games CLOB, All_Games_Percent NUMBER, All_Home CLOB, All_Road CLOB, All_Neutral CLOB)
Give me the comparison about Team_ID over the ACC_Regular_Season by a bar chart.
SELECT ACC_Regular_Season, Team_ID FROM basketball_match
SELECT "ACC_Regular_Season", "Team_ID" FROM "basketball_match"
0.060547
CREATE TABLE table_73707 ("Model" CLOB, "Launch" CLOB, "Model Number" CLOB, "Code name" CLOB, "Fab ( nm ) " CLOB, "Bus interface" CLOB, "Memory ( MiB ) " CLOB, "Core clock ( MHz ) " CLOB, "Memory clock ( MHz ) " CLOB, "Config core 1" CLOB, "Pixel ( GP /s ) " CLOB, "Texture ( GT /s ) " CLOB, "Bandwidth ( GB /s ) " CLOB, "Bus type" CLOB, "Bus width ( bit ) " CLOB, "DirectX" CLOB, "OpenGL" CLOB, "Processing Power GFLOPs" CLOB, "TDP ( Watts ) GPU only" CLOB, "Features" CLOB)
What is the value for congi core 1 if the code name is Redwood and core clock(mhz) is 500?
SELECT "Config core 1" FROM table_73707 WHERE "Code name" = 'Redwood' AND "Core clock ( MHz )" = '500'
SELECT "Config core 1" FROM "table_73707" WHERE "Code name" = 'Redwood' AND "Core clock ( MHz )" = '500'
0.101563
CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
calculate the three year survival rate of those who were diagnosed with gastric ca.
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'gastric ca' GROUP BY patient.uniquepid HAVING MIN(diagnosis.diagnosistime) = diagnosis.diagnosistime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.diagnosistime) > 3 * 365) AS t2 JOIN patient ON t2.uniquepid = patient.uniquepid
WITH "t1" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 'gastric ca' GROUP BY "patient"."uniquepid" HAVING "diagnosis"."diagnosistime" = MIN("diagnosis"."diagnosistime")) SELECT SUM(CASE WHEN "patient"."hospitaldischargestatus" = 'alive' THEN 1 WHEN STRFTIME('%j', "patient"."hospitaldischargetime") - STRFTIME('%j', "t1"."diagnosistime") > 1095 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) FROM "t1" "t1" JOIN "patient" ON "patient"."uniquepid" = "t1"."uniquepid" WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "t1"."diagnosistime") > 1095
0.683594
CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME)
what was the last output on 12/27/2105 for patient 033-3992?
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 = '033-3992')) AND intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) = '2105-12-27' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '033-3992' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "intakeoutput"."celllabel" FROM "intakeoutput" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."cellpath" LIKE '%output%' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m-%d', "intakeoutput"."intakeoutputtime") = '2105-12-27' ORDER BY "intakeoutput"."intakeoutputtime" DESC FETCH FIRST 1 ROWS ONLY
0.685547
CREATE TABLE table_15590 ("Club" CLOB, "Played" CLOB, "Drawn" CLOB, "Lost" CLOB, "Points for" CLOB, "Points against" CLOB, "Tries for" CLOB, "Tries against" CLOB, "Try bonus" CLOB)
Which of the participating clubs had 73 tries for?
SELECT "Club" FROM table_15590 WHERE "Tries for" = '73'
SELECT "Club" FROM "table_15590" WHERE "Tries for" = '73'
0.055664
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB)
give me the number of patients whose ethnicity is black/cape verdean and diagnoses icd9 code is 7810?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND diagnoses.icd9_code = "7810"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "7810" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "BLACK/CAPE VERDEAN" = "demographic"."ethnicity"
0.222656
CREATE TABLE table_32188 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
What venue did Richmond play as the away team?
SELECT "Venue" FROM table_32188 WHERE "Away team" = 'richmond'
SELECT "Venue" FROM "table_32188" WHERE "Away team" = 'richmond'
0.0625
CREATE TABLE table_name_44 (fis_nordic_world_ski_championships VARCHAR2, winter_olympics VARCHAR2)
Which FIS Nordic World Ski Championships has Winter Olympics of 1960?
SELECT fis_nordic_world_ski_championships FROM table_name_44 WHERE winter_olympics = "1960"
SELECT "fis_nordic_world_ski_championships" FROM "table_name_44" WHERE "1960" = "winter_olympics"
0.094727
CREATE TABLE students (student_id NUMBER, date_of_registration TIME, date_of_latest_logon TIME, login_name CLOB, password CLOB, personal_name CLOB, middle_name CLOB, family_name CLOB) CREATE TABLE student_tests_taken (registration_id NUMBER, date_test_taken TIME, test_result CLOB) CREATE TABLE subjects (subject_id NUMBER, subject_name CLOB) CREATE TABLE courses (course_id NUMBER, author_id NUMBER, subject_id NUMBER, course_name CLOB, course_description CLOB) CREATE TABLE course_authors_and_tutors (author_id NUMBER, author_tutor_atb CLOB, login_name CLOB, password CLOB, personal_name CLOB, middle_name CLOB, family_name CLOB, gender_mf CLOB, address_line_1 CLOB) CREATE TABLE student_course_enrolment (registration_id NUMBER, student_id NUMBER, course_id NUMBER, date_of_enrolment TIME, date_of_completion TIME)
What is the address of each course author or tutor?
SELECT address_line_1 FROM course_authors_and_tutors
SELECT "address_line_1" FROM "course_authors_and_tutors"
0.054688
CREATE TABLE table_67156 ("Date" CLOB, "Opponent" CLOB, "Score" CLOB, "Loss" CLOB, "Attendance" FLOAT, "Record" CLOB)
When the Brewers score was 5-7, what was the lowest attendance?
SELECT MIN("Attendance") FROM table_67156 WHERE "Score" = '5-7'
SELECT MIN("Attendance") FROM "table_67156" WHERE "Score" = '5-7'
0.063477
CREATE TABLE Student (StuID NUMBER, LName VARCHAR2, Fname VARCHAR2, Age NUMBER, Sex VARCHAR2, Major NUMBER, Advisor NUMBER, city_code VARCHAR2) CREATE TABLE Lives_in (stuid NUMBER, dormid NUMBER, room_number NUMBER) CREATE TABLE Has_amenity (dormid NUMBER, amenid NUMBER) CREATE TABLE Dorm (dormid NUMBER, dorm_name VARCHAR2, student_capacity NUMBER, gender VARCHAR2) CREATE TABLE Dorm_amenity (amenid NUMBER, amenity_name VARCHAR2)
Find the first name of students who are living in the Smith Hall, and count them by a pie chart
SELECT Fname, COUNT(Fname) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' GROUP BY Fname
SELECT "Fname", COUNT("Fname") FROM "Student" "T1" JOIN "Lives_in" "T2" ON "T1"."stuid" = "T2"."stuid" JOIN "Dorm" "T3" ON "T2"."dormid" = "T3"."dormid" AND "T3"."dorm_name" = 'Smith Hall' GROUP BY "Fname"
0.200195
CREATE TABLE table_1770 ("Parish ( Prestegjeld ) " CLOB, "Sub-Parish ( Sogn ) " CLOB, "Church Name" CLOB, "Year Built" FLOAT, "Location of the Church" CLOB)
What is the church name for the church located in Kyrkjeb ?
SELECT "Church Name" FROM table_1770 WHERE "Location of the Church" = 'Kyrkjebø'
SELECT "Church Name" FROM "table_1770" WHERE "Location of the Church" = 'Kyrkjebø'
0.080078
CREATE TABLE table_18335117_5 (no_in_series NUMBER, no_overall VARCHAR2)
Name the number in series for number 38
SELECT MIN(no_in_series) FROM table_18335117_5 WHERE no_overall = 38
SELECT MIN("no_in_series") FROM "table_18335117_5" WHERE "no_overall" = 38
0.072266
CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
give me the number of patients whose admission type is urgent and drug name is aspirin?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "URGENT" AND prescriptions.drug = "Aspirin"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Aspirin" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "URGENT" = "demographic"."admission_type"
0.225586
CREATE TABLE table_21206 ("Episode number Production number" CLOB, "Title" CLOB, "Sydney" FLOAT, "Melbourne" FLOAT, "Brisbane" FLOAT, "Adelaide" FLOAT, "Perth" FLOAT, "TOTAL" FLOAT, "WEEKLY RANK" CLOB, "NIGHTLY RANK" CLOB)
what is the number of weekly rank where the total is 1980000?
SELECT COUNT("WEEKLY RANK") FROM table_21206 WHERE "TOTAL" = '1980000'
SELECT COUNT("WEEKLY RANK") FROM "table_21206" WHERE "TOTAL" = '1980000'
0.070313
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB)
provide me the drug code for nitroglycerin sl.
SELECT prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.drug = "Nitroglycerin SL"
SELECT "prescriptions"."formulary_drug_cd" FROM "prescriptions" WHERE "Nitroglycerin SL" = "prescriptions"."drug"
0.110352