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_79188 ("Tie no" CLOB, "Home team" CLOB, "Score" CLOB, "Away team" CLOB, "Date" CLOB)
In the tie where Southampton was the away team, who was the home team?
SELECT "Home team" FROM table_79188 WHERE "Away team" = 'southampton'
SELECT "Home team" FROM "table_79188" WHERE "Away team" = 'southampton'
0.069336
CREATE TABLE table_name_7 (lost VARCHAR2, points VARCHAR2)
How many losses did the club with 47 points have ?
SELECT lost FROM table_name_7 WHERE points = "47"
SELECT "lost" FROM "table_name_7" WHERE "47" = "points"
0.053711
CREATE TABLE people (People_ID NUMBER, Name CLOB, Height FLOAT, Weight FLOAT, "Home Town" CLOB) CREATE TABLE perpetrator (Perpetrator_ID NUMBER, People_ID NUMBER, Date CLOB, Year FLOAT, Location CLOB, Country CLOB, Killed NUMBER, Injured NUMBER)
Return a bar chart on what are the countries of perpetrators? Show each country and the corresponding number of perpetrators there, sort x-axis in descending order please.
SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country ORDER BY Country DESC
SELECT "Country", COUNT(*) FROM "perpetrator" GROUP BY "Country" ORDER BY "Country" DESC
0.085938
CREATE TABLE university (School_ID NUMBER, School CLOB, Location CLOB, Founded FLOAT, Affiliation CLOB, Enrollment FLOAT, Nickname CLOB, Primary_conference CLOB) CREATE TABLE basketball_match (Team_ID NUMBER, School_ID NUMBER, Team_Name CLOB, ACC_Regular_Season CLOB, ACC_Percent CLOB, ACC_Home CLOB, ACC_Road CLOB, All_Games CLOB, All_Games_Percent NUMBER, All_Home CLOB, All_Road CLOB, All_Neutral CLOB)
Visualize a bar chart about the distribution of All_Home and Team_ID , and group by attribute ACC_Road, and sort from low to high by the Y.
SELECT All_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY Team_ID
SELECT "All_Home", "Team_ID" FROM "basketball_match" GROUP BY "ACC_Road", "All_Home" ORDER BY "Team_ID"
0.100586
CREATE TABLE table_name_68 (total NUMBER, league_cup_goals VARCHAR2, club VARCHAR2, league_goals VARCHAR2)
Which Total has a Club of darlington, and a League goals of 13, and a League Cup goals of 1?
SELECT SUM(total) FROM table_name_68 WHERE club = "darlington" AND league_goals = "13" AND league_cup_goals = "1"
SELECT SUM("total") FROM "table_name_68" WHERE "1" = "league_cup_goals" AND "13" = "league_goals" AND "club" = "darlington"
0.120117
CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId 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 PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskTypes (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 Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId 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 PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) 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 SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other)
Find the top five answers with the most upvotes..
SELECT Posts.Id, Posts.AcceptedAnswerId, Users.UpVotes FROM Posts JOIN Users ON Posts.Id = Users.Id ORDER BY Users.UpVotes DESC
SELECT "Posts"."Id", "Posts"."AcceptedAnswerId", "Users"."UpVotes" FROM "Posts" JOIN "Users" ON "Posts"."Id" = "Users"."Id" ORDER BY "Users"."UpVotes" DESC
0.151367
CREATE TABLE table_name_38 (opponent VARCHAR2, date VARCHAR2)
Who was the opponent on the September 3 game?
SELECT opponent FROM table_name_38 WHERE date = "september 3"
SELECT "opponent" FROM "table_name_38" WHERE "date" = "september 3"
0.06543
CREATE TABLE table_203_407 (id NUMBER, "name" CLOB, "party" CLOB, "province" CLOB, "term expires" NUMBER, "years in office" CLOB)
what was phil lockyer 's party ?
SELECT "party" FROM table_203_407 WHERE "name" = 'phil lockyer'
SELECT "party" FROM "table_203_407" WHERE "name" = 'phil lockyer'
0.063477
CREATE TABLE table_14750 ("Name" CLOB, "Species Authority" CLOB, "Order" CLOB, "Family" CLOB, "Red List" FLOAT)
What is the name for the red list of 7, the artiodactyla order, and Species Authority of cervus elaphus linnaeus, 1758?
SELECT "Name" FROM table_14750 WHERE "Red List" = '7' AND "Order" = 'artiodactyla' AND "Species Authority" = 'cervus elaphus linnaeus, 1758'
SELECT "Name" FROM "table_14750" WHERE "Order" = 'artiodactyla' AND "Red List" = '7' AND "Species Authority" = 'cervus elaphus linnaeus, 1758'
0.138672
CREATE TABLE table_26202847_6 (opponent_in_the_final VARCHAR2, score_in_the_final VARCHAR2)
When the score in the final is 3 6, 6 4, 3 6, 4 6, who are all the opponents in the final?
SELECT opponent_in_the_final FROM table_26202847_6 WHERE score_in_the_final = "3–6, 6–4, 3–6, 4–6"
SELECT "opponent_in_the_final" FROM "table_26202847_6" WHERE "3–6, 6–4, 3–6, 4–6" = "score_in_the_final"
0.101563
CREATE TABLE table_name_73 (medal VARCHAR2, name VARCHAR2)
What is the medal named fatuma roba category:articles with hcards for?
SELECT medal FROM table_name_73 WHERE name = "fatuma roba category:articles with hcards"
SELECT "medal" FROM "table_name_73" WHERE "fatuma roba category:articles with hcards" = "name"
0.091797
CREATE TABLE table_3192 ("Episode #" FLOAT, "Production Count" FLOAT, "Original Airdate" CLOB, "Prod. Code" CLOB, "Title" CLOB, "Viewing Figures millions" CLOB)
What is the production number for the episode named 'mine s a double'?
SELECT COUNT("Production Count") FROM table_3192 WHERE "Title" = 'Mine’s A Double'
SELECT COUNT("Production Count") FROM "table_3192" WHERE "Title" = 'Mine’s A Double'
0.082031
CREATE TABLE table_name_24 (home VARCHAR2, score VARCHAR2)
Who was the home team at the Nuggets game that had a score of 116 105?
SELECT home FROM table_name_24 WHERE score = "116–105"
SELECT "home" FROM "table_name_24" WHERE "116–105" = "score"
0.058594
CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname 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 semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE 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 program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req 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 gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER)
What are the upper-level elective options for the Spring and Summer ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.department = 'EECS' AND program_course.category LIKE '%ULCS%' AND semester.semester IN ('SP', 'SS', 'SU') 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" 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" IN ('SP', 'SS', 'SU') AND "semester"."year" = 2016 WHERE "course"."department" = 'EECS'
0.466797
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 intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) 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 cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME)
how did patient 033-250 get admitted to the hospital for the first time until 3 years ago?
SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '033-250' AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY patient.hospitaladmittime LIMIT 1
SELECT "patient"."hospitaladmitsource" FROM "patient" WHERE "patient"."uniquepid" = '033-250' AND DATETIME("patient"."hospitaladmittime") <= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY "patient"."hospitaladmittime" FETCH FIRST 1 ROWS ONLY
0.233398
CREATE TABLE table_1953 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" CLOB, "Directed by" CLOB, "Written by" CLOB, "Original air date" CLOB, "Production code" CLOB)
What episode number in the series aired on February 8, 2004?
SELECT MAX("No. in series") FROM table_1953 WHERE "Original air date" = 'February 8, 2004'
SELECT MAX("No. in series") FROM "table_1953" WHERE "Original air date" = 'February 8, 2004'
0.089844
CREATE TABLE Investors (investor_id NUMBER, Investor_details VARCHAR2) CREATE TABLE Transactions_Lots (transaction_id NUMBER, lot_id NUMBER) CREATE TABLE Sales (sales_transaction_id NUMBER, sales_details VARCHAR2) CREATE TABLE Transactions (transaction_id NUMBER, investor_id NUMBER, transaction_type_code VARCHAR2, date_of_transaction DATETIME, amount_of_transaction NUMBER, share_count VARCHAR2, other_details VARCHAR2) CREATE TABLE Purchases (purchase_transaction_id NUMBER, purchase_details VARCHAR2) CREATE TABLE Ref_Transaction_Types (transaction_type_code VARCHAR2, transaction_type_description VARCHAR2) CREATE TABLE Lots (lot_id NUMBER, investor_id NUMBER, lot_details VARCHAR2)
Show the average transaction amount for different transaction types with a pie chart.
SELECT transaction_type_code, AVG(amount_of_transaction) FROM Transactions GROUP BY transaction_type_code
SELECT "transaction_type_code", AVG("amount_of_transaction") FROM "Transactions" GROUP BY "transaction_type_code"
0.110352
CREATE TABLE table_17085947_32 (trans_2 VARCHAR2, total_time VARCHAR2)
What is the trans 2 duration if the total time is 1:51:19.45?
SELECT trans_2 FROM table_17085947_32 WHERE total_time = "1:51:19.45"
SELECT "trans_2" FROM "table_17085947_32" WHERE "1:51:19.45" = "total_time"
0.073242
CREATE TABLE invoice_line_items (order_item_id NUMBER, invoice_number NUMBER, product_id NUMBER, product_title CLOB, product_quantity CLOB, product_price NUMBER, derived_product_cost NUMBER, derived_vat_payable NUMBER, derived_total_cost NUMBER) CREATE TABLE orders (order_id NUMBER, customer_id NUMBER, date_order_placed TIME, order_details CLOB) CREATE TABLE accounts (account_id NUMBER, customer_id NUMBER, date_account_opened TIME, account_name CLOB, other_account_details CLOB) CREATE TABLE financial_transactions (transaction_id NUMBER, account_id NUMBER, invoice_number NUMBER, transaction_type CLOB, transaction_date TIME, transaction_amount NUMBER, transaction_comment CLOB, other_transaction_details CLOB) CREATE TABLE products (product_id NUMBER, parent_product_id NUMBER, production_type_code CLOB, unit_price NUMBER, product_name CLOB, product_color CLOB, product_size CLOB) CREATE TABLE invoices (invoice_number NUMBER, order_id NUMBER, invoice_date TIME) CREATE TABLE product_categories (production_type_code CLOB, product_type_description CLOB, vat_rating NUMBER) CREATE TABLE customers (customer_id NUMBER, customer_first_name CLOB, customer_middle_initial CLOB, customer_last_name CLOB, gender CLOB, email_address CLOB, login_name CLOB, login_password CLOB, phone_number CLOB, town_city CLOB, state_county_province CLOB, country CLOB) CREATE TABLE order_items (order_item_id NUMBER, order_id NUMBER, product_id NUMBER, product_quantity CLOB, other_order_item_details CLOB)
Count the number of financial transactions that the account with the name 337 has.
SELECT COUNT(*) FROM financial_transactions AS T1 JOIN accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"
SELECT COUNT(*) FROM "financial_transactions" "T1" JOIN "accounts" "T2" ON "337" = "T2"."account_name" AND "T1"."account_id" = "T2"."account_id"
0.140625
CREATE TABLE table_dev_44 ("id" NUMBER, "gender" CLOB, "arterial_ph" FLOAT, "systolic_blood_pressure_sbp" NUMBER, "serum_bicarbonate" NUMBER, "anion_gap" NUMBER, "diabetic" CLOB, "diabetic_ketoacidosis" BOOLEAN, "blood_glucose" NUMBER, "diastolic_blood_pressure_dbp" NUMBER, "positive_serum_ketones" BOOLEAN, "serum_osmolarity" NUMBER, "serum_creatinine" FLOAT, "metformin" BOOLEAN, "hyperosmolar_hyperglycemic_state" BOOLEAN, "hypertension" BOOLEAN, "age" FLOAT, "NOUSE" FLOAT)
hyperosmolar hyperglycemic state ( blood glucose > 200 mg / dl, serum osmolarity > 320 mosm / kg )
SELECT * FROM table_dev_44 WHERE hyperosmolar_hyperglycemic_state = 1 OR (blood_glucose > 200 AND serum_osmolarity > 320)
SELECT * FROM "table_dev_44" WHERE ("blood_glucose" > 200 OR "hyperosmolar_hyperglycemic_state" = 1) AND ("hyperosmolar_hyperglycemic_state" = 1 OR "serum_osmolarity" > 320)
0.168945
CREATE TABLE table_50084 ("Lane" FLOAT, "Name" CLOB, "Country" CLOB, "Mark" CLOB, "React" FLOAT)
What is Mark, when Lane is less than 5, and when React is 0.217?
SELECT "Mark" FROM table_50084 WHERE "Lane" < '5' AND "React" = '0.217'
SELECT "Mark" FROM "table_50084" WHERE "Lane" < '5' AND "React" = '0.217'
0.071289
CREATE TABLE table_32622 ("Stage" CLOB, "Date" CLOB, "Route" CLOB, "Terrain" CLOB, "Length" CLOB, "Winner" CLOB)
Which stage took the tour through Boulogne-Billancourt?
SELECT "Stage" FROM table_32622 WHERE "Route" = 'boulogne-billancourt'
SELECT "Stage" FROM "table_32622" WHERE "Route" = 'boulogne-billancourt'
0.070313
CREATE TABLE table_2897457_7 (nhl_team VARCHAR2, pick__number VARCHAR2)
How many NHL teams have a pick number of 128?
SELECT COUNT(nhl_team) FROM table_2897457_7 WHERE pick__number = 128
SELECT COUNT("nhl_team") FROM "table_2897457_7" WHERE "pick__number" = 128
0.072266
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 jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2) CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER)
For those employees who did not have any job in the past, draw a scatter chart about the correlation between employee_id and salary .
SELECT EMPLOYEE_ID, SALARY FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
SELECT "EMPLOYEE_ID", "SALARY" FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history")
0.113281
CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE 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 inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE 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 cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE d_icd_procedures (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 d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
how many patients until 1 year ago had received a routine chest x-ray procedure?
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'routine chest x-ray') AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year'))
WITH "_u_1" AS (SELECT "procedures_icd"."hadm_id" FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'routine chest x-ray' WHERE DATETIME("procedures_icd"."charttime") <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY "hadm_id") SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "admissions" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "admissions"."hadm_id" WHERE NOT "_u_1"."" IS NULL
0.470703
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 procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) 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 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 d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_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) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE 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 transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME)
has patient 25814 ever been diagnosed with a disease in 2105?
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25814) AND STRFTIME('%y', diagnoses_icd.charttime) = '2105'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 25814 GROUP BY "hadm_id") SELECT COUNT(*) > 0 FROM "diagnoses_icd" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "diagnoses_icd"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y', "diagnoses_icd"."charttime") = '2105'
0.306641
CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime 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 chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_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 outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) 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 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 microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name 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 d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label 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 diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME)
had patient 3273 excreted urine out ureteral stent #1 when they came to the hospital last time?
SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3273 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out ureteral stent #1' AND d_items.linksto = 'outputevents')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 3273 AND NOT "admissions"."dischtime" IS NULL GROUP BY "hadm_id" ORDER BY "admissions"."admittime" DESC FETCH FIRST 1 ROWS ONLY), "_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" = 'urine out ureteral stent #1' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "outputevents" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
0.770508
CREATE TABLE table_14728 ("Date" CLOB, "Home captain" CLOB, "Away captain" CLOB, "Venue" CLOB, "Result" CLOB)
What is the result for 23,24,25,26 july 1992?
SELECT "Result" FROM table_14728 WHERE "Date" = '23,24,25,26 july 1992'
SELECT "Result" FROM "table_14728" WHERE "Date" = '23,24,25,26 july 1992'
0.071289
CREATE TABLE table_25483 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
What was the score when the game was 80?
SELECT "Score" FROM table_25483 WHERE "Game" = '80'
SELECT "Score" FROM "table_25483" WHERE "Game" = '80'
0.051758
CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name 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 TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) 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 VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) 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 CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER)
why can't ya'll just have a good api.
SELECT COUNT(Id), Tags, RIGHT(LEFT(CreationDate, 11), 4) AS year, LEFT(CreationDate, 3) AS month FROM Posts GROUP BY Tags, RIGHT(LEFT(CreationDate, 11), 4), LEFT(CreationDate, 3) HAVING COUNT(Id) > 5 ORDER BY COUNT(Id) DESC
SELECT COUNT("Id"), "Tags", RIGHT(LEFT("CreationDate", 11), 4) AS "year", LEFT("CreationDate", 3) AS "month" FROM "Posts" GROUP BY "Tags", RIGHT(LEFT("CreationDate", 11), 4), LEFT("CreationDate", 3) HAVING COUNT("Id") > 5 ORDER BY COUNT("Id") DESC
0.241211
CREATE TABLE table_name_66 (points NUMBER, games VARCHAR2, losses VARCHAR2, team_name VARCHAR2)
What's the lowest number of points with fewer than 8 losses and fewer than 24 games for the vancouver burrards?
SELECT MIN(points) FROM table_name_66 WHERE losses < 8 AND team_name = "vancouver burrards" AND games < 24
SELECT MIN("points") FROM "table_name_66" WHERE "games" < 24 AND "losses" < 8 AND "team_name" = "vancouver burrards"
0.113281
CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
what is the monthly maximum value of patient 005-9883's magnesium until 3 years ago?
SELECT MAX(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-9883')) AND lab.labname = 'magnesium' AND DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY STRFTIME('%y-%m', lab.labresulttime)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '005-9883' 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 MAX("lab"."labresult") FROM "lab" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "lab"."patientunitstayid" WHERE "lab"."labname" = 'magnesium' AND DATETIME("lab"."labresulttime") <= DATETIME(CURRENT_TIME(), '-3 year') AND NOT "_u_1"."" IS NULL GROUP BY STRFTIME('%y-%m', "lab"."labresulttime")
0.630859
CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
Out of total number of white russian patients, calculate the minimum age of male patients
SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.ethnicity = "WHITE - RUSSIAN"
SELECT MIN("demographic"."age") FROM "demographic" WHERE "M" = "demographic"."gender" AND "WHITE - RUSSIAN" = "demographic"."ethnicity"
0.131836
CREATE TABLE table_29785 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
What game in the season does this list start?
SELECT MIN("Game") FROM table_29785
SELECT MIN("Game") FROM "table_29785"
0.036133
CREATE TABLE table_name_51 (argon VARCHAR2, neon VARCHAR2)
What argon has a neon of 10.5?
SELECT argon FROM table_name_51 WHERE neon = "10.5"
SELECT "argon" FROM "table_name_51" WHERE "10.5" = "neon"
0.055664
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 medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE 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 patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB)
what's the name of the drug that patient 006-105495 had been prescribed two times in this hospital encounter?
SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-105495' AND patient.hospitaldischargetime IS NULL)) GROUP BY medication.drugname) AS t1 WHERE t1.c1 = 2
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '006-105495' 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"), "t1" AS (SELECT "medication"."drugname", COUNT("medication"."drugstarttime") AS "c1" FROM "medication" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "medication"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL GROUP BY "medication"."drugname") SELECT "t1"."drugname" FROM "t1" "t1" WHERE "t1"."c1" = 2
0.680664
CREATE TABLE table_22032 ("Home ( 1st leg ) " CLOB, "Home ( 2nd leg ) " CLOB, "1st Leg" CLOB, "2nd leg" CLOB, "Aggregate" CLOB)
If second leg is Newell's Old Boys, what name is first leg?
SELECT "1st Leg" FROM table_22032 WHERE "Home (2nd leg)" = 'Newell''s Old Boys'
SELECT "1st Leg" FROM "table_22032" WHERE "Home (2nd leg)" = 'Newell''s Old Boys'
0.079102
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 chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_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 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 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 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 d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) 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 outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom 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)
since 6 years ago retrieve the top three most common output events?
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE DATETIME(outputevents.charttime) >= DATETIME(CURRENT_TIME(), '-6 year') GROUP BY outputevents.itemid) AS t1 WHERE t1.c1 <= 3)
WITH "t1" AS (SELECT "outputevents"."itemid", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "outputevents" WHERE DATETIME("outputevents"."charttime") >= DATETIME(CURRENT_TIME(), '-6 year') GROUP BY "outputevents"."itemid"), "_u_0" AS (SELECT "t1"."itemid" FROM "t1" "t1" WHERE "t1"."c1" <= 3 GROUP BY "itemid") SELECT "d_items"."label" FROM "d_items" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "d_items"."itemid" WHERE NOT "_u_0"."" IS NULL
0.435547
CREATE TABLE table_40079 ("Date" CLOB, "Cover model" CLOB, "Centerfold model" CLOB, "Interview subject" CLOB, "Pictorials" CLOB)
Who was the Centerfold model in the issue in which the Interview subject was Paul Simon?
SELECT "Centerfold model" FROM table_40079 WHERE "Interview subject" = 'paul simon'
SELECT "Centerfold model" FROM "table_40079" WHERE "Interview subject" = 'paul simon'
0.083008
CREATE TABLE table_name_52 (runner_s__up VARCHAR2, year VARCHAR2)
What are the Runner(s)-up of the 1956 Championship?
SELECT runner_s__up FROM table_name_52 WHERE year = "1956"
SELECT "runner_s__up" FROM "table_name_52" WHERE "1956" = "year"
0.0625
CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE 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 lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
count the number of current patients whose age is in their 30s.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.hospitaldischargetime IS NULL AND patient.age BETWEEN 30 AND 39
SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" WHERE "patient"."age" <= 39 AND "patient"."age" >= 30 AND "patient"."hospitaldischargetime" IS NULL
0.155273
CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR2, Document_Type_Description VARCHAR2) CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR, Budget_Type_Description VARCHAR2) CREATE TABLE Projects (Project_ID NUMBER, Project_Details VARCHAR2) CREATE TABLE Documents (Document_ID NUMBER, Document_Type_Code CHAR, Project_ID NUMBER, Document_Date DATETIME, Document_Name VARCHAR2, Document_Description VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Documents_with_Expenses (Document_ID NUMBER, Budget_Type_Code CHAR, Document_Details VARCHAR2) CREATE TABLE Statements (Statement_ID NUMBER, Statement_Details VARCHAR2) CREATE TABLE Accounts (Account_ID NUMBER, Statement_ID NUMBER, Account_Details VARCHAR2)
Show budget type codes and the number of documents in each budget type. Show bar chart.
SELECT Budget_Type_Code, COUNT(*) FROM Documents_with_Expenses GROUP BY Budget_Type_Code
SELECT "Budget_Type_Code", COUNT(*) FROM "Documents_with_Expenses" GROUP BY "Budget_Type_Code"
0.091797
CREATE TABLE musical (musical_id NUMBER, name CLOB, year NUMBER, award CLOB, category CLOB, nominee CLOB, result CLOB) CREATE TABLE actor (actor_id NUMBER, name CLOB, musical_id NUMBER, character CLOB, duration CLOB, age NUMBER)
Who is the nominee who has been nominated for the most musicals?
SELECT nominee FROM musical GROUP BY nominee ORDER BY COUNT(*) DESC LIMIT 1
SELECT "nominee" FROM "musical" GROUP BY "nominee" ORDER BY COUNT(*) DESC FETCH FIRST 1 ROWS ONLY
0.094727
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB)
when was patient morgan mcgee discharged? also specify his primary disease
SELECT demographic.diagnosis, demographic.dischtime FROM demographic WHERE demographic.name = "Morgan Mcgee"
SELECT "demographic"."diagnosis", "demographic"."dischtime" FROM "demographic" WHERE "Morgan Mcgee" = "demographic"."name"
0.119141
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
count the number of patients whose admission type is urgent and lab test category is chemistry.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab."CATEGORY" = "Chemistry"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Chemistry" = "lab"."CATEGORY" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "URGENT" = "demographic"."admission_type"
0.202148
CREATE TABLE table_544 ("Rank ( CSA ) " CLOB, "Combined Statistical Area ( or Metropolitan Statistical Area if noted ) " CLOB, "State ( s ) " CLOB, "2007 Estimate" CLOB, "2000 Population" CLOB, "Percent Change ( 1990\\u20132000 ) " CLOB)
What is the 2007 estimate when the rank (csa) is 4
SELECT "2007 Estimate" FROM table_544 WHERE "Rank (CSA)" = '4'
SELECT "2007 Estimate" FROM "table_544" WHERE "Rank (CSA)" = '4'
0.0625
CREATE TABLE table_22347090_6 (directed_by VARCHAR2, us_viewers__million_ VARCHAR2)
How many directors are there for the episode that had 1.59 million U.S. viewers?
SELECT COUNT(directed_by) FROM table_22347090_6 WHERE us_viewers__million_ = "1.59"
SELECT COUNT("directed_by") FROM "table_22347090_6" WHERE "1.59" = "us_viewers__million_"
0.086914
CREATE TABLE table_40310 ("Tournament" CLOB, "2002" CLOB, "2004" CLOB, "2005" CLOB, "2006" CLOB, "2007" CLOB, "2008" CLOB, "2010" CLOB, "2011" CLOB, "2012" CLOB)
What tournament has 1r as a 2004, and 1r as a 2007?
SELECT "Tournament" FROM table_40310 WHERE "2004" = '1r' AND "2007" = '1r'
SELECT "Tournament" FROM "table_40310" WHERE "2004" = '1r' AND "2007" = '1r'
0.074219
CREATE TABLE member_attendance (Member_ID NUMBER, Performance_ID NUMBER, Num_of_Pieces NUMBER) CREATE TABLE performance (Performance_ID FLOAT, Date CLOB, Host CLOB, Location CLOB, Attendance NUMBER) CREATE TABLE member (Member_ID CLOB, Name CLOB, Nationality CLOB, Role CLOB)
Show different locations and the number of performances at each location by a bar chart, sort x-axis in ascending order.
SELECT Location, COUNT(*) FROM performance GROUP BY Location ORDER BY Location
SELECT "Location", COUNT(*) FROM "performance" GROUP BY "Location" ORDER BY "Location"
0.083984
CREATE TABLE Roles (Role_Code CHAR, Role_Name VARCHAR2, Role_Description VARCHAR2) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR2, Document_Type_Description VARCHAR2) CREATE TABLE Employees (Employee_ID NUMBER, Role_Code CHAR, Employee_Name VARCHAR2, Gender_MFU CHAR, Date_of_Birth DATETIME, Other_Details VARCHAR2) CREATE TABLE Ref_Locations (Location_Code CHAR, Location_Name VARCHAR2, Location_Description VARCHAR2) CREATE TABLE Ref_Calendar (Calendar_Date DATETIME, Day_Number NUMBER) CREATE TABLE Documents_to_be_Destroyed (Document_ID NUMBER, Destruction_Authorised_by_Employee_ID NUMBER, Destroyed_by_Employee_ID NUMBER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR2) CREATE TABLE All_Documents (Document_ID NUMBER, Date_Stored DATETIME, Document_Type_Code CHAR, Document_Name CHAR, Document_Description CHAR, Other_Details VARCHAR2) CREATE TABLE Document_Locations (Document_ID NUMBER, Location_Code CHAR, Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME)
How many documents in different ending date? Return a line chart binning ending date by year interval.
SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations
SELECT "Date_in_Locaton_To", COUNT("Date_in_Locaton_To") FROM "Document_Locations"
0.080078
CREATE TABLE table_30829 ("DrumSet Name" CLOB, "Product Line" CLOB, "Years Available" CLOB, "Drum Module" CLOB, "KickDrum Pad" CLOB, "Snare Pad" CLOB, "Tom-Tom Pads" CLOB, "Hi-HatPad/ Controller" CLOB, "CrashandRide CymbalPads" CLOB, "DrumStand ( oftenoptional ) " CLOB)
in the drum module td-5 what are the tom-tom pads
SELECT "Tom-Tom Pads" FROM table_30829 WHERE "Drum Module" = 'TD-5'
SELECT "Tom-Tom Pads" FROM "table_30829" WHERE "Drum Module" = 'TD-5'
0.067383
CREATE TABLE table_name_65 (name_of_kingdom VARCHAR2, capital VARCHAR2)
Which kingdom has Suin as its capital?
SELECT name_of_kingdom FROM table_name_65 WHERE capital = "suin"
SELECT "name_of_kingdom" FROM "table_name_65" WHERE "capital" = "suin"
0.068359
CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name 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 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 CloseReasonTypes (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 Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE 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 FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) 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 TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId 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 PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB)
Evolution of the time between the question and the question.
SELECT CAST(q.CreationDate AS DATE) AS "Date", DATEDIFF(DAY, q.CreationDate, CreationDate) AS "Delay to answer" FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 AND a.PostTypeId = 2 ORDER BY 'Date' DESC
SELECT CAST("q"."CreationDate" AS DATE) AS "Date", DATEDIFF(CAST("DAY" AS DATETIME), CAST("q"."CreationDate" AS DATETIME), CREATIONDATE) AS "Delay to answer" FROM "Posts" "q" JOIN "Posts" "a" ON "a"."ParentId" = "q"."Id" AND "a"."PostTypeId" = 2 WHERE "q"."PostTypeId" = 1 ORDER BY 'Date' DESC
0.286133
CREATE TABLE table_52755 ("Title" CLOB, "Author ( s ) " CLOB, "Recorded" CLOB, "Location ( s ) " CLOB, "Time" CLOB)
Who wrote the song that runs for 2:22?
SELECT "Author(s)" FROM table_52755 WHERE "Time" = '2:22'
SELECT "Author(s)" FROM "table_52755" WHERE "Time" = '2:22'
0.057617
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)
What is the first name of each student who is not allergic to any type of food? Count them in a bar chart, and I want to list from high to low by the Y.
SELECT Fname, COUNT(Fname) FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = "food") GROUP BY Fname ORDER BY COUNT(Fname) DESC
WITH "_u_0" AS (SELECT ARRAY_AGG("StuID") AS "", "T2"."AllergyType" AS "_u_1" FROM "Has_Allergy" "T1" JOIN "Allergy_Type" "T2" ON "T1"."Allergy" = "T2"."Allergy" GROUP BY "T2"."AllergyType") SELECT "Fname", COUNT("Fname") FROM "Student" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."_u_1" = "food" WHERE NOT ARRAY_ANY("_u_0"."", "_x" -> "StuID" = "_x") GROUP BY "Fname" ORDER BY COUNT("Fname") DESC
0.37793
CREATE TABLE table_37876 ("Game" FLOAT, "March" FLOAT, "Opponent" CLOB, "Score" CLOB, "Record" CLOB, "Points" FLOAT)
What is the latest in March when the record of 35 16 6 3?
SELECT MAX("March") FROM table_37876 WHERE "Record" = '35–16–6–3'
SELECT MAX("March") FROM "table_37876" WHERE "Record" = '35–16–6–3'
0.06543
CREATE TABLE table_20342 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
WHO DID THE RAPTORS PLAY ON JANUARY 9?
SELECT "Team" FROM table_20342 WHERE "Date" = 'January 9'
SELECT "Team" FROM "table_20342" WHERE "Date" = 'January 9'
0.057617
CREATE TABLE table_18662026_10 (parallel_bars VARCHAR2, floor VARCHAR2, horizontal_bar VARCHAR2)
If the horizontal bar is n/a and the floor is 14.175, what is the number for the parallel bars?
SELECT parallel_bars FROM table_18662026_10 WHERE floor = "14.175" AND horizontal_bar = "N/A"
SELECT "parallel_bars" FROM "table_18662026_10" WHERE "14.175" = "floor" AND "N/A" = "horizontal_bar"
0.098633
CREATE TABLE table_name_42 (method VARCHAR2, event VARCHAR2)
Which method's event was flawless fighting championship 1: the beginning?
SELECT method FROM table_name_42 WHERE event = "flawless fighting championship 1: the beginning"
SELECT "method" FROM "table_name_42" WHERE "event" = "flawless fighting championship 1: the beginning"
0.099609
CREATE TABLE table_60636 ("Order Year" CLOB, "Builder" CLOB, "Model" CLOB, "Length ( ft. ) " CLOB, "Engine/Transmission" CLOB)
What order year has a 30 Length (ft.) and 05.505 model?
SELECT "Order Year" FROM table_60636 WHERE "Length (ft.)" = '30' AND "Model" = '05.505'
SELECT "Order Year" FROM "table_60636" WHERE "Length (ft.)" = '30' AND "Model" = '05.505'
0.086914
CREATE TABLE table_name_43 (score VARCHAR2, player VARCHAR2)
What is Ernie Els' Score?
SELECT score FROM table_name_43 WHERE player = "ernie els"
SELECT "score" FROM "table_name_43" WHERE "ernie els" = "player"
0.0625
CREATE TABLE Projects (Project_ID NUMBER, Project_Details VARCHAR2) CREATE TABLE Statements (Statement_ID NUMBER, Statement_Details VARCHAR2) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR2, Document_Type_Description VARCHAR2) CREATE TABLE Accounts (Account_ID NUMBER, Statement_ID NUMBER, Account_Details VARCHAR2) CREATE TABLE Documents (Document_ID NUMBER, Document_Type_Code CHAR, Project_ID NUMBER, Document_Date DATETIME, Document_Name VARCHAR2, Document_Description VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR, Budget_Type_Description VARCHAR2) CREATE TABLE Documents_with_Expenses (Document_ID NUMBER, Budget_Type_Code CHAR, Document_Details VARCHAR2)
Return a bar chart showing the number of documents for each document type description, I want to display x axis in desc order.
SELECT Document_Type_Description, COUNT(Document_Type_Description) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Description ORDER BY Document_Type_Description DESC
SELECT "Document_Type_Description", COUNT("Document_Type_Description") FROM "Ref_Document_Types" "T1" JOIN "Documents" "T2" ON "T1"."Document_Type_Code" = "T2"."Document_Type_Code" GROUP BY "Document_Type_Description" ORDER BY "Document_Type_Description" DESC
0.25293
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 chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost 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 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 patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod 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 inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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)
what were the three most commonly performed lab tests for patients who had previously been diagnosed with spleen injury nos-open in the same hospital visit, a year before?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'spleen injury nos-open') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT admissions.subject_id, labevents.itemid, labevents.charttime, admissions.hadm_id FROM labevents JOIN admissions ON labevents.hadm_id = admissions.hadm_id WHERE DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND t1.hadm_id = t2.hadm_id GROUP BY t2.itemid) AS t3 WHERE t3.c1 <= 3)
WITH "t2" AS (SELECT "admissions"."subject_id", "labevents"."itemid", "labevents"."charttime", "admissions"."hadm_id" FROM "labevents" JOIN "admissions" ON "admissions"."hadm_id" = "labevents"."hadm_id" WHERE DATETIME("labevents"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')), "t3" AS (SELECT "t2"."itemid", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'spleen injury nos-open' JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" JOIN "t2" "t2" ON "admissions"."hadm_id" = "t2"."hadm_id" AND "admissions"."subject_id" = "t2"."subject_id" AND "diagnoses_icd"."charttime" < "t2"."charttime" WHERE DATETIME("diagnoses_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY "t2"."itemid"), "_u_1" AS (SELECT "t3"."itemid" FROM "t3" "t3" WHERE "t3"."c1" <= 3 GROUP BY "itemid") SELECT "d_labitems"."label" FROM "d_labitems" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "d_labitems"."itemid" WHERE NOT "_u_1"."" IS NULL
1.134766
CREATE TABLE table_name_89 (name VARCHAR2, snatch VARCHAR2, bodyweight VARCHAR2, total__kg_ VARCHAR2, clean_ VARCHAR2, _jerk VARCHAR2)
Which name had a bodyweight bigger than 89.64, a total (kg) bigger than 310, a clean and jerk less than 207.5, and a snatch that is bigger than 165?
SELECT name FROM table_name_89 WHERE bodyweight > 89.64 AND total__kg_ > 310 AND clean_ & _jerk < 207.5 AND snatch > 165
SELECT "name" FROM "table_name_89" WHERE "bodyweight" > 89.64 AND "snatch" > 165 AND "total__kg_" > 310 AND "clean_" & "_jerk" < 207.5
0.130859
CREATE TABLE table_8096 ("Player" CLOB, "Nationality" CLOB, "Jersey Number ( s ) " FLOAT, "Position" CLOB, "Years" CLOB, "From" CLOB)
What is the Nationality from Providence?
SELECT "Nationality" FROM table_8096 WHERE "From" = 'providence'
SELECT "Nationality" FROM "table_8096" WHERE "From" = 'providence'
0.064453
CREATE TABLE table_13820 ("Week" FLOAT, "Date" CLOB, "Opponent" CLOB, "Result" CLOB, "Record" CLOB, "TV Time" CLOB, "Attendance" CLOB)
what is the attendance on october 19, 2003?
SELECT "Attendance" FROM table_13820 WHERE "Date" = 'october 19, 2003'
SELECT "Attendance" FROM "table_13820" WHERE "Date" = 'october 19, 2003'
0.070313
CREATE TABLE apartment_buildings (building_id NUMBER, building_short_name CLOB, building_full_name CLOB, building_description CLOB, building_address CLOB, building_manager CLOB, building_phone CLOB) CREATE TABLE apartments (apt_id NUMBER, building_id NUMBER, apt_type_code CLOB, apt_number CLOB, bathroom_count NUMBER, bedroom_count NUMBER, room_count CLOB) CREATE TABLE guests (guest_id NUMBER, gender_code CLOB, guest_first_name CLOB, guest_last_name CLOB, date_of_birth TIME) CREATE TABLE apartment_bookings (apt_booking_id NUMBER, apt_id NUMBER, guest_id NUMBER, booking_status_code CLOB, booking_start_date TIME, booking_end_date TIME) CREATE TABLE apartment_facilities (apt_id NUMBER, facility_code CLOB) CREATE TABLE view_unit_status (apt_id NUMBER, apt_booking_id NUMBER, status_date TIME, available_yn others)
Which guests have apartment bookings with status code 'Confirmed'? Return their first names and last names.
SELECT T2.guest_first_name, T2.guest_last_name FROM apartment_bookings AS T1 JOIN guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = "Confirmed"
SELECT "T2"."guest_first_name", "T2"."guest_last_name" FROM "apartment_bookings" "T1" JOIN "guests" "T2" ON "T1"."guest_id" = "T2"."guest_id" WHERE "Confirmed" = "T1"."booking_status_code"
0.183594
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 procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
calculate the average of female patients who have medicaid health insurance.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.insurance = "Medicaid"
SELECT AVG("demographic"."age") FROM "demographic" WHERE "F" = "demographic"."gender" AND "Medicaid" = "demographic"."insurance"
0.125
CREATE TABLE table_47941 ("Tournament" CLOB, "Country" CLOB, "Location" CLOB, "Current Venue" CLOB, "Began" FLOAT, "Court surface" CLOB)
What country was the Paris Masters tournament played in?
SELECT "Country" FROM table_47941 WHERE "Tournament" = 'paris masters'
SELECT "Country" FROM "table_47941" WHERE "Tournament" = 'paris masters'
0.070313
CREATE TABLE takes (ID VARCHAR2, course_id VARCHAR2, sec_id VARCHAR2, semester VARCHAR2, year NUMBER, grade VARCHAR2) CREATE TABLE course (course_id VARCHAR2, title VARCHAR2, dept_name VARCHAR2, credits NUMBER) CREATE TABLE department (dept_name VARCHAR2, building VARCHAR2, budget NUMBER) CREATE TABLE time_slot (time_slot_id VARCHAR2, day VARCHAR2, start_hr NUMBER, start_min NUMBER, end_hr NUMBER, end_min NUMBER) CREATE TABLE student (ID VARCHAR2, name VARCHAR2, dept_name VARCHAR2, tot_cred NUMBER) CREATE TABLE advisor (s_ID VARCHAR2, i_ID VARCHAR2) CREATE TABLE instructor (ID VARCHAR2, name VARCHAR2, dept_name VARCHAR2, salary NUMBER) CREATE TABLE prereq (course_id VARCHAR2, prereq_id VARCHAR2) CREATE TABLE section (course_id VARCHAR2, sec_id VARCHAR2, semester VARCHAR2, year NUMBER, building VARCHAR2, room_number VARCHAR2, time_slot_id VARCHAR2) CREATE TABLE teaches (ID VARCHAR2, course_id VARCHAR2, sec_id VARCHAR2, semester VARCHAR2, year NUMBER) CREATE TABLE classroom (building VARCHAR2, room_number VARCHAR2, capacity NUMBER)
Return a bar chart about the distribution of dept_name and the amount of dept_name , and group by attribute dept_name.
SELECT dept_name, COUNT(dept_name) FROM instructor GROUP BY dept_name ORDER BY salary
SELECT "dept_name", COUNT("dept_name") FROM "instructor" GROUP BY "dept_name" ORDER BY "salary"
0.092773
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER) CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of founder and the sum of manufacturer , and group by attribute founder, and sort by the Y from high to low.
SELECT Founder, SUM(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Manufacturer) DESC
SELECT "Founder", SUM("Manufacturer") FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Founder" ORDER BY SUM("Manufacturer") DESC
0.169922
CREATE TABLE addresses (address_id NUMBER, line_1 CLOB, line_2 CLOB, city CLOB, zip_postcode CLOB, state_province_county CLOB, country CLOB) CREATE TABLE candidates (candidate_id NUMBER, candidate_details CLOB) CREATE TABLE student_course_registrations (student_id NUMBER, course_id NUMBER, registration_date TIME) CREATE TABLE courses (course_id CLOB, course_name CLOB, course_description CLOB, other_details CLOB) CREATE TABLE students (student_id NUMBER, student_details CLOB) CREATE TABLE people_addresses (person_address_id NUMBER, person_id NUMBER, address_id NUMBER, date_from TIME, date_to TIME) CREATE TABLE people (person_id NUMBER, first_name CLOB, middle_name CLOB, last_name CLOB, cell_mobile_number CLOB, email_address CLOB, login_name CLOB, password CLOB) CREATE TABLE candidate_assessments (candidate_id NUMBER, qualification CLOB, assessment_date TIME, asessment_outcome_code CLOB) CREATE TABLE student_course_attendance (student_id NUMBER, course_id NUMBER, date_of_attendance TIME)
Find the cell mobile number of the candidates whose assessment code is 'Fail'?
SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail"
SELECT "T3"."cell_mobile_number" FROM "candidates" "T1" JOIN "candidate_assessments" "T2" ON "Fail" = "T2"."asessment_outcome_code" AND "T1"."candidate_id" = "T2"."candidate_id" JOIN "people" "T3" ON "T1"."candidate_id" = "T3"."person_id"
0.232422
CREATE TABLE table_36346 ("Throne Name" CLOB, "Title" CLOB, "Born-Died" CLOB, "Entered office" CLOB, "Left office" CLOB, "Family Relations" CLOB)
When did the king who entered office in 1012 leave office?
SELECT "Left office" FROM table_36346 WHERE "Entered office" = '1012'
SELECT "Left office" FROM "table_36346" WHERE "Entered office" = '1012'
0.069336
CREATE TABLE table_203_859 (id NUMBER, "game" NUMBER, "date" CLOB, "visitor" CLOB, "score" CLOB, "home" CLOB, "decision" CLOB, "attendance" NUMBER, "record" CLOB, "points" NUMBER)
give the number of attendance for the philadelphia flyers in the 1973-74 year ?
SELECT "attendance" FROM table_203_859 WHERE "home" = 'philadelphia'
SELECT "attendance" FROM "table_203_859" WHERE "home" = 'philadelphia'
0.068359
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 diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) 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_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 labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom 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 d_labitems (row_id NUMBER, itemid NUMBER, label 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 procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE 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_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER)
is the arterial bp [diastolic] of patient 1462 last measured on the last intensive care unit visit greater than second to last measured on the last intensive care unit visit.
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1462) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [diastolic]' AND d_items.linksto = 'chartevents') ORDER BY chartevents.charttime DESC LIMIT 1) > (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1462) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [diastolic]' AND d_items.linksto = 'chartevents') ORDER BY chartevents.charttime DESC LIMIT 1 OFFSET 1)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 1462 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 AND NOT "icustays"."outtime" IS NULL GROUP BY "icustay_id" ORDER BY "icustays"."intime" DESC FETCH FIRST 1 ROWS ONLY), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'arterial bp [diastolic]' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid"), "_u_5" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" "_u_4" ON "_u_4"."" = "icustays"."hadm_id" WHERE NOT "_u_4"."" IS NULL AND NOT "icustays"."outtime" IS NULL GROUP BY "icustay_id" ORDER BY "icustays"."intime" DESC FETCH FIRST 1 ROWS ONLY) SELECT (SELECT "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 NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL ORDER BY "chartevents"."charttime" DESC FETCH FIRST 1 ROWS ONLY) > (SELECT "chartevents"."valuenum" FROM "chartevents" LEFT JOIN "_u_5" "_u_5" ON "_u_5"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" "_u_6" ON "_u_6"."" = "chartevents"."itemid" WHERE NOT "_u_5"."" IS NULL AND NOT "_u_6"."" IS NULL ORDER BY "chartevents"."charttime" DESC OFFSET 1 ROWS FETCH FIRST 1 ROWS ONLY)
1.40332
CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) 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) 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 d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE 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 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 d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_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) 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 procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB)
when was patient 25300 first measured heart rate since 02/20/2104?
SELECT chartevents.charttime 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 = 25300)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' AND d_items.linksto = 'chartevents') AND STRFTIME('%y-%m-%d', chartevents.charttime) >= '2104-02-20' ORDER BY chartevents.charttime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 25300 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" = 'heart rate' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT "chartevents"."charttime" 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 NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m-%d', "chartevents"."charttime") >= '2104-02-20' ORDER BY "chartevents"."charttime" FETCH FIRST 1 ROWS ONLY
0.786133
CREATE TABLE table_name_66 (Id VARCHAR2)
What 2009 has statistics by surface in 2012?
SELECT 2009 FROM table_name_66 WHERE 2012 = "statistics by surface"
SELECT 2009 FROM "table_name_66" WHERE "statistics by surface" = 2012
0.067383
CREATE TABLE table_name_62 (away_team VARCHAR2, venue VARCHAR2)
What was the away team score at victoria park?
SELECT away_team AS score FROM table_name_62 WHERE venue = "victoria park"
SELECT "away_team" AS "score" FROM "table_name_62" WHERE "venue" = "victoria park"
0.080078
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB)
what number of patients whose procedure icd9 code is 4610 expired in or before the year 2186?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2186.0" AND procedures.icd9_code = "4610"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "4610" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2186.0" >= "demographic"."dod_year"
0.213867
CREATE TABLE HOTELS (price_range VARCHAR2, star_rating_code VARCHAR2)
Show the price ranges of hotels with 5 star ratings.
SELECT price_range FROM HOTELS WHERE star_rating_code = "5"
SELECT "price_range" FROM "HOTELS" WHERE "5" = "star_rating_code"
0.063477
CREATE TABLE cast (id NUMBER, msid NUMBER, aid NUMBER, role CLOB) CREATE TABLE actor (aid NUMBER, gender CLOB, name CLOB, nationality CLOB, birth_city CLOB, birth_year NUMBER) CREATE TABLE director (did NUMBER, gender CLOB, name CLOB, nationality CLOB, birth_city CLOB, birth_year NUMBER) CREATE TABLE copyright (id NUMBER, msid NUMBER, cid NUMBER) CREATE TABLE keyword (id NUMBER, keyword CLOB) CREATE TABLE directed_by (id NUMBER, msid NUMBER, did NUMBER) CREATE TABLE classification (id NUMBER, msid NUMBER, gid NUMBER) CREATE TABLE made_by (id NUMBER, msid NUMBER, pid NUMBER) CREATE TABLE writer (wid NUMBER, gender CLOB, name CLOB, nationality CLOB, birth_city CLOB, birth_year NUMBER) CREATE TABLE written_by (id NUMBER, msid NUMBER, wid NUMBER) CREATE TABLE movie (mid NUMBER, title CLOB, release_year NUMBER, title_aka CLOB, budget CLOB) CREATE TABLE producer (pid NUMBER, gender CLOB, name CLOB, nationality CLOB, birth_city CLOB, birth_year NUMBER) CREATE TABLE company (id NUMBER, name CLOB, country_code VARCHAR2) CREATE TABLE genre (gid NUMBER, genre CLOB) CREATE TABLE tags (id NUMBER, msid NUMBER, kid NUMBER) CREATE TABLE tv_series (sid NUMBER, title CLOB, release_year NUMBER, num_of_seasons NUMBER, num_of_episodes NUMBER, title_aka CLOB, budget CLOB)
What are the series featuring ' Kerry Washington ' ?
SELECT tv_series.title FROM actor, cast, tv_series WHERE actor.name = 'Kerry Washington' AND cast.aid = actor.aid AND tv_series.sid = cast.msid
SELECT "tv_series"."title" FROM "actor" JOIN "cast" ON "actor"."aid" = "cast"."aid" JOIN "tv_series" ON "cast"."msid" = "tv_series"."sid" WHERE "actor"."name" = 'Kerry Washington'
0.174805
CREATE TABLE table_31676 ("Cellist" CLOB, "Orchestra" CLOB, "Conductor" CLOB, "Record Company" CLOB, "Year of Recording" FLOAT, "Format" CLOB)
What is the oldest year that the Royal Philharmonic Orchestra released a record with Decca Records?
SELECT MIN("Year of Recording") FROM table_31676 WHERE "Orchestra" = 'royal philharmonic orchestra' AND "Record Company" = 'decca records'
SELECT MIN("Year of Recording") FROM "table_31676" WHERE "Orchestra" = 'royal philharmonic orchestra' AND "Record Company" = 'decca records'
0.136719
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 stadium (ID NUMBER, name CLOB, Capacity NUMBER, City CLOB, Country CLOB, Opening_year NUMBER) CREATE TABLE event (ID NUMBER, Name CLOB, Stadium_ID NUMBER, Year CLOB)
Draw a bar chart about the distribution of meter_500 and ID , rank by the ID in asc.
SELECT meter_500, ID FROM swimmer ORDER BY ID
SELECT "meter_500", "ID" FROM "swimmer" ORDER BY "ID"
0.051758
CREATE TABLE table_19939 ("Series Ep." CLOB, "Episode" FLOAT, "Netflix" CLOB, "Segment A" CLOB, "Segment B" CLOB, "Segment C" CLOB, "Segment D" CLOB)
Name the segment d for chicken
SELECT "Segment D" FROM table_19939 WHERE "Segment C" = 'Chicken'
SELECT "Segment D" FROM "table_19939" WHERE "Segment C" = 'Chicken'
0.06543
CREATE TABLE table_17345 ("#" FLOAT, "Date" CLOB, "Visitor" CLOB, "Score" CLOB, "Home" CLOB, "Leading scorer" CLOB, "Attendance" CLOB, "Record" CLOB, "Streak" CLOB)
What is the number of leading scorer of february 21?
SELECT COUNT("Leading scorer") FROM table_17345 WHERE "Date" = 'February 21'
SELECT COUNT("Leading scorer") FROM "table_17345" WHERE "Date" = 'February 21'
0.076172
CREATE TABLE table_50470 ("School Year" CLOB, "Football" CLOB, "Cross Country" CLOB, "Soccer" CLOB, "Golf" CLOB)
Which foot ball team played soccer at wooster, and Gold in Ashland?
SELECT "Football" FROM table_50470 WHERE "Soccer" = 'wooster' AND "Golf" = 'ashland'
SELECT "Football" FROM "table_50470" WHERE "Golf" = 'ashland' AND "Soccer" = 'wooster'
0.083984
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) 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 the number of patients whose discharge location is home and days of hospital stay is greater than 15?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.days_stay > "15"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "15" < "demographic"."days_stay" AND "HOME" = "demographic"."discharge_location"
0.151367
CREATE TABLE table_21234111_6 (song VARCHAR2, scoreboard VARCHAR2)
Name the number of song for scoreboard being 3rd
SELECT COUNT(song) FROM table_21234111_6 WHERE scoreboard = "3rd"
SELECT COUNT("song") FROM "table_21234111_6" WHERE "3rd" = "scoreboard"
0.069336
CREATE TABLE table_47177 ("Date" CLOB, "Visitor" CLOB, "Score" CLOB, "Home" CLOB, "Record" CLOB)
WHAT IS THE VISITOR FOR FEBRUARY 9?
SELECT "Visitor" FROM table_47177 WHERE "Date" = 'february 9'
SELECT "Visitor" FROM "table_47177" WHERE "Date" = 'february 9'
0.061523
CREATE TABLE table_name_12 (host VARCHAR2, venue VARCHAR2, year VARCHAR2, state VARCHAR2)
What is the host in a year greater than 1989 and when the venue is the Staples Center located in California?
SELECT host FROM table_name_12 WHERE year > 1989 AND state = "california" AND venue = "staples center"
SELECT "host" FROM "table_name_12" WHERE "california" = "state" AND "staples center" = "venue" AND "year" > 1989
0.109375
CREATE TABLE candidate (Candidate_ID NUMBER, People_ID NUMBER, Poll_Source CLOB, Date CLOB, Support_rate FLOAT, Consider_rate FLOAT, Oppose_rate FLOAT, Unsure_rate FLOAT) CREATE TABLE people (People_ID NUMBER, Sex CLOB, Name CLOB, Date_of_Birth CLOB, Height FLOAT, Weight FLOAT)
A bar chart shows the distribution of Name and Weight .
SELECT Name, Weight FROM people
SELECT "Name", "Weight" FROM "people"
0.036133
CREATE TABLE table_8282 ("Player" CLOB, "Position" CLOB, "League" FLOAT, "Copa del Rey" FLOAT, "Champions League" FLOAT, "Total" FLOAT)
What is the average Champions League assists for the players with League assists under 4?
SELECT AVG("Champions League") FROM table_8282 WHERE "League" < '4'
SELECT AVG("Champions League") FROM "table_8282" WHERE "League" < '4'
0.067383
CREATE TABLE table_15373 ("Place" FLOAT, "Team" CLOB, "Played" FLOAT, "Draw" FLOAT, "Lost" FLOAT, "Goals Scored" FLOAT, "Goals Conceded" FLOAT, "Points" FLOAT)
How many goals were scored when they had over 28 points and played over 18 games?
SELECT MAX("Goals Scored") FROM table_15373 WHERE "Points" > '28' AND "Played" > '18'
SELECT MAX("Goals Scored") FROM "table_15373" WHERE "Played" > '18' AND "Points" > '28'
0.084961
CREATE TABLE table_13762472_7 (score VARCHAR2, location_attendance VARCHAR2)
What was the score when the heat played at charlotte arena?
SELECT score FROM table_13762472_7 WHERE location_attendance = "Charlotte Arena"
SELECT "score" FROM "table_13762472_7" WHERE "Charlotte Arena" = "location_attendance"
0.083984
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 procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
how many patients taking drug via buccal route have the diagnoses of antifungal antibiotics causing adverse effects in therapeutic use?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Adv eff antifung antbiot" AND prescriptions.route = "BUCCAL"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Adv eff antifung antbiot" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "prescriptions" ON "BUCCAL" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.302734
CREATE TABLE table_39908 ("Number" FLOAT, "Builder" CLOB, "Type" CLOB, "Date" CLOB, "Works number" CLOB)
Which Date has a Type of 4-6-0, and a Number larger than 11?
SELECT "Date" FROM table_39908 WHERE "Type" = '4-6-0' AND "Number" > '11'
SELECT "Date" FROM "table_39908" WHERE "Number" > '11' AND "Type" = '4-6-0'
0.073242
CREATE TABLE table_name_61 (lost VARCHAR2, against VARCHAR2, drawn VARCHAR2, points VARCHAR2)
How much Lost has a Drawn larger than 1, and Points smaller than 14, and an Against larger than 10?
SELECT COUNT(lost) FROM table_name_61 WHERE drawn > 1 AND points < 14 AND against > 10
SELECT COUNT("lost") FROM "table_name_61" WHERE "against" > 10 AND "drawn" > 1 AND "points" < 14
0.09375
CREATE TABLE table_name_53 (score VARCHAR2, bowl_game VARCHAR2)
What was the score of the Insight Bowl?
SELECT score FROM table_name_53 WHERE bowl_game = "insight bowl"
SELECT "score" FROM "table_name_53" WHERE "bowl_game" = "insight bowl"
0.068359
CREATE TABLE table_name_47 (year NUMBER, result VARCHAR2)
Name the average year for result of nominated
SELECT AVG(year) FROM table_name_47 WHERE result = "nominated"
SELECT AVG("year") FROM "table_name_47" WHERE "nominated" = "result"
0.066406
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 d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_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 outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime 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 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 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 d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto 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)
get me patient 6215's yearly maximum weight until 09/2103.
SELECT MAX(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 = 6215)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') AND STRFTIME('%y-%m', chartevents.charttime) <= '2103-09' GROUP BY STRFTIME('%y', chartevents.charttime)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 6215 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 MAX("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 NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m', "chartevents"."charttime") <= '2103-09' GROUP BY STRFTIME('%y', "chartevents"."charttime")
0.773438