schema
stringlengths
29
5.42k
question
stringlengths
0
752
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
8.94k
weight
float64
0
8.73
CREATE TABLE table_203_788 (id NUMBER, "year" NUMBER, "author" CLOB, "illustrator" CLOB, "title" CLOB, "publisher" CLOB)
how many total titles were published by walker ?
SELECT COUNT("author") FROM table_203_788 WHERE "publisher" = 'walker'
SELECT COUNT("author") FROM "table_203_788" WHERE "publisher" = 'walker'
0.070313
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 FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId 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 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 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 VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE ReviewTaskStates (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 Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) 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 PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name 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 CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId 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 ReviewTaskResultTypes (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)
Get posts count time series by the tag.
SELECT DATEFROMPARTS(YEAR(P.CreationDate), MONTH(P.CreationDate), 1) AS PostMonth, COUNT(*) AS TagCount FROM Posts AS P WHERE PostTypeId = 1 AND P.Tags LIKE @TagName GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY PostMonth
SELECT DATE_FROM_PARTS(YEAR("P"."CreationDate"), MONTH("P"."CreationDate"), 1) AS "PostMonth", COUNT(*) AS "TagCount" FROM "Posts" "P" WHERE "P"."Tags" LIKE @TagName AND "PostTypeId" = 1 GROUP BY YEAR("P"."CreationDate"), MONTH("P"."CreationDate") ORDER BY "PostMonth"
0.261719
CREATE TABLE table_name_23 (money___ NUMBER, score VARCHAR2)
How much was paid to the player whose score was 70-71-77-76=294?
SELECT SUM(money___) AS $__ FROM table_name_23 WHERE score = 70 - 71 - 77 - 76 = 294
SELECT SUM("money___") AS "$__" FROM "table_name_23" WHERE "score" = FALSE
0.072266
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 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 d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto 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 microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name 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 patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 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 chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER)
what was the monthly minimum value of weight for patient 2874 until 16 months ago?
SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2874)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime) <= DATETIME(CURRENT_TIME(), '-16 month') GROUP BY STRFTIME('%y-%m', chartevents.charttime)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 2874 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'admit wt' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT MIN("chartevents"."valuenum") FROM "chartevents" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE DATETIME("chartevents"."charttime") <= DATETIME(CURRENT_TIME(), '-16 month') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL GROUP BY STRFTIME('%y-%m', "chartevents"."charttime")
0.794922
CREATE TABLE table_203_645 (id NUMBER, "lower mississippi periods" CLOB, "lower yazoo phases" CLOB, "lower yazoo\ dates" CLOB, "tensas/natchez phases" CLOB, "cahokia phases" CLOB, "cahokia dates" CLOB, "ohio/miss. river\ confluence phases" CLOB, "ohio/miss. dates" CLOB)
how many lower yazoo phases are there ?
SELECT COUNT(DISTINCT "lower yazoo phases") FROM table_203_645
SELECT COUNT(DISTINCT "lower yazoo phases") FROM "table_203_645"
0.0625
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)
what is the number of patients whose primary disease is rash and drug route is tp?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "RASH" AND prescriptions.route = "TP"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "TP" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "RASH" = "demographic"."diagnosis"
0.214844
CREATE TABLE table_61093 ("Place" CLOB, "Player" CLOB, "Country" CLOB, "Score" CLOB, "To par" CLOB, "Money ( $ ) " FLOAT)
Which player had a score of 71-73-68-75=287?
SELECT "Player" FROM table_61093 WHERE "Score" = '71-73-68-75=287'
SELECT "Player" FROM "table_61093" WHERE "Score" = '71-73-68-75=287'
0.066406
CREATE TABLE table_68730 ("Event" CLOB, "Time" CLOB, "Venue" CLOB, "Date" CLOB, "Notes" CLOB)
For a venue of Rome on July 30, 2009, what are the notes?
SELECT "Notes" FROM table_68730 WHERE "Venue" = 'rome' AND "Date" = 'july 30, 2009'
SELECT "Notes" FROM "table_68730" WHERE "Date" = 'july 30, 2009' AND "Venue" = 'rome'
0.083008
CREATE TABLE table_80087 ("Date" CLOB, "Opponent" CLOB, "Score" CLOB, "Loss" CLOB, "Record" CLOB)
Name the loss for record of 71-81
SELECT "Loss" FROM table_80087 WHERE "Record" = '71-81'
SELECT "Loss" FROM "table_80087" WHERE "Record" = '71-81'
0.055664
CREATE TABLE table_67268 ("Title" CLOB, "Studio" CLOB, "Role" CLOB, "Leading lady" CLOB, "Director" CLOB)
What role did John Wayne play with Verna Hillie as the leading lady?
SELECT "Role" FROM table_67268 WHERE "Leading lady" = 'verna hillie'
SELECT "Role" FROM "table_67268" WHERE "Leading lady" = 'verna hillie'
0.068359
CREATE TABLE table_14871601_2 (losses NUMBER, scored VARCHAR2)
What was the number of losses when the scored value was 25?
SELECT MAX(losses) FROM table_14871601_2 WHERE scored = 25
SELECT MAX("losses") FROM "table_14871601_2" WHERE "scored" = 25
0.0625
CREATE TABLE Rating (rID NUMBER, mID NUMBER, stars NUMBER, ratingDate DATE) CREATE TABLE Movie (mID NUMBER, title CLOB, year NUMBER, director CLOB) CREATE TABLE Reviewer (rID NUMBER, name CLOB)
Visualize the average smallest rating of different movie title using a bar chart.
SELECT T2.title, AVG(MIN(T1.stars)) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.title
SELECT "T2"."title", AVG(MIN("T1"."stars")) FROM "Rating" "T1" JOIN "Movie" "T2" ON "T1"."mID" = "T2"."mID" GROUP BY "T2"."title"
0.125977
CREATE TABLE table_name_71 (date VARCHAR2, where_sunk VARCHAR2, ship_type VARCHAR2)
What is the date that a hell ship sunk in the East China Sea?
SELECT date FROM table_name_71 WHERE where_sunk = "east china sea" AND ship_type = "hell ship"
SELECT "date" FROM "table_name_71" WHERE "east china sea" = "where_sunk" AND "hell ship" = "ship_type"
0.099609
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 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 ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE ReviewTaskResultTypes (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 CloseReasonTypes (Id NUMBER, Name CLOB, Description 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 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 ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange 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 PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostTypes (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 PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB)
Percent of my answers accepted.
SELECT (CAST(COUNT(a.Id) AS FLOAT) / (SELECT COUNT(*) FROM Posts WHERE OwnerUserId = 681865 AND PostTypeId = 2) * 100) AS AcceptedPercentage FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE a.OwnerUserId = 1179880 AND a.PostTypeId = 2
WITH "_u_0" AS (SELECT COUNT(*), 681865 AS "_u_1", 2 AS "_u_2" FROM "Posts" GROUP BY 681865, 2) SELECT CAST(COUNT("a"."Id") AS FLOAT) / NULLIF(COALESCE("_u_0"."", *), 0) * 100 AS "AcceptedPercentage" FROM "Posts" "q" LEFT JOIN "_u_0" "_u_0" ON "OwnerUserId" = "_u_0"."_u_1" AND "PostTypeId" = "_u_0"."_u_2" JOIN "Posts" "a" ON "a"."Id" = "q"."AcceptedAnswerId" AND "a"."OwnerUserId" = 1179880 AND "a"."PostTypeId" = 2
0.407227
CREATE TABLE table_name_82 (away_team VARCHAR2, home_team VARCHAR2)
Who is the away team that played home team Perth Wildcats?
SELECT away_team FROM table_name_82 WHERE home_team = "perth wildcats"
SELECT "away_team" FROM "table_name_82" WHERE "home_team" = "perth wildcats"
0.074219
CREATE TABLE table_16585 ("Country" CLOB, "Carbon dioxide emissions per year ( 10 6 Tons ) ( 2006 ) " FLOAT, "Percentage of global total" CLOB, "Avg. emission per km 2 of its land ( tons ) " FLOAT, "Carbon dioxide emissions per year ( Tons per person ) ( 2007 ) " CLOB)
HOW MUCH IS THE PERCENTAGE OF GLOBAL TOTAL EMISSIONS IN THE COUNTRY THAT PRODUCED 4.9 TONS PER PERSON IN 2007?
SELECT "Percentage of global total" FROM table_16585 WHERE "Carbon dioxide emissions per year (Tons per person) (2007)" = '4.9'
SELECT "Percentage of global total" FROM "table_16585" WHERE "Carbon dioxide emissions per year (Tons per person) (2007)" = '4.9'
0.125977
CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) 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 treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime 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 microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME)
what are the four most frequent laboratory tests ordered for patients within 2 months after receiving antihypertensive drug - nicardipine?
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antihypertensive drug - nicardipine') AS t1 JOIN (SELECT patient.uniquepid, lab.labname, lab.labresulttime FROM lab JOIN patient ON lab.patientunitstayid = patient.patientunitstayid) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.labresulttime AND DATETIME(t2.labresulttime) BETWEEN DATETIME(t1.treatmenttime) AND DATETIME(t1.treatmenttime, '+2 month') GROUP BY t2.labname) AS t3 WHERE t3.c1 <= 4
WITH "t2" AS (SELECT "patient"."uniquepid", "lab"."labname", "lab"."labresulttime" FROM "lab" JOIN "patient" ON "lab"."patientunitstayid" = "patient"."patientunitstayid"), "t3" AS (SELECT "t2"."labname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" JOIN "t2" "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND "t2"."labresulttime" > "treatment"."treatmenttime" AND DATETIME("t2"."labresulttime") <= DATETIME("treatment"."treatmenttime", '+2 month') AND DATETIME("t2"."labresulttime") >= DATETIME("treatment"."treatmenttime") WHERE "treatment"."treatmentname" = 'antihypertensive drug - nicardipine' GROUP BY "t2"."labname") SELECT "t3"."labname" FROM "t3" "t3" WHERE "t3"."c1" <= 4
0.769531
CREATE TABLE products (product_id NUMBER, product_type_code CLOB, product_name CLOB, product_price NUMBER) CREATE TABLE order_items (order_item_id NUMBER, order_id NUMBER, product_id NUMBER) CREATE TABLE department_store_chain (dept_store_chain_id NUMBER, dept_store_chain_name CLOB) CREATE TABLE addresses (address_id NUMBER, address_details CLOB) CREATE TABLE customers (customer_id NUMBER, payment_method_code CLOB, customer_code CLOB, customer_name CLOB, customer_address CLOB, customer_phone CLOB, customer_email CLOB) CREATE TABLE product_suppliers (product_id NUMBER, supplier_id NUMBER, date_supplied_from TIME, date_supplied_to TIME, total_amount_purchased CLOB, total_value_purchased NUMBER) CREATE TABLE customer_addresses (customer_id NUMBER, address_id NUMBER, date_from TIME, date_to TIME) CREATE TABLE customer_orders (order_id NUMBER, customer_id NUMBER, order_status_code CLOB, order_date TIME) CREATE TABLE departments (department_id NUMBER, dept_store_id NUMBER, department_name CLOB) CREATE TABLE staff_department_assignments (staff_id NUMBER, department_id NUMBER, date_assigned_from TIME, job_title_code CLOB, date_assigned_to TIME) CREATE TABLE department_stores (dept_store_id NUMBER, dept_store_chain_id NUMBER, store_name CLOB, store_address CLOB, store_phone CLOB, store_email CLOB) CREATE TABLE supplier_addresses (supplier_id NUMBER, address_id NUMBER, date_from TIME, date_to TIME) CREATE TABLE staff (staff_id NUMBER, staff_gender CLOB, staff_name CLOB) CREATE TABLE suppliers (supplier_id NUMBER, supplier_name CLOB, supplier_phone CLOB)
Return the distinct name of customers whose order status is Pending, in the order of customer id.
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending" ORDER BY T2.customer_id
SELECT DISTINCT "T1"."customer_name" FROM "customers" "T1" JOIN "customer_orders" "T2" ON "Pending" = "T2"."order_status_code" AND "T1"."customer_id" = "T2"."customer_id" ORDER BY "T2"."customer_id"
0.193359
CREATE TABLE table_train_174 ("id" NUMBER, "fasting_plasma_glucose_fpg" FLOAT, "hemoglobin_a1c_hba1c" FLOAT, "substance_dependence" BOOLEAN, "estimated_glomerular_filtration_rate_egfr" NUMBER, "allergy_to_insulin_lispro" BOOLEAN, "urine_albumin_to_creatinine_ratio_uacr" NUMBER, "smoking" BOOLEAN, "NOUSE" FLOAT)
have known allergies or history of hypersensitivity to insulin lispro
SELECT * FROM table_train_174 WHERE allergy_to_insulin_lispro = 1
SELECT * FROM "table_train_174" WHERE "allergy_to_insulin_lispro" = 1
0.067383
CREATE TABLE table_name_62 (date VARCHAR2, visiting_team VARCHAR2)
When were the Cleveland Browns the visiting team?
SELECT date FROM table_name_62 WHERE visiting_team = "cleveland browns"
SELECT "date" FROM "table_name_62" WHERE "cleveland browns" = "visiting_team"
0.075195
CREATE TABLE table_name_5 (conference_joined VARCHAR2, city VARCHAR2)
What conference did the city of Valparaiso join?
SELECT conference_joined FROM table_name_5 WHERE city = "valparaiso"
SELECT "conference_joined" FROM "table_name_5" WHERE "city" = "valparaiso"
0.072266
CREATE TABLE table_3438 ("Stage" FLOAT, "Winner" CLOB, "General Classification" CLOB, "Mountains Classification" CLOB, "Sprint Classification" CLOB, "Team Classification" CLOB)
What is the earliest stage where mountains classifications was awarded to Peter Stetina?
SELECT MIN("Stage") FROM table_3438 WHERE "Mountains Classification" = 'Peter Stetina'
SELECT MIN("Stage") FROM "table_3438" WHERE "Mountains Classification" = 'Peter Stetina'
0.085938
CREATE TABLE table_38365 ("State" CLOB, "Revenue ( millions ) " CLOB, "Population" FLOAT, "Revenue per capita" CLOB, "Spending ( millions ) " CLOB, "Spending per capita" CLOB, "Net contribution per capita" CLOB)
What is the Revenue of the population of more than 1,499,402, with Spending (millions) of $13,986?
SELECT "Revenue (millions)" FROM table_38365 WHERE "Population" > '1,499,402' AND "Spending (millions)" = '$13,986'
SELECT "Revenue (millions)" FROM "table_38365" WHERE "Population" > '1,499,402' AND "Spending (millions)" = '$13,986'
0.114258
CREATE TABLE table_name_70 (pct NUMBER, wins VARCHAR2, name VARCHAR2)
Which percent has Wins larger than 72, and a Name of john yovicsin?
SELECT SUM(pct) FROM table_name_70 WHERE wins > 72 AND name = "john yovicsin"
SELECT SUM("pct") FROM "table_name_70" WHERE "john yovicsin" = "name" AND "wins" > 72
0.083008
CREATE TABLE table_31106 ("Rank 2011" FLOAT, "Country" CLOB, "Production in 2011 ( 1 , 000 ton ) " FLOAT, "Share 2011" CLOB, "Rank 2010" FLOAT, "Production in 2010 ( 1 , 000 ton ) " FLOAT)
When indonesia is the country what is the rank of 2010?
SELECT "Rank 2010" FROM table_31106 WHERE "Country" = 'Indonesia'
SELECT "Rank 2010" FROM "table_31106" WHERE "Country" = 'Indonesia'
0.06543
CREATE TABLE table_47365 ("Date" CLOB, "Visitor" CLOB, "Score" CLOB, "Home" CLOB, "Attendance" FLOAT, "Record" CLOB, "Points" FLOAT)
What is the sum of Points, when Home is 'Pittsburgh', when Date is 'December 21', and when Attendance is greater than 5,307?
SELECT SUM("Points") FROM table_47365 WHERE "Home" = 'pittsburgh' AND "Date" = 'december 21' AND "Attendance" > '5,307'
SELECT SUM("Points") FROM "table_47365" WHERE "Attendance" > '5,307' AND "Date" = 'december 21' AND "Home" = 'pittsburgh'
0.118164
CREATE TABLE table_name_88 (surface VARCHAR2, partner VARCHAR2)
The tournament with a partner listed as Aurelija Misevi i t had what kind of surface?
SELECT surface FROM table_name_88 WHERE partner = "aurelija misevičiūtė"
SELECT "surface" FROM "table_name_88" WHERE "aurelija misevičiūtė" = "partner"
0.076172
CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) 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 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 inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label 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 chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom 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 d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER)
what are patient 12775's genders?
SELECT patients.gender FROM patients WHERE patients.subject_id = 12775
SELECT "patients"."gender" FROM "patients" WHERE "patients"."subject_id" = 12775
0.078125
CREATE TABLE table_1526 ("Club" CLOB, "Played" CLOB, "Won" CLOB, "Drawn" CLOB, "Lost" CLOB, "Points for" CLOB, "Points against" CLOB, "Points difference" CLOB, "Points" CLOB)
What is the total points when the point difference is +119?
SELECT "Points" FROM table_1526 WHERE "Points difference" = '+119'
SELECT "Points" FROM "table_1526" WHERE "Points difference" = '+119'
0.066406
CREATE TABLE table_32123 ("Driver" CLOB, "Constructor" CLOB, "Laps" FLOAT, "Time/Retired" CLOB, "Grid" FLOAT)
Which driver drove a Ferrari in the 2007 European Grand Prix with a grid less than 3?
SELECT "Driver" FROM table_32123 WHERE "Constructor" = 'ferrari' AND "Grid" < '3'
SELECT "Driver" FROM "table_32123" WHERE "Constructor" = 'ferrari' AND "Grid" < '3'
0.081055
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 inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom 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 d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE d_icd_diagnoses (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 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 procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE diagnoses_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 cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label 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 outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB)
what are the drugs that are added to patient 99883 today compared with the ones yesterday?
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99883) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99883) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 99883 GROUP BY "hadm_id") SELECT "prescriptions"."drug" FROM "prescriptions" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE DATETIME("prescriptions"."startdate", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') AND NOT "_u_0"."" IS NULL EXCEPT SELECT "prescriptions"."drug" FROM "prescriptions" LEFT JOIN "_u_0" "_u_1" ON "_u_1"."" = "prescriptions"."hadm_id" WHERE DATETIME("prescriptions"."startdate", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day') AND NOT "_u_1"."" IS NULL
0.625
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 dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) 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 ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare 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) 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 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 days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time 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 equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2)
are there any flights after 2100 from SAN FRANCISCO to WASHINGTON
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.departure_time > 2100 AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.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" AND "flight"."departure_time" > 2100 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" = 'WASHINGTON'
0.527344
CREATE TABLE table_name_60 (pick__number NUMBER, position VARCHAR2, overall VARCHAR2)
What is the highest Pick that is wide receiver with overall of 29?
SELECT MAX(pick__number) FROM table_name_60 WHERE position = "wide receiver" AND overall = 29
SELECT MAX("pick__number") FROM "table_name_60" WHERE "overall" = 29 AND "position" = "wide receiver"
0.098633
CREATE TABLE table_203_824 (id NUMBER, "pick #" NUMBER, "player" CLOB, "position" CLOB, "nationality" CLOB, "nhl team" CLOB, "college/junior/club team" CLOB)
which player was the only one drafted from finland ?
SELECT "player" FROM table_203_824 WHERE "nationality" = 'finland'
SELECT "player" FROM "table_203_824" WHERE "nationality" = 'finland'
0.066406
CREATE TABLE table_name_50 (points NUMBER, attendance VARCHAR2)
What is the lowest number of points scored when there were 1,500 in attendance?
SELECT MIN(points) FROM table_name_50 WHERE attendance = "1,500"
SELECT MIN("points") FROM "table_name_50" WHERE "1,500" = "attendance"
0.068359
CREATE TABLE table_name_50 (year VARCHAR2, publisher VARCHAR2)
Name the year when the publisher was argonaut games sierra entertainment
SELECT year FROM table_name_50 WHERE publisher = "argonaut games sierra entertainment"
SELECT "year" FROM "table_name_50" WHERE "argonaut games sierra entertainment" = "publisher"
0.089844
CREATE TABLE table_name_62 (score VARCHAR2, money___$__ VARCHAR2)
What's the score for $22,500?
SELECT score FROM table_name_62 WHERE money___$__ = "22,500"
SELECT "score" FROM "table_name_62" WHERE "22,500" = "money___$__"
0.064453
CREATE TABLE table_name_25 (points_for_higher NUMBER, points_for_foundation VARCHAR2, points_for_ordinary VARCHAR2, grade VARCHAR2)
What average points for highers has 0 has points for ordinary, and Ng as the grade, and less than 0 as points for foundation?
SELECT AVG(points_for_higher) FROM table_name_25 WHERE points_for_ordinary = 0 AND grade = "ng" AND points_for_foundation < 0
SELECT AVG("points_for_higher") FROM "table_name_25" WHERE "grade" = "ng" AND "points_for_foundation" < 0 AND "points_for_ordinary" = 0
0.131836
CREATE TABLE table_2590 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" CLOB, "Directed by" CLOB, "Written by" CLOB, "Original air date" CLOB, "Production code" CLOB)
How many season numbers are there for the episodes written by Art Everett?
SELECT COUNT("No. in season") FROM table_2590 WHERE "Written by" = 'Art Everett'
SELECT COUNT("No. in season") FROM "table_2590" WHERE "Written by" = 'Art Everett'
0.080078
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 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 intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) 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 microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME)
what is the number of times that patient 031-11804 had had urine count since 08/2105?
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-11804')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'urine count' AND STRFTIME('%y-%m', intakeoutput.intakeoutputtime) >= '2105-08'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '031-11804' 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(*) FROM "intakeoutput" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'urine count' AND "intakeoutput"."cellpath" LIKE '%output%' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m', "intakeoutput"."intakeoutputtime") >= '2105-08'
0.639648
CREATE TABLE table_203_655 (id NUMBER, "goal" NUMBER, "date" CLOB, "venue" CLOB, "opponent" CLOB, "score" CLOB, "result" CLOB, "competition" CLOB)
what was the number of goals scored against faroe islands ?
SELECT "score" FROM table_203_655 WHERE "opponent" = 'faroe islands'
SELECT "score" FROM "table_203_655" WHERE "opponent" = 'faroe islands'
0.068359
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE 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)
what is drug route of drug name ascorbic acid?
SELECT prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Ascorbic Acid"
SELECT "prescriptions"."route" FROM "prescriptions" WHERE "Ascorbic Acid" = "prescriptions"."drug"
0.095703
CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description 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 PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE ReviewTaskStates (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 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 Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE FlagTypes (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 PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, 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 ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name 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 SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId 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 Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER)
Get all questions and answerers from tag.
SELECT p.Id, p.CreationDate, p.Score, p.ViewCount, p.Title, p.AnswerCount, p.CommentCount, p.FavoriteCount, u.DisplayName AS quest_name, u.Reputation AS quest_rep, u2.DisplayName AS ans_name, u2.Reputation AS ans_rep FROM Posts AS p JOIN PostTags AS pt ON p.Id = pt.PostId JOIN Tags AS t ON pt.TagId = t.Id LEFT JOIN Posts AS ans ON p.AcceptedAnswerId = ans.Id LEFT JOIN Users AS u ON p.OwnerUserId = u.Id LEFT JOIN Users AS u2 ON ans.OwnerUserId = u2.Id WHERE t.TagName = 'pandas' AND p.CreationDate <= '2020'
SELECT "p"."Id", "p"."CreationDate", "p"."Score", "p"."ViewCount", "p"."Title", "p"."AnswerCount", "p"."CommentCount", "p"."FavoriteCount", "u"."DisplayName" AS "quest_name", "u"."Reputation" AS "quest_rep", "u2"."DisplayName" AS "ans_name", "u2"."Reputation" AS "ans_rep" FROM "Posts" "p" LEFT JOIN "Posts" "ans" ON "ans"."Id" = "p"."AcceptedAnswerId" JOIN "PostTags" "pt" ON "p"."Id" = "pt"."PostId" LEFT JOIN "Users" "u" ON "p"."OwnerUserId" = "u"."Id" JOIN "Tags" "t" ON "pt"."TagId" = "t"."Id" AND "t"."TagName" = 'pandas' LEFT JOIN "Users" "u2" ON "ans"."OwnerUserId" = "u2"."Id" WHERE "p"."CreationDate" <= '2020'
0.605469
CREATE TABLE table_78761 ("Tie no" FLOAT, "Home team" CLOB, "Score" CLOB, "Away team" CLOB, "Attendance" FLOAT)
What was the score for home team AFC Hornchurch?
SELECT "Score" FROM table_78761 WHERE "Home team" = 'afc hornchurch'
SELECT "Score" FROM "table_78761" WHERE "Home team" = 'afc hornchurch'
0.068359
CREATE TABLE Payments (Payment_ID NUMBER, Settlement_ID NUMBER, Payment_Method_Code VARCHAR2, Date_Payment_Made DATE, Amount_Payment NUMBER) CREATE TABLE Settlements (Settlement_ID NUMBER, Claim_ID NUMBER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed NUMBER, Amount_Settled NUMBER, Customer_Policy_ID NUMBER) CREATE TABLE Claims (Claim_ID NUMBER, Policy_ID NUMBER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed NUMBER, Amount_Settled NUMBER) CREATE TABLE Customers (Customer_ID NUMBER, Customer_Details VARCHAR2) CREATE TABLE Customer_Policies (Policy_ID NUMBER, Customer_ID NUMBER, Policy_Type_Code CHAR, Start_Date DATE, End_Date DATE)
For those payments processed with Visa, bin the payment day into Year interval and compute the total amount payment as the Y-axis.
SELECT Date_Payment_Made, SUM(Amount_Payment) FROM Payments WHERE Payment_Method_Code = 'Visa'
SELECT "Date_Payment_Made", SUM("Amount_Payment") FROM "Payments" WHERE "Payment_Method_Code" = 'Visa'
0.099609
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 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 ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE FlagTypes (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 Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) 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 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 ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId 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 ReviewTaskStates (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 PostTypes (Id NUMBER, Name CLOB) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) 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 TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER)
Tags with highest percentage of accepted answer rate.
SELECT Tags.TagName, COUNT(*) AS NumQuestions, SUM(CASE WHEN NOT AcceptedAnswerId IS NULL THEN 1 ELSE 0 END) AS NumAnswered, (SUM(CASE WHEN NOT AcceptedAnswerId IS NULL THEN 1 ELSE 0 END) * 100 / COUNT(*)) AS PercentageAnswered FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.Id = PostTags.PostId AND PostTypeId = 1 GROUP BY Tags.TagName HAVING COUNT(*) > 100000 ORDER BY PercentageAnswered DESC, NumQuestions DESC
SELECT "Tags"."TagName", COUNT(*) AS "NumQuestions", SUM(CASE WHEN NOT "AcceptedAnswerId" IS NULL THEN 1 ELSE 0 END) AS "NumAnswered", SUM(CASE WHEN NOT "AcceptedAnswerId" IS NULL THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) AS "PercentageAnswered" FROM "Tags" JOIN "PostTags" ON "PostTags"."TagId" = "Tags"."Id" JOIN "Posts" ON "PostTags"."PostId" = "Posts"."Id" AND "PostTypeId" = 1 GROUP BY "Tags"."TagName" HAVING COUNT(*) > 100000 ORDER BY "PercentageAnswered" DESC, "NumQuestions" DESC
0.481445
CREATE TABLE table_name_64 (home VARCHAR2, visitor VARCHAR2)
Who was the home team that the Clippers played?
SELECT home FROM table_name_64 WHERE visitor = "clippers"
SELECT "home" FROM "table_name_64" WHERE "clippers" = "visitor"
0.061523
CREATE TABLE table_203_179 (id NUMBER, "goal" NUMBER, "date" CLOB, "venue" CLOB, "opponent" CLOB, "score" CLOB, "result" CLOB, "competition" CLOB)
before the match against germany , who was the previous friendly match against ?
SELECT "opponent" FROM table_203_179 WHERE "competition" = 'friendly match' AND "date" < (SELECT "date" FROM table_203_179 WHERE "opponent" = 'germany') ORDER BY "date" DESC LIMIT 1
SELECT "opponent" FROM "table_203_179" WHERE "competition" = 'friendly match' AND "date" < (SELECT "date" FROM "table_203_179" WHERE "opponent" = 'germany') ORDER BY "date" DESC FETCH FIRST 1 ROWS ONLY
0.196289
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) 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)
how many patients stayed in the hospital for more than one day underwent the procedure aortography?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "1" AND procedures.long_title = "Aortography"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Aortography" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "1" < "demographic"."days_stay"
0.216797
CREATE TABLE table_6974 ("Res." CLOB, "Record" CLOB, "Opponent" CLOB, "Method" CLOB, "Round" FLOAT, "Time" CLOB, "Location" CLOB)
Who is the opponent of the 3:00 time?
SELECT "Opponent" FROM table_6974 WHERE "Time" = '3:00'
SELECT "Opponent" FROM "table_6974" WHERE "Time" = '3:00'
0.055664
CREATE TABLE table_train_106 ("id" NUMBER, "gender" CLOB, "pregnancy_or_lactation" BOOLEAN, "mini_mental_state_examination_mmse" NUMBER, "uncontrolled_diabetes" BOOLEAN, "blood_glucose" NUMBER, "rosen_modified_hachinski_ischemic_score" NUMBER, "body_mass_index_bmi" FLOAT, "age" FLOAT, "NOUSE" FLOAT)
male or female ( of non _ child bearing potential ) subjects ages >= 50 years of age.
SELECT * FROM table_train_106 WHERE (gender = 'male' OR (gender = 'female' AND pregnancy_or_lactation = 0)) AND age >= 50
SELECT * FROM "table_train_106" WHERE "age" >= 50 AND ("gender" = 'female' OR "gender" = 'male') AND ("gender" = 'male' OR "pregnancy_or_lactation" = 0)
0.148438
CREATE TABLE table_33967 ("Round" FLOAT, "Pick" FLOAT, "Player" CLOB, "Position" CLOB, "School/Club Team" CLOB)
What is the highest round where a back named Ed Cody can be found?
SELECT MAX("Round") FROM table_33967 WHERE "Position" = 'back' AND "Player" = 'ed cody'
SELECT MAX("Round") FROM "table_33967" WHERE "Player" = 'ed cody' AND "Position" = 'back'
0.086914
CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category 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 instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) 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) CREATE TABLE area (course_id NUMBER, area 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 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 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 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)
Next semester , which upper level elective classes are not meeting on Fridays ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course_offering.friday = 'N' AND course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" AND "course_offering"."friday" = 'N' 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" = 'FA' AND "semester"."year" = 2016
0.452148
CREATE TABLE Allergy_Type (Allergy VARCHAR2, AllergyType VARCHAR2) CREATE TABLE Has_Allergy (StuID NUMBER, Allergy VARCHAR2) CREATE TABLE Student (StuID NUMBER, LName VARCHAR2, Fname VARCHAR2, Age NUMBER, Sex VARCHAR2, Major NUMBER, Advisor NUMBER, city_code VARCHAR2)
Return a bar chart on what are the allergy types and how many allergies correspond to each one?, and rank X-axis from high to low order.
SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY AllergyType DESC
SELECT "AllergyType", COUNT(*) FROM "Allergy_Type" GROUP BY "AllergyType" ORDER BY "AllergyType" DESC
0.098633
CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime 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 vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) 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 allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) 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)
on 12/30/this year, when was the last time that the heartrate of patient 006-14121 was less than 121.0?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-14121')) AND vitalperiodic.heartrate < 121.0 AND NOT vitalperiodic.heartrate IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m-%d', vitalperiodic.observationtime) = '12-30' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-14121' 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 "vitalperiodic"."observationtime" FROM "vitalperiodic" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE "vitalperiodic"."heartrate" < 121.0 AND DATETIME("vitalperiodic"."observationtime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."heartrate" IS NULL AND STRFTIME('%m-%d', "vitalperiodic"."observationtime") = '12-30' ORDER BY "vitalperiodic"."observationtime" DESC FETCH FIRST 1 ROWS ONLY
0.841797
CREATE TABLE table_5707 ("CERCLIS ID" CLOB, "Name" CLOB, "County" CLOB, "Proposed" CLOB, "Listed" CLOB, "Construction completed" CLOB, "Partially deleted" CLOB, "Deleted" CLOB)
Which county includes Himco Dump?
SELECT "County" FROM table_5707 WHERE "Name" = 'himco dump'
SELECT "County" FROM "table_5707" WHERE "Name" = 'himco dump'
0.05957
CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note 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 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 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 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 code_description (code VARCHAR2, description CLOB) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant 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 city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) 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 days (days_code VARCHAR2, day_name 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) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE month (month_number NUMBER, month_name CLOB) 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)
from SAN FRANCISCO to DENVER
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 = 'DENVER' 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" = 'DENVER'
0.487305
CREATE TABLE table_name_82 (championship_game VARCHAR2, win__percentage VARCHAR2)
If a team had a percentage of games won recorded as .429, what Championship Game was played?
SELECT championship_game FROM table_name_82 WHERE win__percentage = ".429"
SELECT "championship_game" FROM "table_name_82" WHERE ".429" = "win__percentage"
0.078125
CREATE TABLE table_name_19 (best_score VARCHAR2, worst_dancer_s_ VARCHAR2)
What's the best score, with the worst dancer(s) gethin jones/kenny logan?
SELECT best_score FROM table_name_19 WHERE worst_dancer_s_ = "gethin jones/kenny logan"
SELECT "best_score" FROM "table_name_19" WHERE "gethin jones/kenny logan" = "worst_dancer_s_"
0.09082
CREATE TABLE shop (Shop_ID NUMBER, Shop_Name CLOB, Location CLOB, Open_Date CLOB, Open_Year NUMBER) CREATE TABLE stock (Shop_ID NUMBER, Device_ID NUMBER, Quantity NUMBER) CREATE TABLE device (Device_ID NUMBER, Device CLOB, Carrier CLOB, Package_Version CLOB, Applications CLOB, Software_Platform CLOB)
What are the different software platforms for devices, and how many devices have each, could you rank the total number in asc order?
SELECT Software_Platform, COUNT(*) FROM device GROUP BY Software_Platform ORDER BY COUNT(*)
SELECT "Software_Platform", COUNT(*) FROM "device" GROUP BY "Software_Platform" ORDER BY COUNT(*)
0.094727
CREATE TABLE table_67605 ("Name" CLOB, "Hanzi" CLOB, "Area ( km\\u00b2 ) " FLOAT, "Population" FLOAT, "Villages" FLOAT)
Which town has the most villages with the hanzi and a population larger than 24,802?
SELECT MAX("Villages") FROM table_67605 WHERE "Hanzi" = '南流乡' AND "Population" > '24,802'
SELECT MAX("Villages") FROM "table_67605" WHERE "Hanzi" = '南流乡' AND "Population" > '24,802'
0.088867
CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2) CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER) CREATE TABLE employees (EMPLOYEE_ID NUMBER, FIRST_NAME VARCHAR2, LAST_NAME VARCHAR2, EMAIL VARCHAR2, PHONE_NUMBER VARCHAR2, HIRE_DATE DATE, JOB_ID VARCHAR2, SALARY NUMBER, COMMISSION_PCT NUMBER, MANAGER_ID NUMBER, DEPARTMENT_ID NUMBER) CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER)
For those employees who was hired before 2002-06-21, draw a line chart about the change of salary over hire_date , sort x axis in asc order.
SELECT HIRE_DATE, SALARY FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE
SELECT "HIRE_DATE", "SALARY" FROM "employees" WHERE "HIRE_DATE" < '2002-06-21' ORDER BY "HIRE_DATE"
0.09668
CREATE TABLE table_26168 ("Week" FLOAT, "Date" CLOB, "Opponent" CLOB, "Location" CLOB, "Final Score" CLOB, "Attendance" FLOAT, "Record" CLOB)
What week did September 29 fall in?
SELECT COUNT("Week") FROM table_26168 WHERE "Date" = 'September 29'
SELECT COUNT("Week") FROM "table_26168" WHERE "Date" = 'September 29'
0.067383
CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto 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 d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) 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 microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name 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 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)
what was the name of the procedure that was given two times to patient 27172 since 65 months ago?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27172) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-65 month') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 27172 GROUP BY "hadm_id"), "t1" AS (SELECT "procedures_icd"."icd9_code", COUNT("procedures_icd"."charttime") AS "c1" FROM "procedures_icd" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime") >= DATETIME(CURRENT_TIME(), '-65 month') AND NOT "_u_0"."" IS NULL GROUP BY "procedures_icd"."icd9_code"), "_u_1" AS (SELECT "t1"."icd9_code" FROM "t1" "t1" WHERE "t1"."c1" = 2 GROUP BY "icd9_code") SELECT "d_icd_procedures"."short_title" FROM "d_icd_procedures" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "d_icd_procedures"."icd9_code" WHERE NOT "_u_1"."" IS NULL
0.691406
CREATE TABLE table_name_78 (points NUMBER, year VARCHAR2, wins VARCHAR2)
Which Points have a Year larger than 1966, and Wins larger than 1?
SELECT AVG(points) FROM table_name_78 WHERE year > 1966 AND wins > 1
SELECT AVG("points") FROM "table_name_78" WHERE "wins" > 1 AND "year" > 1966
0.074219
CREATE TABLE table_name_99 (year NUMBER, points VARCHAR2, entrant VARCHAR2, chassis VARCHAR2)
What is the earliest year with an entry from Rotary Watches Stanley BRM and a BRM P207 with more than 0 points?
SELECT MIN(year) FROM table_name_99 WHERE entrant = "rotary watches stanley brm" AND chassis = "brm p207" AND points > 0
SELECT MIN("year") FROM "table_name_99" WHERE "brm p207" = "chassis" AND "entrant" = "rotary watches stanley brm" AND "points" > 0
0.126953
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 diagnoses (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)
what is the number of patients whose primary disease is coronary artery disease and year of birth is less than 2110?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE" AND demographic.dob_year < "2110"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2110" > "demographic"."dob_year" AND "CORONARY ARTERY DISEASE" = "demographic"."diagnosis"
0.162109
CREATE TABLE table_name_64 (casualties VARCHAR2, location VARCHAR2)
What were the casualties in the Baghlan location?
SELECT casualties FROM table_name_64 WHERE location = "baghlan"
SELECT "casualties" FROM "table_name_64" WHERE "baghlan" = "location"
0.067383
CREATE TABLE table_name_29 (player VARCHAR2, total VARCHAR2, to_par VARCHAR2)
Which player has a total of more than 290 and +4 to par.
SELECT player FROM table_name_29 WHERE total > 290 AND to_par = "+4"
SELECT "player" FROM "table_name_29" WHERE "+4" = "to_par" AND "total" > 290
0.074219
CREATE TABLE table_73124 ("Number One ( s ) " FLOAT, "Artist ( s ) " CLOB, "Song ( s ) \\u2014 Weeks" CLOB, "Issue Years" FLOAT, "Whole Weeks" FLOAT)
What is the title of every song, and how many weeks was each song at #1 for One Direction?
SELECT "Song(s) \u2014 Weeks" FROM table_73124 WHERE "Artist(s)" = 'One Direction'
SELECT "Song(s) \u2014 Weeks" FROM "table_73124" WHERE "Artist(s)" = 'One Direction'
0.082031
CREATE TABLE table_25962 ("Game" FLOAT, "Date" CLOB, "Opponent" CLOB, "Score" CLOB, "Location" CLOB, "Attendance" FLOAT, "Record" CLOB, "Points" FLOAT)
List the results for all games which involved the detroit red wings.
SELECT "Score" FROM table_25962 WHERE "Opponent" = 'Detroit Red Wings'
SELECT "Score" FROM "table_25962" WHERE "Opponent" = 'Detroit Red Wings'
0.070313
CREATE TABLE table_name_1 (author VARCHAR2, last_issue VARCHAR2)
What is the Author of the Title with an Ongoing Last Issue?
SELECT author FROM table_name_1 WHERE last_issue = "ongoing"
SELECT "author" FROM "table_name_1" WHERE "last_issue" = "ongoing"
0.064453
CREATE TABLE table_13717 ("Sr No" FLOAT, "Name" CLOB, "Locale" CLOB, "Height" CLOB, "Floors" FLOAT, "Building Type" CLOB)
what is the least floors when the building type is residential and the sr no is 8?
SELECT MIN("Floors") FROM table_13717 WHERE "Building Type" = 'residential' AND "Sr No" = '8'
SELECT MIN("Floors") FROM "table_13717" WHERE "Building Type" = 'residential' AND "Sr No" = '8'
0.092773
CREATE TABLE useracct (name VARCHAR2, u_id VARCHAR2) CREATE TABLE review (rating NUMBER, u_id VARCHAR2)
For each user, return the name and the average rating of reviews given by them.
SELECT T1.name, AVG(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id
SELECT "T1"."name", AVG("T2"."rating") FROM "useracct" "T1" JOIN "review" "T2" ON "T1"."u_id" = "T2"."u_id" GROUP BY "T2"."u_id"
0.125
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 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 allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime 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 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 diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME)
what were the three diagnoses that have the lowest one year survival rate?
SELECT t4.diagnosisname FROM (SELECT t3.diagnosisname, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.diagnosisname, 100 - SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 1 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) AS c1 FROM (SELECT t1.uniquepid, t1.diagnosisname, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid GROUP BY patient.uniquepid, diagnosis.diagnosisname HAVING MIN(diagnosis.diagnosistime) = diagnosis.diagnosistime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.diagnosistime) > 1 * 365) AS t2 JOIN patient ON t2.uniquepid = patient.uniquepid GROUP BY t2.diagnosisname) AS t3) AS t4 WHERE t4.c2 <= 3
WITH "t1" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosisname", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" GROUP BY "patient"."uniquepid", "diagnosis"."diagnosisname" HAVING "diagnosis"."diagnosistime" = MIN("diagnosis"."diagnosistime")), "t3" AS (SELECT "t1"."diagnosisname", 100 - SUM(CASE WHEN "patient"."hospitaldischargestatus" = 'alive' THEN 1 WHEN STRFTIME('%j', "patient"."hospitaldischargetime") - STRFTIME('%j', "t1"."diagnosistime") > 365 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) AS "c1" FROM "t1" "t1" JOIN "patient" ON "patient"."uniquepid" = "t1"."uniquepid" WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "t1"."diagnosistime") > 365 GROUP BY "t1"."diagnosisname"), "t4" AS (SELECT "t3"."diagnosisname", DENSE_RANK() OVER (ORDER BY "t3"."c1" DESC) AS "c2" FROM "t3" "t3") SELECT "t4"."diagnosisname" FROM "t4" "t4" WHERE "t4"."c2" <= 3
0.932617
CREATE TABLE table_61257 ("Rank" FLOAT, "Nation" CLOB, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
What is the rank for the Mixed Team nation with a total of less than 13?
SELECT "Rank" FROM table_61257 WHERE "Total" < '13' AND "Nation" = 'mixed team'
SELECT "Rank" FROM "table_61257" WHERE "Nation" = 'mixed team' AND "Total" < '13'
0.079102
CREATE TABLE table_66235 ("State ( class ) " CLOB, "Vacator" CLOB, "Reason for change" CLOB, "Successor" CLOB, "Date of successor's formal installation" CLOB)
which Vacator has a Reason for change of resigned november 10, 1965?
SELECT "Vacator" FROM table_66235 WHERE "Reason for change" = 'resigned november 10, 1965'
SELECT "Vacator" FROM "table_66235" WHERE "Reason for change" = 'resigned november 10, 1965'
0.089844
CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto 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 microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label 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 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 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 procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE diagnoses_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 outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER)
what was the diagnosis of patient 27591 for the last time?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27591) ORDER BY diagnoses_icd.charttime DESC LIMIT 1)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 27591 GROUP BY "hadm_id"), "_u_1" AS (SELECT "diagnoses_icd"."icd9_code" FROM "diagnoses_icd" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "diagnoses_icd"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icd9_code" ORDER BY "diagnoses_icd"."charttime" DESC FETCH FIRST 1 ROWS ONLY) SELECT "d_icd_diagnoses"."short_title" FROM "d_icd_diagnoses" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "d_icd_diagnoses"."icd9_code" WHERE NOT "_u_1"."" IS NULL
0.518555
CREATE TABLE table_49903 ("Team" CLOB, "Sport" CLOB, "Played" CLOB, "Venue" CLOB, "Championships" CLOB)
What sport was played between the years of 2008-2010?
SELECT "Sport" FROM table_49903 WHERE "Played" = '2008-2010'
SELECT "Sport" FROM "table_49903" WHERE "Played" = '2008-2010'
0.060547
CREATE TABLE Employee (name VARCHAR2, salary NUMBER)
Show names for all employees with salary more than the average.
SELECT name FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee)
SELECT "name" FROM "Employee" WHERE "salary" > (SELECT AVG("salary") FROM "Employee")
0.083008
CREATE TABLE table_14405 ("City" CLOB, "Province/Region" CLOB, "Country" CLOB, "IATA" CLOB, "ICAO" CLOB, "Airport" CLOB)
The Brisbane airport is located in which country?
SELECT "Country" FROM table_14405 WHERE "Airport" = 'brisbane airport'
SELECT "Country" FROM "table_14405" WHERE "Airport" = 'brisbane airport'
0.070313
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 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)
what is admission time of subject id 2560?
SELECT demographic.admittime FROM demographic WHERE demographic.subject_id = "2560"
SELECT "demographic"."admittime" FROM "demographic" WHERE "2560" = "demographic"."subject_id"
0.09082
CREATE TABLE Has_Allergy (StuID NUMBER, Allergy VARCHAR2) CREATE TABLE Allergy_Type (Allergy VARCHAR2, AllergyType VARCHAR2) CREATE TABLE Student (StuID NUMBER, LName VARCHAR2, Fname VARCHAR2, Age NUMBER, Sex VARCHAR2, Major NUMBER, Advisor NUMBER, city_code VARCHAR2)
A bar chart about how many students are affected by each allergy type?, and could you rank in descending by the bars?
SELECT AllergyType, COUNT(*) FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy GROUP BY T2.AllergyType ORDER BY AllergyType DESC
SELECT "AllergyType", COUNT(*) FROM "Has_Allergy" "T1" JOIN "Allergy_Type" "T2" ON "T1"."Allergy" = "T2"."Allergy" GROUP BY "T2"."AllergyType" ORDER BY "AllergyType" DESC
0.166016
CREATE TABLE table_4708 ("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 SR get in 1951?
SELECT "1951" FROM table_4708 WHERE "Tournament" = 'sr'
SELECT "1951" FROM "table_4708" WHERE "Tournament" = 'sr'
0.055664
CREATE TABLE table_1566852_10 (cover_model VARCHAR2, centerfold_model VARCHAR2)
How many cover models were on the edition that featured Jennifer Pershing as the centerfold?
SELECT COUNT(cover_model) FROM table_1566852_10 WHERE centerfold_model = "Jennifer Pershing"
SELECT COUNT("cover_model") FROM "table_1566852_10" WHERE "Jennifer Pershing" = "centerfold_model"
0.095703
CREATE TABLE table_name_11 (player VARCHAR2, school_country VARCHAR2)
Which player has West Virginia listed as their school/country?
SELECT player FROM table_name_11 WHERE school_country = "west virginia"
SELECT "player" FROM "table_name_11" WHERE "school_country" = "west virginia"
0.075195
CREATE TABLE table_8093 ("Poll Source" CLOB, "Dates administered" CLOB, "Democrat: Dick Durbin" CLOB, "Republican: Steve Sauerberg" CLOB, "Lead Margin" FLOAT)
Which poll put Dick Durbin at 56%?
SELECT "Poll Source" FROM table_8093 WHERE "Democrat: Dick Durbin" = '56%'
SELECT "Poll Source" FROM "table_8093" WHERE "Democrat: Dick Durbin" = '56%'
0.074219
CREATE TABLE table_31335 ("Manufacturer" CLOB, "Model" CLOB, "Intro Date" CLOB, "Interface" CLOB, "OS" CLOB, "Price ( USD ) " FLOAT, "Price" CLOB, "Throughput" CLOB)
Who is the manufacturer whose intro date is 2006 and their throughput is 4 mbit/s?
SELECT "Manufacturer" FROM table_31335 WHERE "Intro Date" = '2006' AND "Throughput" = '4 Mbit/s'
SELECT "Manufacturer" FROM "table_31335" WHERE "Intro Date" = '2006' AND "Throughput" = '4 Mbit/s'
0.095703
CREATE TABLE table_name_73 (year VARCHAR2, entrant VARCHAR2, points VARCHAR2, engine VARCHAR2)
When were there less than 1 point with a cosworth v8 engine in jolly club switzerland?
SELECT year FROM table_name_73 WHERE points < 1 AND engine = "cosworth v8" AND entrant = "jolly club switzerland"
SELECT "year" FROM "table_name_73" WHERE "cosworth v8" = "engine" AND "entrant" = "jolly club switzerland" AND "points" < 1
0.120117
CREATE TABLE table_name_47 (player VARCHAR2, nationality VARCHAR2)
Which player is from Sweden?
SELECT player FROM table_name_47 WHERE nationality = "sweden"
SELECT "player" FROM "table_name_47" WHERE "nationality" = "sweden"
0.06543
CREATE TABLE management (department_ID NUMBER, head_ID NUMBER, temporary_acting CLOB) CREATE TABLE department (Department_ID NUMBER, Name CLOB, Creation CLOB, Ranking NUMBER, Budget_in_Billions FLOAT, Num_Employees FLOAT) CREATE TABLE head (head_ID NUMBER, name CLOB, born_state CLOB, age FLOAT)
Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes' by a bar chart.
SELECT Name, AVG(Num_Employees) FROM department AS T1 JOIN management AS T2 ON T1.department_ID = T2.department_ID WHERE T2.temporary_acting = 'Yes' GROUP BY Name
SELECT "Name", AVG("Num_Employees") FROM "department" "T1" JOIN "management" "T2" ON "T1"."department_ID" = "T2"."department_ID" AND "T2"."temporary_acting" = 'Yes' GROUP BY "Name"
0.175781
CREATE TABLE table_31483 ("Country" CLOB, "Number of Troops" FLOAT, "% of Total Troops" CLOB, "Troops per one million population" CLOB, "Troops per $1 billion ( USD ) GDP" CLOB)
Name the country for troops per one million being 54.9
SELECT "Country" FROM table_31483 WHERE "Troops per one million population" = '54.9'
SELECT "Country" FROM "table_31483" WHERE "Troops per one million population" = '54.9'
0.083984
CREATE TABLE table_204_124 (id NUMBER, "no." NUMBER, "name" CLOB, "public access" NUMBER, "location & map links" CLOB, "area\ ha" NUMBER, "area\ acres" NUMBER, "references" CLOB)
which ancient woods has the greatest number of acres ?
SELECT "name" FROM table_204_124 ORDER BY "area\nacres" DESC LIMIT 1
SELECT "name" FROM "table_204_124" ORDER BY "area\nacres" DESC FETCH FIRST 1 ROWS ONLY
0.083984
CREATE TABLE table_29679510_2 (week NUMBER)
In what week was the first game played?
SELECT MIN(week) FROM table_29679510_2
SELECT MIN("week") FROM "table_29679510_2"
0.041016
CREATE TABLE table_name_70 (country VARCHAR2, iata VARCHAR2)
Which country has an IATA of gzt?
SELECT country FROM table_name_70 WHERE iata = "gzt"
SELECT "country" FROM "table_name_70" WHERE "gzt" = "iata"
0.056641
CREATE TABLE stadium (ID NUMBER, name CLOB, Capacity NUMBER, City CLOB, Country CLOB, Opening_year NUMBER) CREATE TABLE swimmer (ID NUMBER, name CLOB, Nationality CLOB, meter_100 FLOAT, meter_200 CLOB, meter_300 CLOB, meter_400 CLOB, meter_500 CLOB, meter_600 CLOB, meter_700 CLOB, Time CLOB) CREATE TABLE record (ID NUMBER, Result CLOB, Swimmer_ID NUMBER, Event_ID NUMBER) CREATE TABLE event (ID NUMBER, Name CLOB, Stadium_ID NUMBER, Year CLOB)
Give me the comparison about meter_100 over the name by a bar chart, rank y axis in desc order please.
SELECT name, meter_100 FROM swimmer ORDER BY meter_100 DESC
SELECT "name", "meter_100" FROM "swimmer" ORDER BY "meter_100" DESC
0.06543
CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE code_description (code VARCHAR2, description 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 class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) 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 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 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 ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) 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 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 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 time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt 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 time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE days (days_code VARCHAR2, day_name 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 flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2)
is there ground transportation from the MILWAUKEE airport to the downtown area
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'MILWAUKEE' AND ground_service.city_code = city.city_code
SELECT DISTINCT "ground_service"."transport_type" FROM "city" JOIN "ground_service" ON "city"."city_code" = "ground_service"."city_code" WHERE "city"."city_name" = 'MILWAUKEE'
0.170898
CREATE TABLE Employees (employee_id VARCHAR2, Destruction_Authorised_by_Employee_ID VARCHAR2) CREATE TABLE Documents_to_be_destroyed (employee_id VARCHAR2, Destruction_Authorised_by_Employee_ID VARCHAR2)
Show the ids of the employees who don't authorize destruction for any document.
SELECT employee_id FROM Employees EXCEPT SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
SELECT "employee_id" FROM "Employees" EXCEPT SELECT "Destruction_Authorised_by_Employee_ID" FROM "Documents_to_be_destroyed"
0.121094
CREATE TABLE movie (movie_id NUMBER, title CLOB, year NUMBER, director CLOB, budget_million NUMBER, gross_worldwide NUMBER) CREATE TABLE book_club (book_club_id NUMBER, year NUMBER, author_or_editor CLOB, book_title CLOB, publisher CLOB, category CLOB, result CLOB) CREATE TABLE culture_company (company_name CLOB, type CLOB, incorporated_in CLOB, group_equity_shareholding NUMBER, book_club_id CLOB, movie_id CLOB)
Show all movie titles, years, and directors, ordered by budget.
SELECT title, year, director FROM movie ORDER BY budget_million
SELECT "title", "year", "director" FROM "movie" ORDER BY "budget_million"
0.071289
CREATE TABLE table_23288 ("Draw" FLOAT, "Artist" CLOB, "Song" CLOB, "Jury votes" FLOAT, "Televotes" FLOAT, "Total votes" FLOAT, "Result" CLOB)
How many televotes are there for 'Lujuria'?
SELECT "Televotes" FROM table_23288 WHERE "Song" = 'Lujuria'
SELECT "Televotes" FROM "table_23288" WHERE "Song" = 'Lujuria'
0.060547