schema
stringlengths
28
5.65k
question
stringlengths
0
990
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
9.17k
weight
float64
0
8.95
CREATE TABLE table_74197 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
Who had the high points when the team was charlotte?
SELECT "High points" FROM table_74197 WHERE "Team" = 'Charlotte'
SELECT "High points" FROM "table_74197" WHERE "Team" = 'Charlotte'
0.064453
CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR)
To complete my graduation is MEDCHEM 532 necessary ?
SELECT COUNT(*) > 0 FROM course, program_course WHERE course.department = 'MEDCHEM' AND course.number = 532 AND program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id
SELECT COUNT(*) > 0 FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%Core%' WHERE "course"."department" = 'MEDCHEM' AND "course"."number" = 532
0.21875
CREATE TABLE weather (date TEXT, max_temperature_f INT, mean_temperature_f INT, min_temperature_f INT, max_dew_point_f INT, mean_dew_point_f INT, min_dew_point_f INT, max_humidity INT, mean_humidity INT, min_humidity INT, max_sea_level_pressure_inches DECIMAL, mean_sea_level_pressure_inches DECIMAL, min_sea_level_pressure_inches DECIMAL, max_visibility_miles INT, mean_visibility_miles INT, min_visibility_miles INT, max_wind_Speed_mph INT, mean_wind_speed_mph INT, max_gust_speed_mph INT, precipitation_inches INT, cloud_cover INT, events TEXT, wind_dir_degrees INT, zip_code INT) CREATE TABLE trip (id INT, duration INT, start_date TEXT, start_station_name TEXT, start_station_id INT, end_date TEXT, end_station_name TEXT, end_station_id INT, bike_id INT, subscription_type TEXT, zip_code INT) CREATE TABLE status (station_id INT, bikes_available INT, docks_available INT, time TEXT) CREATE TABLE station (id INT, name TEXT, lat DECIMAL, long DECIMAL, dock_count INT, city TEXT, installation_date TEXT)
What are the dates that have an average sea level pressure between 303 and 31, and count them by a bar chart, and I want to display by the the number of date from low to high.
SELECT date, COUNT(date) FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 ORDER BY COUNT(date)
SELECT "date", COUNT("date") FROM "weather" WHERE "mean_sea_level_pressure_inches" <= 31 AND "mean_sea_level_pressure_inches" >= 30.3 ORDER BY COUNT("date") NULLS FIRST
0.164063
CREATE TABLE table_68209 ("Number" FLOAT, "Name of the song" TEXT, "Singer" TEXT, "Drama" TEXT, "Kind of the song" TEXT)
What type of song is larger than 8 and named ?
SELECT "Kind of the song" FROM table_68209 WHERE "Number" > '8' AND "Name of the song" = '實情'
SELECT "Kind of the song" FROM "table_68209" WHERE "Name of the song" = '實情' AND "Number" > '8'
0.092773
CREATE TABLE table_name_1 (winner VARCHAR, winning_song VARCHAR)
Who won with the song kemenangan cinta?
SELECT winner FROM table_name_1 WHERE winning_song = "kemenangan cinta"
SELECT "winner" FROM "table_name_1" WHERE "kemenangan cinta" = "winning_song"
0.075195
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
tell me the change in weight in patient 11579 last measured on the first hospital visit compared to the first value measured on the first hospital 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 = 11579 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' 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 = 11579 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') ORDER BY chartevents.charttime LIMIT 1)
WITH "_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 (SELECT "chartevents"."valuenum" FROM "chartevents" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" 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" = 11579 AND NOT "admissions"."dischtime" IS NULL ORDER BY "admissions"."admittime" NULLS FIRST LIMIT 1)) AND NOT "_u_2"."" IS NULL ORDER BY "chartevents"."charttime" DESC NULLS LAST LIMIT 1) - (SELECT "chartevents"."valuenum" FROM "chartevents" LEFT JOIN "_u_2" AS "_u_6" ON "_u_6"."" = "chartevents"."itemid" 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" = 11579 AND NOT "admissions"."dischtime" IS NULL ORDER BY "admissions"."admittime" NULLS FIRST LIMIT 1)) AND NOT "_u_6"."" IS NULL ORDER BY "chartevents"."charttime" NULLS FIRST LIMIT 1)
1.135742
CREATE TABLE table_33604 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What was the score for the home team of essendon?
SELECT "Home team score" FROM table_33604 WHERE "Home team" = 'essendon'
SELECT "Home team score" FROM "table_33604" WHERE "Home team" = 'essendon'
0.072266
CREATE TABLE table_76169 ("Year" TEXT, "Winner" TEXT, "Points" FLOAT, "Playoff result" TEXT, "Win #" FLOAT)
What is the lowest Win #, when Year is '2011-12', and when Points is less than 97?
SELECT MIN("Win #") FROM table_76169 WHERE "Year" = '2011-12' AND "Points" < '97'
SELECT MIN("Win #") FROM "table_76169" WHERE "Points" < '97' AND "Year" = '2011-12'
0.081055
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
how many prescriptions have been ordered for oxycodone-acetaminophen elixir until 3 years ago?
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.drug = 'oxycodone-acetaminophen elixir' AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-3 year')
SELECT COUNT(*) FROM "prescriptions" WHERE "prescriptions"."drug" = 'oxycodone-acetaminophen elixir' AND DATETIME("prescriptions"."startdate") <= DATETIME(CURRENT_TIME(), '-3 year')
0.176758
CREATE TABLE wine (No INT, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INT, Price INT, Score INT, Cases INT, Drink TEXT) CREATE TABLE grapes (ID INT, Grape TEXT, Color TEXT) CREATE TABLE appellations (No INT, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT)
Display a bar chart for what are the numbers of wines for different grapes?, display by the the total number in desc please.
SELECT Grape, COUNT(*) FROM wine GROUP BY Grape ORDER BY COUNT(*) DESC
SELECT "Grape", COUNT(*) FROM "wine" GROUP BY "Grape" ORDER BY COUNT(*) DESC NULLS LAST
0.084961
CREATE TABLE table_1341663_6 (result VARCHAR, district VARCHAR)
How many outcomes were there in the elections in California 38?
SELECT COUNT(result) FROM table_1341663_6 WHERE district = "California 38"
SELECT COUNT("result") FROM "table_1341663_6" WHERE "California 38" = "district"
0.078125
CREATE TABLE table_name_19 (winner VARCHAR, city VARCHAR)
Who is the Winner, when the City is Berlin?
SELECT winner FROM table_name_19 WHERE city = "berlin"
SELECT "winner" FROM "table_name_19" WHERE "berlin" = "city"
0.058594
CREATE TABLE table_75537 ("Round" FLOAT, "Pick #" FLOAT, "Overall" FLOAT, "Name" TEXT, "Position" TEXT, "College" TEXT)
What is the Position with a round 3 pick for r. jay soward?
SELECT "Position" FROM table_75537 WHERE "Round" < '3' AND "Name" = 'r. jay soward'
SELECT "Position" FROM "table_75537" WHERE "Name" = 'r. jay soward' AND "Round" < '3'
0.083008
CREATE TABLE table_3764 ("Artist" TEXT, "Country" TEXT, "Number-one single ( s ) " TEXT, "Year" FLOAT, "Weeks at #1" FLOAT, "Straight to #1 ?" TEXT)
Name the number one singles for desvarieux, jacob
SELECT "Number-one single(s)" FROM table_3764 WHERE "Artist" = 'Desvarieux, Jacob'
SELECT "Number-one single(s)" FROM "table_3764" WHERE "Artist" = 'Desvarieux, Jacob'
0.082031
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many of the patients aged below 72 received td therapy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "72" AND prescriptions.route = "TD"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "TD" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "72" > "demographic"."age"
0.207031
CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL)
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a line chart about the change of manager_id over hire_date , and display x-axis in asc order please.
SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE
SELECT "HIRE_DATE", "MANAGER_ID" FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100) ORDER BY "HIRE_DATE" NULLS FIRST
0.200195
CREATE TABLE table_name_19 (years_for_grizzlies VARCHAR, school_club_team VARCHAR)
What year were the Grizzlies in Providence?
SELECT years_for_grizzlies FROM table_name_19 WHERE school_club_team = "providence"
SELECT "years_for_grizzlies" FROM "table_name_19" WHERE "providence" = "school_club_team"
0.086914
CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR, DEPT_NAME VARCHAR, SCHOOL_CODE VARCHAR, EMP_NUM INT, DEPT_ADDRESS VARCHAR, DEPT_EXTENSION VARCHAR) CREATE TABLE ENROLL (CLASS_CODE VARCHAR, STU_NUM INT, ENROLL_GRADE VARCHAR) CREATE TABLE EMPLOYEE (EMP_NUM INT, EMP_LNAME VARCHAR, EMP_FNAME VARCHAR, EMP_INITIAL VARCHAR, EMP_JOBCODE VARCHAR, EMP_HIREDATE DATETIME, EMP_DOB DATETIME) CREATE TABLE CLASS (CLASS_CODE VARCHAR, CRS_CODE VARCHAR, CLASS_SECTION VARCHAR, CLASS_TIME VARCHAR, CLASS_ROOM VARCHAR, PROF_NUM INT) CREATE TABLE PROFESSOR (EMP_NUM INT, DEPT_CODE VARCHAR, PROF_OFFICE VARCHAR, PROF_EXTENSION VARCHAR, PROF_HIGH_DEGREE VARCHAR) CREATE TABLE STUDENT (STU_NUM INT, STU_LNAME VARCHAR, STU_FNAME VARCHAR, STU_INIT VARCHAR, STU_DOB DATETIME, STU_HRS INT, STU_CLASS VARCHAR, STU_GPA FLOAT, STU_TRANSFER DECIMAL, DEPT_CODE VARCHAR, STU_PHONE VARCHAR, PROF_NUM INT) CREATE TABLE COURSE (CRS_CODE VARCHAR, DEPT_CODE VARCHAR, CRS_DESCRIPTION VARCHAR, CRS_CREDIT FLOAT)
How many sections does each course has Visualize by bar chart, and list in descending by the X-axis.
SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE ORDER BY CRS_CODE DESC
SELECT "CRS_CODE", COUNT(*) FROM "CLASS" GROUP BY "CRS_CODE" ORDER BY "CRS_CODE" DESC NULLS LAST
0.09375
CREATE TABLE table_name_19 (result VARCHAR, date VARCHAR)
Name the result for january 14, 2008
SELECT result FROM table_name_19 WHERE date = "january 14, 2008"
SELECT "result" FROM "table_name_19" WHERE "date" = "january 14, 2008"
0.068359
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many female patients had the procedure long title percutaneous transluminal coronary angioplasty (ptca)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "F" AND procedures.long_title = "Percutaneous transluminal coronary angioplasty [PTCA]"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Percutaneous transluminal coronary angioplasty [PTCA]" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "F" = "demographic"."gender"
0.254883
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
select Id,DisplayName,Reputation,Views,UpVotes,DownVotes from Users where DisplayName like %Jon%;.
SELECT Id, DisplayName, Reputation, Views, UpVotes, DownVotes FROM Users ORDER BY Reputation DESC
SELECT "Id", "DisplayName", "Reputation", "Views", "UpVotes", "DownVotes" FROM "Users" ORDER BY "Reputation" DESC NULLS LAST
0.121094
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
users eligible to nominate themselves for moderator elections..
SELECT DisplayName, Reputation FROM Users WHERE Reputation > 300 ORDER BY Reputation DESC
SELECT "DisplayName", "Reputation" FROM "Users" WHERE "Reputation" > 300 ORDER BY "Reputation" DESC NULLS LAST
0.107422
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
what is the number of patients whose hospital stay is above 7 days and diagnosed with single ib in-hosp w cs?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "7" AND diagnoses.short_title = "Single lb in-hosp w cs"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Single lb in-hosp w cs" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "7" < "demographic"."days_stay"
0.225586
CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
how long is the last stay of patient 013-36766 in the icu?
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-36766') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '013-36766' GROUP BY "patienthealthsystemstayid") SELECT STRFTIME('%j', "patient"."unitdischargetime") - STRFTIME('%j', "patient"."unitadmittime") FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitadmittime" IS NULL ORDER BY "patient"."unitadmittime" DESC NULLS LAST LIMIT 1
0.464844
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
what was the total number of patients staying in ward 517 since 6 years ago?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.wardid = 517 AND DATETIME(patient.unitadmittime) >= DATETIME(CURRENT_TIME(), '-6 year')
SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" WHERE "patient"."wardid" = 517 AND DATETIME("patient"."unitadmittime") >= DATETIME(CURRENT_TIME(), '-6 year')
0.165039
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
what is the prescription drug that patient 009-12985 was prescribed for within 2 days after receiving nasogastric tube until 68 months ago?
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-12985') AND treatment.treatmentname = 'nasogastric tube' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-68 month')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-12985') AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-68 month')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.drugstarttime AND DATETIME(t2.drugstarttime) BETWEEN DATETIME(t1.treatmenttime) AND DATETIME(t1.treatmenttime, '+2 day')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '009-12985' GROUP BY "patienthealthsystemstayid"), "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_1" ON "_u_1"."" = "patient"."patienthealthsystemstayid" WHERE DATETIME("medication"."drugstarttime") <= DATETIME(CURRENT_TIME(), '-68 month') AND NOT "_u_1"."" IS NULL) SELECT "t2"."drugname" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" JOIN "t2" AS "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND "t2"."drugstarttime" > "treatment"."treatmenttime" AND DATETIME("t2"."drugstarttime") <= DATETIME("treatment"."treatmenttime", '+2 day') AND DATETIME("t2"."drugstarttime") >= DATETIME("treatment"."treatmenttime") WHERE "treatment"."treatmentname" = 'nasogastric tube' AND DATETIME("treatment"."treatmenttime") <= DATETIME(CURRENT_TIME(), '-68 month') AND NOT "_u_0"."" IS NULL
1.160156
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
what's the number of inputs patient 15447 has received today?
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15447)) AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 15447 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id") SELECT SUM("inputevents_cv"."amount") FROM "inputevents_cv" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" WHERE DATETIME("inputevents_cv"."charttime", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') AND NOT "_u_1"."" IS NULL
0.554688
CREATE TABLE table_74408 ("Institution" TEXT, "Location" TEXT, "Mascot" TEXT, "Colors" TEXT, "Affiliation" TEXT, "9\\u201312 enrollment" FLOAT, "School website" TEXT)
What are the team colors from Tolono, Illinois?
SELECT "Colors" FROM table_74408 WHERE "Location" = 'Tolono, Illinois'
SELECT "Colors" FROM "table_74408" WHERE "Location" = 'Tolono, Illinois'
0.070313
CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT)
How many classes are being offered next semester ?
SELECT COUNT(DISTINCT course_offering.course_id) FROM course_offering, semester WHERE semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
SELECT COUNT(DISTINCT "course_offering"."course_id") FROM "course_offering" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'FA' AND "semester"."year" = 2016
0.207031
CREATE TABLE table_62230 ("Round" FLOAT, "Player" TEXT, "Position" TEXT, "Nationality" TEXT, "College/Junior/Club Team ( League ) " TEXT)
what is the college/junior/club team (league) when the round is higher than 1, the nationality is canada and the position is (d)?
SELECT "College/Junior/Club Team (League)" FROM table_62230 WHERE "Round" > '1' AND "Nationality" = 'canada' AND "Position" = '(d)'
SELECT "College/Junior/Club Team (League)" FROM "table_62230" WHERE "Nationality" = 'canada' AND "Position" = '(d)' AND "Round" > '1'
0.129883
CREATE TABLE table_26108103_2 (year INT)
What was the earliest year?
SELECT MIN(year) FROM table_26108103_2
SELECT MIN("year") FROM "table_26108103_2"
0.041016
CREATE TABLE MediaType (MediaTypeId INT, Name VARCHAR) CREATE TABLE PlaylistTrack (PlaylistId INT, TrackId INT) CREATE TABLE Genre (GenreId INT, Name VARCHAR) CREATE TABLE Artist (ArtistId INT, Name VARCHAR) CREATE TABLE Track (TrackId INT, Name VARCHAR, AlbumId INT, MediaTypeId INT, GenreId INT, Composer VARCHAR, Milliseconds INT, Bytes INT, UnitPrice DECIMAL) CREATE TABLE InvoiceLine (InvoiceLineId INT, InvoiceId INT, TrackId INT, UnitPrice DECIMAL, Quantity INT) CREATE TABLE Employee (EmployeeId INT, LastName VARCHAR, FirstName VARCHAR, Title VARCHAR, ReportsTo INT, BirthDate DATETIME, HireDate DATETIME, Address VARCHAR, City VARCHAR, State VARCHAR, Country VARCHAR, PostalCode VARCHAR, Phone VARCHAR, Fax VARCHAR, Email VARCHAR) CREATE TABLE Invoice (InvoiceId INT, CustomerId INT, InvoiceDate DATETIME, BillingAddress VARCHAR, BillingCity VARCHAR, BillingState VARCHAR, BillingCountry VARCHAR, BillingPostalCode VARCHAR, Total DECIMAL) CREATE TABLE Playlist (PlaylistId INT, Name VARCHAR) CREATE TABLE Customer (CustomerId INT, FirstName VARCHAR, LastName VARCHAR, Company VARCHAR, Address VARCHAR, City VARCHAR, State VARCHAR, Country VARCHAR, PostalCode VARCHAR, Phone VARCHAR, Fax VARCHAR, Email VARCHAR, SupportRepId INT) CREATE TABLE Album (AlbumId INT, Title VARCHAR, ArtistId INT)
Show me a bar chart for what are the titles and ids for albums containing tracks with unit price greater than 1?, and rank in desc by the x axis.
SELECT T1.Title, T1.AlbumId FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 ORDER BY T1.Title DESC
SELECT "T1"."Title", "T1"."AlbumId" FROM "Album" AS "T1" JOIN "Track" AS "T2" ON "T1"."AlbumId" = "T2"."AlbumId" AND "T2"."UnitPrice" > 1 ORDER BY "T1"."Title" DESC NULLS LAST
0.170898
CREATE TABLE table_13642023_2 (gtu_winning_team VARCHAR, to_winning_team VARCHAR)
Who was the GTU winning team when the TO winning team was Steve Ross?
SELECT gtu_winning_team FROM table_13642023_2 WHERE to_winning_team = "Steve Ross"
SELECT "gtu_winning_team" FROM "table_13642023_2" WHERE "Steve Ross" = "to_winning_team"
0.085938
CREATE TABLE table_50660 ("Fin. Pos" TEXT, "Car No." TEXT, "Driver" TEXT, "Team" TEXT, "Laps" TEXT, "Time/Retired" TEXT, "Grid" TEXT, "Laps Led" TEXT, "Points" TEXT)
What is the grid of car no. 3?
SELECT "Grid" FROM table_50660 WHERE "Car No." = '3'
SELECT "Grid" FROM "table_50660" WHERE "Car No." = '3'
0.052734
CREATE TABLE table_58966 ("Main contestant" TEXT, "Co-contestant ( Yaar vs. Pyaar ) " TEXT, "Date performed" TEXT, "Scores by each individual judge" TEXT, "Total score/week" TEXT, "Position" TEXT, "Status" TEXT)
Which Scores by each individual judge has a Date performed of august 7, and a Main contestant of karanvir bohra?
SELECT "Scores by each individual judge" FROM table_58966 WHERE "Date performed" = 'august 7' AND "Main contestant" = 'karanvir bohra'
SELECT "Scores by each individual judge" FROM "table_58966" WHERE "Date performed" = 'august 7' AND "Main contestant" = 'karanvir bohra'
0.132813
CREATE TABLE table_name_5 (brazil_scorers VARCHAR, date VARCHAR, result VARCHAR, competition VARCHAR)
Which Brazil scorers have a Result of w, and a Competition of world cup qualifying, and a Date of february 28, 1954?
SELECT brazil_scorers FROM table_name_5 WHERE result = "w" AND competition = "world cup qualifying" AND date = "february 28, 1954"
SELECT "brazil_scorers" FROM "table_name_5" WHERE "competition" = "world cup qualifying" AND "date" = "february 28, 1954" AND "result" = "w"
0.136719
CREATE TABLE table_203_362 (id DECIMAL, "school" TEXT, "location" TEXT, "outright titles" DECIMAL, "shared titles" DECIMAL, "runners-up" DECIMAL, "total finals" DECIMAL, "last title" DECIMAL, "last final" DECIMAL)
who has the most recent title win , campbell college or regent house grammar school ?
SELECT "school" FROM table_203_362 WHERE "school" IN ('campbell college', 'regent house grammar school') ORDER BY "last title" DESC LIMIT 1
SELECT "school" FROM "table_203_362" WHERE "school" IN ('campbell college', 'regent house grammar school') ORDER BY "last title" DESC NULLS LAST LIMIT 1
0.148438
CREATE TABLE table_4743 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What is the home team that played against an away team scoring 12.4 (76)?
SELECT "Home team" FROM table_4743 WHERE "Away team score" = '12.4 (76)'
SELECT "Home team" FROM "table_4743" WHERE "Away team score" = '12.4 (76)'
0.072266
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
what are the four most frequent drugs that were prescribed in the same month to the anemia - anemia of critical illness female patients with age 50s after they had been diagnosed with anemia - anemia of critical illness, during this year?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'anemia - anemia of critical illness' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.gender = 'female' AND patient.age BETWEEN 50 AND 59 AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.drugstarttime, 'start of month') GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 4
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."age" <= 59 AND "patient"."age" >= 50 AND "patient"."gender" = 'female' WHERE DATETIME("medication"."drugstarttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')), "t3" AS (SELECT "t2"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."drugstarttime" AND "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("diagnosis"."diagnosistime", 'start of month') = DATETIME("t2"."drugstarttime", 'start of month') WHERE "diagnosis"."diagnosisname" = 'anemia - anemia of critical illness' AND DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY "t2"."drugname") SELECT "t3"."drugname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 4
1.075195
CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT)
saturday flight on AA from MILWAUKEE to PHOENIX
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHOENIX' AND CITY_1.state_code = 'state_code0' AND date_day.day_number = 26 AND date_day.month_number = 7 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MILWAUKEE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'AA'
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 26 AND "date_day"."month_number" = 7 AND "date_day"."year" = 1991 JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'MILWAUKEE' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days" AND "flight"."airline_code" = 'AA' JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'PHOENIX' AND "CITY_1"."state_code" = 'state_code0'
0.782227
CREATE TABLE table_name_81 (total INT, bronze VARCHAR, gold VARCHAR, rank VARCHAR)
What is the least total that has fewer golds than 2, a higher rank than 4 and fewer bronzes than 1?
SELECT MIN(total) FROM table_name_81 WHERE gold < 2 AND rank = 4 AND bronze < 1
SELECT MIN("total") FROM "table_name_81" WHERE "bronze" < 1 AND "gold" < 2 AND "rank" = 4
0.086914
CREATE TABLE table_204_231 (id DECIMAL, "rank" DECIMAL, "nation" TEXT, "gold" DECIMAL, "silver" DECIMAL, "bronze" DECIMAL, "total" DECIMAL)
the difference between the number of medals of italy and the number of medals of poland
SELECT (SELECT "total" FROM table_204_231 WHERE "nation" = 'italy') - (SELECT "total" FROM table_204_231 WHERE "nation" = 'poland')
SELECT (SELECT "total" FROM "table_204_231" WHERE "nation" = 'italy') - (SELECT "total" FROM "table_204_231" WHERE "nation" = 'poland')
0.131836
CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR)
on US how many flights leaving OAKLAND on 7 27 to BOSTON nonstop
SELECT COUNT(DISTINCT flight.flight_id) FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND date_day.day_number = 27 AND date_day.month_number = 7 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'OAKLAND' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'US') AND flight.stops = 0
SELECT COUNT(DISTINCT "flight"."flight_id") FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 27 AND "date_day"."month_number" = 7 AND "date_day"."year" = 1991 JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'OAKLAND' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days" AND "flight"."airline_code" = 'US' AND "flight"."stops" = 0 JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'BOSTON'
0.769531
CREATE TABLE table_name_26 (attendance VARCHAR, opponent VARCHAR)
When Hamilton Academical is the Opponent, what is the total Attendance?
SELECT COUNT(attendance) FROM table_name_26 WHERE opponent = "hamilton academical"
SELECT COUNT("attendance") FROM "table_name_26" WHERE "hamilton academical" = "opponent"
0.085938
CREATE TABLE table_2108 ("Institution" TEXT, "Location" TEXT, "Founded" FLOAT, "Type" TEXT, "Enrollment" FLOAT, "Nickname" TEXT, "Joined" FLOAT, "Division" TEXT)
How many schools named southern new hampshire university?
SELECT COUNT("Enrollment") FROM table_2108 WHERE "Institution" = 'Southern New Hampshire University'
SELECT COUNT("Enrollment") FROM "table_2108" WHERE "Institution" = 'Southern New Hampshire University'
0.099609
CREATE TABLE table_58710 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT)
What is Player, when Place is '1'?
SELECT "Player" FROM table_58710 WHERE "Place" = '1'
SELECT "Player" FROM "table_58710" WHERE "Place" = '1'
0.052734
CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT)
Will Prof. Anthony Collings be teaching 590 for next Winter ?
SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 590 AND instructor.name LIKE '%Anthony Collings%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'Winter' AND semester.semester_id = course_offering.semester AND semester.year = 2017
SELECT COUNT(*) > 0 FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "offering_instructor" ON "course_offering"."offering_id" = "offering_instructor"."offering_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'Winter' AND "semester"."year" = 2017 JOIN "instructor" ON "instructor"."instructor_id" = "offering_instructor"."instructor_id" AND "instructor"."name" LIKE '%Anthony Collings%' WHERE "course"."department" = 'EECS' AND "course"."number" = 590
0.544922
CREATE TABLE table_name_75 (bronze VARCHAR, gold VARCHAR)
What's the Bronze that's also got a Godl of Kim Woo-Jin?
SELECT bronze FROM table_name_75 WHERE gold = "kim woo-jin"
SELECT "bronze" FROM "table_name_75" WHERE "gold" = "kim woo-jin"
0.063477
CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT) CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT)
Return a bar chart about the distribution of ACC_Road and the sum of Team_ID , and group by attribute ACC_Road, sort in descending by the X.
SELECT ACC_Road, SUM(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY ACC_Road DESC
SELECT "ACC_Road", SUM("Team_ID") FROM "basketball_match" GROUP BY "ACC_Road" ORDER BY "ACC_Road" DESC NULLS LAST
0.110352
CREATE TABLE table_16712 ("Rnd" FLOAT, "Race" TEXT, "Date" TEXT, "Location" TEXT, "Pole Position" TEXT, "Fastest Lap" TEXT, "Race Winner" TEXT, "Constructor" TEXT, "Report" TEXT)
what's the total number of race winner with rnd being 10
SELECT COUNT("Race Winner") FROM table_16712 WHERE "Rnd" = '10'
SELECT COUNT("Race Winner") FROM "table_16712" WHERE "Rnd" = '10'
0.063477
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
did patient 006-254182 receive a laboratory test in 09/last year?
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-254182')) AND DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', lab.labresulttime) = '09'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-254182' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "lab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "lab"."patientunitstayid" WHERE DATETIME("lab"."labresulttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL AND STRFTIME('%m', "lab"."labresulttime") = '09'
0.626953
CREATE TABLE table_name_26 (tournament VARCHAR)
What is the tournament when 2007 is WTA Premier 5 tournaments?
SELECT tournament FROM table_name_26 WHERE 2007 = "wta premier 5 tournaments"
SELECT "tournament" FROM "table_name_26" WHERE "wta premier 5 tournaments" = 2007
0.079102
CREATE TABLE table_15070 ("Tournament" TEXT, "2009" TEXT, "2010" TEXT, "2011" TEXT, "2012" TEXT)
what is the 2011 performance for the US open?
SELECT "2011" FROM table_15070 WHERE "Tournament" = 'us open'
SELECT "2011" FROM "table_15070" WHERE "Tournament" = 'us open'
0.061523
CREATE TABLE table_58551 ("Tournament" TEXT, "2009" TEXT, "2011" TEXT, "2012" TEXT, "2013" TEXT)
Name the 2012 for 2009 of 1r
SELECT "2012" FROM table_58551 WHERE "2009" = '1r'
SELECT "2012" FROM "table_58551" WHERE "2009" = '1r'
0.050781
CREATE TABLE table_25730123_2 (player VARCHAR, extra_points VARCHAR, points VARCHAR)
Name the player/s when there were 20 points with less than 1.0 extra point .
SELECT player FROM table_25730123_2 WHERE extra_points < 1.0 AND points = 20
SELECT "player" FROM "table_25730123_2" WHERE "extra_points" < 1.0 AND "points" = 20
0.082031
CREATE TABLE Accounts (account_id INT, customer_id INT, account_name VARCHAR, other_account_details VARCHAR) CREATE TABLE Customers (customer_id INT, customer_first_name VARCHAR, customer_last_name VARCHAR, customer_address VARCHAR, customer_phone VARCHAR, customer_email VARCHAR, other_customer_details VARCHAR) CREATE TABLE Customers_Cards (card_id INT, customer_id INT, card_type_code VARCHAR, card_number VARCHAR, date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR) CREATE TABLE Financial_Transactions (transaction_id INT, previous_transaction_id INT, account_id INT, card_id INT, transaction_type VARCHAR, transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR, other_transaction_details VARCHAR)
Return a histogram on what are the different transaction types, and how many transactions of each have taken place?, display total number from low to high order.
SELECT transaction_type, COUNT(*) FROM Financial_Transactions GROUP BY transaction_type ORDER BY COUNT(*)
SELECT "transaction_type", COUNT(*) FROM "Financial_Transactions" GROUP BY "transaction_type" ORDER BY COUNT(*) NULLS FIRST
0.120117
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
calculate the total intake of or ffp of patient 24921.
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24921)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'or ffp' AND d_items.linksto = 'inputevents_cv')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 24921 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'or ffp' AND "d_items"."linksto" = 'inputevents_cv' GROUP BY "itemid") SELECT SUM("inputevents_cv"."amount") FROM "inputevents_cv" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "inputevents_cv"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
0.683594
CREATE TABLE table_name_62 (arrival VARCHAR, station_name VARCHAR)
What is the Arrival time of the Patna Junction Station?
SELECT arrival FROM table_name_62 WHERE station_name = "patna junction"
SELECT "arrival" FROM "table_name_62" WHERE "patna junction" = "station_name"
0.075195
CREATE TABLE table_28192 ("Metropolitan ring" TEXT, "Localities" FLOAT, "Total" FLOAT, "Jews and others 1" FLOAT, "Thereof: Jews" FLOAT, "Arabs" FLOAT, "Population density ( per km\\u00b2 ) " TEXT, "Annual Population growth rate" TEXT)
What is the lowest jews and others 1 for the localities 11?
SELECT MIN("Jews and others 1") FROM table_28192 WHERE "Localities" = '11'
SELECT MIN("Jews and others 1") FROM "table_28192" WHERE "Localities" = '11'
0.074219
CREATE TABLE table_19901_1 (muzzle_device VARCHAR, colt_model_no VARCHAR)
Which muzzle devices are on the Colt 603?
SELECT muzzle_device FROM table_19901_1 WHERE colt_model_no = "603"
SELECT "muzzle_device" FROM "table_19901_1" WHERE "603" = "colt_model_no"
0.071289
CREATE TABLE table_19897896_7 (class VARCHAR, position VARCHAR)
in which class is the position forward
SELECT class FROM table_19897896_7 WHERE position = "Forward"
SELECT "class" FROM "table_19897896_7" WHERE "Forward" = "position"
0.06543
CREATE TABLE table_62510 ("Date" TEXT, "Venue" TEXT, "Opponent" TEXT, "Score" TEXT, "Result" TEXT)
What was the final score for the match held on April 11, 2007?
SELECT "Score" FROM table_62510 WHERE "Date" = 'april 11, 2007'
SELECT "Score" FROM "table_62510" WHERE "Date" = 'april 11, 2007'
0.063477
CREATE TABLE table_43694 ("Round" FLOAT, "Player" TEXT, "Position" TEXT, "Nationality" TEXT, "College/junior/club team ( league ) " TEXT)
WHAT IS THE ROUND NUMBER OF NICHOLAS TREMBLAY?
SELECT COUNT("Round") FROM table_43694 WHERE "Player" = 'nicholas tremblay'
SELECT COUNT("Round") FROM "table_43694" WHERE "Player" = 'nicholas tremblay'
0.075195
CREATE TABLE table_50414 ("City" TEXT, "State" TEXT, "2010 population" TEXT, "Peak population ( year ) " TEXT, "Numeric decline from peak population" TEXT, "Percent decline from peak population" TEXT)
what is the peak population (year) for scranton?
SELECT "Peak population (year)" FROM table_50414 WHERE "City" = 'scranton'
SELECT "Peak population (year)" FROM "table_50414" WHERE "City" = 'scranton'
0.074219
CREATE TABLE table_76207 ("Region" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalog" TEXT)
What Date has the Region Europe and a Catalog of 74321 45851 2?
SELECT "Date" FROM table_76207 WHERE "Region" = 'europe' AND "Catalog" = '74321 45851 2'
SELECT "Date" FROM "table_76207" WHERE "Catalog" = '74321 45851 2' AND "Region" = 'europe'
0.087891
CREATE TABLE table_203_823 (id DECIMAL, "model name" TEXT, "date" TEXT, "type" TEXT, "thrust ( kg ) / power ( eshp ) " TEXT, "fitted to" TEXT)
what model was dated before model s-18 / vdr-3 ?
SELECT "model name" FROM table_203_823 WHERE "date" < (SELECT "date" FROM table_203_823 WHERE "model name" = 's-18/vdr-3')
SELECT "model name" FROM "table_203_823" WHERE "date" < (SELECT "date" FROM "table_203_823" WHERE "model name" = 's-18/vdr-3')
0.123047
CREATE TABLE table_name_38 (recnet VARCHAR, identifier VARCHAR)
What's the RECNet when the identifier is cbf-fm-20?
SELECT recnet FROM table_name_38 WHERE identifier = "cbf-fm-20"
SELECT "recnet" FROM "table_name_38" WHERE "cbf-fm-20" = "identifier"
0.067383
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
on this month/28 what was the arterial bp mean maximum value of patient 28447?
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 = 28447)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp mean' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND STRFTIME('%d', chartevents.charttime) = '28'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 28447 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'arterial bp mean' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT MAX("chartevents"."valuenum") FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE DATETIME("chartevents"."charttime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%d', "chartevents"."charttime") = '28'
0.844727
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
give me the number of patients whose primary disease is liver transplant and procedure short title is skin & subq dx proc nec.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "LIVER TRANSPLANT" AND procedures.short_title = "Skin & subq dx proc NEC"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Skin & subq dx proc NEC" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "LIVER TRANSPLANT" = "demographic"."diagnosis"
0.244141
CREATE TABLE table_25165 ("Rank" FLOAT, "1980-81" TEXT, "1981-82" TEXT, "1982-83" TEXT, "1983-84" TEXT, "1984-85" TEXT)
What is every entry for 1980-81 when 1984-85 is Liz Alvarado?
SELECT "1980-81" FROM table_25165 WHERE "1984-85" = 'Liz Alvarado'
SELECT "1980-81" FROM "table_25165" WHERE "1984-85" = 'Liz Alvarado'
0.066406
CREATE TABLE table_name_35 (year INT, venue VARCHAR)
what is the latest year when the venue is berlin, germany?
SELECT MAX(year) FROM table_name_35 WHERE venue = "berlin, germany"
SELECT MAX("year") FROM "table_name_35" WHERE "berlin, germany" = "venue"
0.071289
CREATE TABLE table_42367 ("City" TEXT, "Country" TEXT, "IATA" TEXT, "ICAO" TEXT, "Airport" TEXT)
What is the name of the airport with an ICAO of ULLI?
SELECT "Airport" FROM table_42367 WHERE "ICAO" = 'ulli'
SELECT "Airport" FROM "table_42367" WHERE "ICAO" = 'ulli'
0.055664
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
count the number of patients whose gender is m and primary disease is pneumonia;human immunodefiency virus;rule out tuberculosis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.diagnosis = "PNEUMONIA;HUMAN IMMUNODEFIENCY VIRUS;RULE OUT TUBERCULOSIS"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "M" = "demographic"."gender" AND "PNEUMONIA;HUMAN IMMUNODEFIENCY VIRUS;RULE OUT TUBERCULOSIS" = "demographic"."diagnosis"
0.191406
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is minimum age of patients whose marital status is divorced and admission type is elective?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.admission_type = "ELECTIVE"
SELECT MIN("demographic"."age") FROM "demographic" WHERE "DIVORCED" = "demographic"."marital_status" AND "ELECTIVE" = "demographic"."admission_type"
0.144531
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
what was the last value of the temperature c (calc) of patient 2518 today?
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 = 2518)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'temperature c (calc)' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') ORDER BY chartevents.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 2518 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'temperature c (calc)' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT "chartevents"."valuenum" FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE DATETIME("chartevents"."charttime", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL ORDER BY "chartevents"."charttime" DESC NULLS LAST LIMIT 1
0.842773
CREATE TABLE election (Election_ID INT, Representative_ID INT, Date TEXT, Votes FLOAT, Vote_Percent FLOAT, Seats FLOAT, Place FLOAT) CREATE TABLE representative (Representative_ID INT, Name TEXT, State TEXT, Party TEXT, Lifespan TEXT)
Give me a histogram for what are the different parties of representative? Show the party name and the number of representatives in each party.
SELECT Party, COUNT(*) FROM representative GROUP BY Party
SELECT "Party", COUNT(*) FROM "representative" GROUP BY "Party"
0.061523
CREATE TABLE table_6115 ("Name" TEXT, "Birth" TEXT, "Marriage" TEXT, "Became Queen" TEXT, "Ceased to be Queen" TEXT, "Death" TEXT, "Spouse" TEXT)
How is the marriage of who became queen on 30 October 1816 husband's accession?
SELECT "Marriage" FROM table_6115 WHERE "Became Queen" = '30 october 1816 husband''s accession'
SELECT "Marriage" FROM "table_6115" WHERE "Became Queen" = '30 october 1816 husband\'s accession'
0.094727
CREATE TABLE table_18009 ("No." FLOAT, "#" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" TEXT, "U.S. viewers ( million ) " TEXT)
How many episodes were aired on the Original air date for 'Circus, Circus'?
SELECT COUNT("Original air date") FROM table_18009 WHERE "Title" = 'Circus, Circus'
SELECT COUNT("Original air date") FROM "table_18009" WHERE "Title" = 'Circus, Circus'
0.083008
CREATE TABLE table_17256857_1 (fin_pos INT, points VARCHAR)
Which position earned 50 points?
SELECT MAX(fin_pos) FROM table_17256857_1 WHERE points = "50"
SELECT MAX("fin_pos") FROM "table_17256857_1" WHERE "50" = "points"
0.06543
CREATE TABLE table_24431264_18 (rank VARCHAR, withdrew_due_to VARCHAR)
List the rank of the player that left due to right wrist surgery?
SELECT rank FROM table_24431264_18 WHERE withdrew_due_to = "right wrist surgery"
SELECT "rank" FROM "table_24431264_18" WHERE "right wrist surgery" = "withdrew_due_to"
0.083984
CREATE TABLE table_62222 ("Tie no" TEXT, "Home team" TEXT, "Score" TEXT, "Away team" TEXT, "Date" TEXT)
Who was the home team on 4 February 1987 when Luton Town was away team and there was no replay?
SELECT "Home team" FROM table_62222 WHERE "Tie no" = 'replay' AND "Date" = '4 february 1987' AND "Away team" = 'luton town'
SELECT "Home team" FROM "table_62222" WHERE "Away team" = 'luton town' AND "Date" = '4 february 1987' AND "Tie no" = 'replay'
0.12207
CREATE TABLE table_2622469_1 (wins VARCHAR, year VARCHAR)
What were the wins of 1983?
SELECT wins FROM table_2622469_1 WHERE year = 1983
SELECT "wins" FROM "table_2622469_1" WHERE "year" = 1983
0.054688
CREATE TABLE table_11586 ("Name" TEXT, "Election Year" FLOAT, "Party" TEXT, "Birth State" TEXT, "Resident State" TEXT)
What is the election year of the president with a Birth State of lost connecticut?
SELECT AVG("Election Year") FROM table_11586 WHERE "Birth State" = 'lost connecticut'
SELECT AVG("Election Year") FROM "table_11586" WHERE "Birth State" = 'lost connecticut'
0.084961
CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR, year INT) CREATE TABLE Person (name VARCHAR, age INT, city TEXT, gender TEXT, job TEXT)
Who has friends that are older than the average age? Print their name and their ages as well using a bar chart, and I want to rank in descending by the y axis.
SELECT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT AVG(age) FROM Person) ORDER BY T1.age DESC
SELECT "T1"."name", "T1"."age" FROM "Person" AS "T1" JOIN "PersonFriend" AS "T2" ON "T1"."name" = "T2"."friend" WHERE "T1"."age" > (SELECT AVG("age") FROM "Person") ORDER BY "T1"."age" DESC NULLS LAST
0.195313
CREATE TABLE table_name_24 (player VARCHAR, country VARCHAR, score VARCHAR)
Who is the player from the United States with a score of 71-75=146?
SELECT player FROM table_name_24 WHERE country = "united states" AND score = 71 - 75 = 146
SELECT "player" FROM "table_name_24" WHERE "country" = "united states" AND "score" = FALSE
0.087891
CREATE TABLE table_12925 ("Player" TEXT, "Country" TEXT, "Year ( s ) won" TEXT, "Total" FLOAT, "To par" FLOAT)
What is the To par for Lanny Wadkins?
SELECT "To par" FROM table_12925 WHERE "Player" = 'lanny wadkins'
SELECT "To par" FROM "table_12925" WHERE "Player" = 'lanny wadkins'
0.06543
CREATE TABLE table_29504351_2 (money_list_rank INT, player VARCHAR)
What is the money list rank for player Doug Barron?
SELECT MAX(money_list_rank) FROM table_29504351_2 WHERE player = "Doug Barron"
SELECT MAX("money_list_rank") FROM "table_29504351_2" WHERE "Doug Barron" = "player"
0.082031
CREATE TABLE table_44091 ("Usage" TEXT, "Class" TEXT, "Performance" TEXT, "Performance test" TEXT, "Particulate size approaching 100% retention" TEXT, "Test Standard" TEXT)
Which Performance has a Test Standard of bs en779, and a Particulate size approaching 100% retention of >2 m, and a Class of f6?
SELECT "Performance" FROM table_44091 WHERE "Test Standard" = 'bs en779' AND "Particulate size approaching 100% retention" = '>2µm' AND "Class" = 'f6'
SELECT "Performance" FROM "table_44091" WHERE "Class" = 'f6' AND "Particulate size approaching 100% retention" = '>2µm' AND "Test Standard" = 'bs en779'
0.148438
CREATE TABLE table_28066 ("Player" TEXT, "Touchdowns" FLOAT, "Extra points" FLOAT, "Field goals" FLOAT, "Points" FLOAT)
How many touchdowns were the when there was more than 1.0 extra point?
SELECT "Touchdowns" FROM table_28066 WHERE "Extra points" > '1.0'
SELECT "Touchdowns" FROM "table_28066" WHERE "Extra points" > '1.0'
0.06543
CREATE TABLE table_name_32 (round VARCHAR, college VARCHAR)
Which round is the player from Oregon from?
SELECT round FROM table_name_32 WHERE college = "oregon"
SELECT "round" FROM "table_name_32" WHERE "college" = "oregon"
0.060547
CREATE TABLE table_4323 ("Date" TEXT, "Location" TEXT, "Surface" TEXT, "Opponent in the final" TEXT, "Score in the final" TEXT)
Name the score for moscow, ussr 15 february 1971
SELECT "Score in the final" FROM table_4323 WHERE "Location" = 'moscow, ussr' AND "Date" = '15 february 1971'
SELECT "Score in the final" FROM "table_4323" WHERE "Date" = '15 february 1971' AND "Location" = 'moscow, ussr'
0.108398
CREATE TABLE table_name_61 (round INT, position VARCHAR, pick__number VARCHAR)
Let's say position was linebacker with a pick number less than 5, what was the highest round?
SELECT MAX(round) FROM table_name_61 WHERE position = "linebacker" AND pick__number > 5
SELECT MAX("round") FROM "table_name_61" WHERE "linebacker" = "position" AND "pick__number" > 5
0.092773
CREATE TABLE table_72379 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Result" TEXT, "Candidates" TEXT)
Name the party for jack thomas brinkley
SELECT "Party" FROM table_72379 WHERE "Incumbent" = 'Jack Thomas Brinkley'
SELECT "Party" FROM "table_72379" WHERE "Incumbent" = 'Jack Thomas Brinkley'
0.074219
CREATE TABLE table_29385 ("Player" TEXT, "Team" TEXT, "Matches" FLOAT, "Overs" TEXT, "Wickets" FLOAT, "Average" TEXT, "Economy" TEXT, "BBI" TEXT, "4wi" FLOAT, "5wi" FLOAT)
Who is the player when the bbi is 5/27?
SELECT "Player" FROM table_29385 WHERE "BBI" = '5/27'
SELECT "Player" FROM "table_29385" WHERE "BBI" = '5/27'
0.053711
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
what is minimum age of patients whose gender is m and year of birth is greater than 2078?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.dob_year > "2078"
SELECT MIN("demographic"."age") FROM "demographic" WHERE "2078" < "demographic"."dob_year" AND "M" = "demographic"."gender"
0.120117
CREATE TABLE table_29589 ("Players" TEXT, "Games Won" FLOAT, "Games Lost" FLOAT, "Total points" FLOAT, "Grand Average" TEXT, "Best Winning Average" TEXT, "Best Run" FLOAT)
If the best winning average is 7.3-71, what are the total points?
SELECT MIN("Total points") FROM table_29589 WHERE "Best Winning Average" = '7.3-71'
SELECT MIN("Total points") FROM "table_29589" WHERE "Best Winning Average" = '7.3-71'
0.083008
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
How many patients' procedure long title is thoracentesis and lab test category is hematology?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Thoracentesis" AND lab."CATEGORY" = "Hematology"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Hematology" = "lab"."CATEGORY" AND "demographic"."hadm_id" = "lab"."hadm_id" JOIN "procedures" ON "Thoracentesis" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id"
0.271484
CREATE TABLE ref_characteristic_types (characteristic_type_code TEXT, characteristic_type_description TEXT) CREATE TABLE product_characteristics (product_id DECIMAL, characteristic_id DECIMAL, product_characteristic_value TEXT) CREATE TABLE ref_product_categories (product_category_code TEXT, product_category_description TEXT, unit_of_measure TEXT) CREATE TABLE products (product_id DECIMAL, color_code TEXT, product_category_code TEXT, product_name TEXT, typical_buying_price TEXT, typical_selling_price TEXT, product_description TEXT, other_product_details TEXT) CREATE TABLE characteristics (characteristic_id DECIMAL, characteristic_type_code TEXT, characteristic_data_type TEXT, characteristic_name TEXT, other_characteristic_details TEXT) CREATE TABLE ref_colors (color_code TEXT, color_description TEXT)
How many characteristics does the product named 'laurel' have?
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "laurel"
SELECT COUNT(*) FROM "products" AS "t1" JOIN "product_characteristics" AS "t2" ON "t1"."product_id" = "t2"."product_id" JOIN "characteristics" AS "t3" ON "t2"."characteristic_id" = "t3"."characteristic_id" WHERE "laurel" = "t1"."product_name"
0.236328
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many patients are primary diagnosed for unspecified procedure as the cause of abnormal reaction of patient, or of later complication, without mention of misadventure at the time of procedure and had lab test results as abnormal status delta?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Unspecified procedure as the cause of abnormal reaction of patient, or of later complication, without mention of misadventure at time of procedure" AND lab.flag = "delta"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Unspecified procedure as the cause of abnormal reaction of patient, or of later complication, without mention of misadventure at time of procedure" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "delta" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.389648
CREATE TABLE table_name_37 (competition VARCHAR, opponents VARCHAR, score VARCHAR)
What is the name of the competition with opponents of Sv Werder Bremen and a score of 1-2?
SELECT competition FROM table_name_37 WHERE opponents = "sv werder bremen" AND score = "1-2"
SELECT "competition" FROM "table_name_37" WHERE "1-2" = "score" AND "opponents" = "sv werder bremen"
0.097656