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_69866 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT, "Money ( $ ) " FLOAT)
What is the highest amount of money a play from Scotland United States has?
SELECT MAX("Money ( $ )") FROM table_69866 WHERE "Country" = 'scotland united states'
SELECT MAX("Money ( $ )") FROM "table_69866" WHERE "Country" = 'scotland united states'
0.084961
CREATE TABLE table_name_95 (score VARCHAR, date VARCHAR)
What was the score of the March 14 game?
SELECT score FROM table_name_95 WHERE date = "march 14"
SELECT "score" FROM "table_name_95" WHERE "date" = "march 14"
0.05957
CREATE TABLE table_22875369_3 (location VARCHAR, record VARCHAR)
Name the number of location for 22-1
SELECT COUNT(location) FROM table_22875369_3 WHERE record = "22-1"
SELECT COUNT("location") FROM "table_22875369_3" WHERE "22-1" = "record"
0.070313
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 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)
what is maximum days of hospital stay of patients whose primary disease is pituitary bleed?
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "PITUITARY BLEED"
SELECT MAX("demographic"."days_stay") FROM "demographic" WHERE "PITUITARY BLEED" = "demographic"."diagnosis"
0.105469
CREATE TABLE table_name_2 (races INT, series VARCHAR, team VARCHAR)
How many races did the Formula Three Euroseries signature team have?
SELECT SUM(races) FROM table_name_2 WHERE series = "formula three euroseries" AND team = "signature"
SELECT SUM("races") FROM "table_name_2" WHERE "formula three euroseries" = "series" AND "signature" = "team"
0.105469
CREATE TABLE table_17115 ("Year" FLOAT, "Network" TEXT, "Lap-by-lap" TEXT, "Color commentator ( s ) " TEXT, "Pit reporters" TEXT, "Host" TEXT, "Ratings" TEXT, "Viewers" TEXT)
What was the rating in 1997?
SELECT "Ratings" FROM table_17115 WHERE "Year" = '1997'
SELECT "Ratings" FROM "table_17115" WHERE "Year" = '1997'
0.055664
CREATE TABLE Subjects (subject_id INT, subject_name VARCHAR) CREATE TABLE Courses (course_id INT, author_id INT, subject_id INT, course_name VARCHAR, course_description VARCHAR) CREATE TABLE Student_Tests_Taken (registration_id INT, date_test_taken DATETIME, test_result VARCHAR) CREATE TABLE Course_Authors_and_Tutors (author_id INT, author_tutor_ATB VARCHAR, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR, gender_mf VARCHAR, address_line_1 VARCHAR) CREATE TABLE Student_Course_Enrolment (registration_id INT, student_id INT, course_id INT, date_of_enrolment DATETIME, date_of_completion DATETIME) CREATE TABLE Students (student_id INT, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR)
Find the number of courses for each subject in a pie chart.
SELECT subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id
SELECT "subject_name", COUNT(*) FROM "Courses" AS "T1" JOIN "Subjects" AS "T2" ON "T1"."subject_id" = "T2"."subject_id" GROUP BY "T1"."subject_id"
0.142578
CREATE TABLE table_18600760_13 (ansi_code VARCHAR, latitude VARCHAR)
How many places associated with latitude 48.247662?
SELECT COUNT(ansi_code) FROM table_18600760_13 WHERE latitude = "48.247662"
SELECT COUNT("ansi_code") FROM "table_18600760_13" WHERE "48.247662" = "latitude"
0.079102
CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT) CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT) CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT) CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT)
Find Nationality and the sum of meter_100 , and group by attribute Nationality, and visualize them by a bar chart, and order by the x-axis in asc.
SELECT Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality
SELECT "Nationality", SUM("meter_100") FROM "swimmer" GROUP BY "Nationality" ORDER BY "Nationality" NULLS FIRST
0.108398
CREATE TABLE ARTIST (artistid VARCHAR) CREATE TABLE ALBUM (artistid VARCHAR)
How many artists do not have any album?
SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)
SELECT COUNT(*) FROM "ARTIST" WHERE NOT "artistid" IN (SELECT "artistid" FROM "ALBUM")
0.083984
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
tell me the total amount of input that patient 12307 got on the last intensive care unit visit?
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 = 12307) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 12307 GROUP BY "hadm_id") SELECT SUM("inputevents_cv"."amount") FROM "inputevents_cv" WHERE "inputevents_cv"."icustay_id" IN (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 AND NOT "icustays"."outtime" IS NULL ORDER BY "icustays"."intime" DESC NULLS LAST LIMIT 1)
0.441406
CREATE TABLE festival_detail (Festival_Name VARCHAR, YEAR VARCHAR)
Show the names of the three most recent festivals.
SELECT Festival_Name FROM festival_detail ORDER BY YEAR DESC LIMIT 3
SELECT "Festival_Name" FROM "festival_detail" ORDER BY "YEAR" DESC NULLS LAST LIMIT 3
0.083008
CREATE TABLE jobs (job_id TEXT, job_title TEXT, min_salary DECIMAL, max_salary DECIMAL) CREATE TABLE departments (department_id DECIMAL, department_name TEXT, manager_id DECIMAL, location_id DECIMAL) CREATE TABLE regions (region_id DECIMAL, region_name TEXT) CREATE TABLE countries (country_id TEXT, country_name TEXT, region_id DECIMAL) CREATE TABLE job_history (employee_id DECIMAL, start_date TIME, end_date TIME, job_id TEXT, department_id DECIMAL) CREATE TABLE employees (employee_id DECIMAL, first_name TEXT, last_name TEXT, email TEXT, phone_number TEXT, hire_date TIME, job_id TEXT, salary DECIMAL, commission_pct DECIMAL, manager_id DECIMAL, department_id DECIMAL) CREATE TABLE locations (location_id DECIMAL, street_address TEXT, postal_code TEXT, city TEXT, state_province TEXT, country_id TEXT)
What are the full names and hire dates for employees in the same department as someone with the first name Clara, not including Clara?
SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = "Clara") AND first_name <> "Clara"
SELECT "first_name", "last_name", "hire_date" FROM "employees" WHERE "Clara" <> "first_name" AND "department_id" = (SELECT "department_id" FROM "employees" WHERE "Clara" = "first_name")
0.180664
CREATE TABLE table_10307 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
How big was the crowd of the away team that scored 18.16 (124)?
SELECT COUNT("Crowd") FROM table_10307 WHERE "Away team score" = '18.16 (124)'
SELECT COUNT("Crowd") FROM "table_10307" WHERE "Away team score" = '18.16 (124)'
0.078125
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime 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 vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime 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 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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
how much of the difference is patient 032-13376's respiration second measured on the first icu visit compared to the first value measured on the first icu visit?
SELECT (SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-13376') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1) AND NOT vitalperiodic.respiration IS NULL ORDER BY vitalperiodic.observationtime LIMIT 1 OFFSET 1) - (SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-13376') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1) AND NOT vitalperiodic.respiration IS NULL ORDER BY vitalperiodic.observationtime LIMIT 1)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '032-13376' GROUP BY "patienthealthsystemstayid") SELECT (SELECT "vitalperiodic"."respiration" FROM "vitalperiodic" WHERE "vitalperiodic"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL ORDER BY "patient"."unitadmittime" NULLS FIRST LIMIT 1) AND NOT "vitalperiodic"."respiration" IS NULL ORDER BY "vitalperiodic"."observationtime" NULLS FIRST LIMIT 1 OFFSET 1) - (SELECT "vitalperiodic"."respiration" FROM "vitalperiodic" WHERE "vitalperiodic"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_3" ON "_u_3"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_3"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL ORDER BY "patient"."unitadmittime" NULLS FIRST LIMIT 1) AND NOT "vitalperiodic"."respiration" IS NULL ORDER BY "vitalperiodic"."observationtime" NULLS FIRST LIMIT 1)
1.100586
CREATE TABLE table_name_56 (home_team VARCHAR, venue VARCHAR)
Who is the home team based at windy hill?
SELECT home_team FROM table_name_56 WHERE venue = "windy hill"
SELECT "home_team" FROM "table_name_56" WHERE "venue" = "windy hill"
0.066406
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId 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 PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense 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 Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, 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 PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description 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 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
Questions with the greatest number of answers.
SELECT Question.Id AS "question_id", COUNT(*) AS "number_of_answers", Question.Title AS "question_title" FROM Posts AS Answer JOIN Posts AS Question ON Question.Id = Answer.ParentId WHERE Answer.PostTypeId = 2 GROUP BY Question.Id, Question.Title ORDER BY COUNT(*) DESC
SELECT "Question"."Id" AS "question_id", COUNT(*) AS "number_of_answers", "Question"."Title" AS "question_title" FROM "Posts" AS "Answer" JOIN "Posts" AS "Question" ON "Answer"."ParentId" = "Question"."Id" WHERE "Answer"."PostTypeId" = 2 GROUP BY "Question"."Id", "Question"."Title" ORDER BY COUNT(*) DESC NULLS LAST
0.308594
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_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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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 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 d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) 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 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)
count the number of patients who were given a blood (cmv ab) microbiology test until 1 year ago.
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT microbiologyevents.hadm_id FROM microbiologyevents WHERE microbiologyevents.spec_type_desc = 'blood (cmv ab)' AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-1 year'))
WITH "_u_0" AS (SELECT "microbiologyevents"."hadm_id" FROM "microbiologyevents" WHERE "microbiologyevents"."spec_type_desc" = 'blood (cmv ab)' AND DATETIME("microbiologyevents"."charttime") <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY "hadm_id") SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "admissions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "admissions"."hadm_id" WHERE NOT "_u_0"."" IS NULL
0.398438
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)
What are the maximum score of wines in each year?, and show in asc by the X.
SELECT Year, MAX(Score) FROM wine GROUP BY Year ORDER BY Year
SELECT "Year", MAX("Score") FROM "wine" GROUP BY "Year" ORDER BY "Year" NULLS FIRST
0.081055
CREATE TABLE table_66827 ("Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT)
What is the Competition On 26 jan 2005
SELECT "Competition" FROM table_66827 WHERE "Date" = '26 jan 2005'
SELECT "Competition" FROM "table_66827" WHERE "Date" = '26 jan 2005'
0.066406
CREATE TABLE table_51365 ("Year" FLOAT, "Property Taxes" TEXT, "Investment Earnings" TEXT, "Other Local Sources" TEXT, "State & Federal" TEXT, "Total Revenue" TEXT)
What were the investment earnings in the year that State and Federal taxes were $13,999,169?
SELECT "Investment Earnings" FROM table_51365 WHERE "State & Federal" = '13,999,169'
SELECT "Investment Earnings" FROM "table_51365" WHERE "State & Federal" = '13,999,169'
0.083984
CREATE TABLE table_26757_4 (slovene VARCHAR, belarusian VARCHAR)
When (r ba) is the belarusian how many slovenes are there?
SELECT COUNT(slovene) FROM table_26757_4 WHERE belarusian = "рыба (rýba)"
SELECT COUNT("slovene") FROM "table_26757_4" WHERE "belarusian" = "рыба (rýba)"
0.077148
CREATE TABLE table_name_13 (election INT, share_of_votes VARCHAR)
What is the earlest election with a 0.9% share of votes?
SELECT MIN(election) FROM table_name_13 WHERE share_of_votes = "0.9%"
SELECT MIN("election") FROM "table_name_13" WHERE "0.9%" = "share_of_votes"
0.073242
CREATE TABLE table_name_60 (producer VARCHAR, year VARCHAR)
Who were the producers in 1961?
SELECT producer FROM table_name_60 WHERE year = 1961
SELECT "producer" FROM "table_name_60" WHERE "year" = 1961
0.056641
CREATE TABLE table_name_48 (score VARCHAR, player VARCHAR)
What is Score, when Player is Billy Mayfair?
SELECT score FROM table_name_48 WHERE player = "billy mayfair"
SELECT "score" FROM "table_name_48" WHERE "billy mayfair" = "player"
0.066406
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) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
give me the number of married patients admitted in hospital before 2119.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.admityear < "2119"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2119" > "demographic"."admityear" AND "MARRIED" = "demographic"."marital_status"
0.152344
CREATE TABLE table_58989 ("Standard order" FLOAT, "English translation" TEXT, "Transcription ( based on Pinyin ) " TEXT, "Traditional Chinese" TEXT, "Simplified Chinese" TEXT)
What is the Traditional Chinese of which is over 9?
SELECT "Traditional Chinese" FROM table_58989 WHERE "Standard order" > '9' AND "Simplified Chinese" = '国殇'
SELECT "Traditional Chinese" FROM "table_58989" WHERE "Simplified Chinese" = '国殇' AND "Standard order" > '9'
0.105469
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange 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 PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name 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)
Accept Answer Rate for tags.
SELECT t.TagName, COUNT(*) AS answers, SUM(CASE WHEN a.Id = q.AcceptedAnswerId THEN 1 ELSE 0 END) AS accepts, SUM(CASE WHEN a.Id = q.AcceptedAnswerId THEN 1 ELSE 0 END) / CAST(COUNT(*) AS FLOAT) AS acceptrate FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id INNER JOIN PostTags AS pt ON pt.PostId = q.Id INNER JOIN Tags AS t ON t.Id = pt.TagId AND q.CreationDate BETWEEN '2019-12-01' AND '2019-12-31' GROUP BY t.TagName ORDER BY COUNT(*) DESC
SELECT "t"."TagName", COUNT(*) AS "answers", SUM(CASE WHEN "a"."Id" = "q"."AcceptedAnswerId" THEN 1 ELSE 0 END) AS "accepts", SUM(CASE WHEN "a"."Id" = "q"."AcceptedAnswerId" THEN 1 ELSE 0 END) / NULLIF(CAST(COUNT(*) AS FLOAT), 0) AS "acceptrate" FROM "Posts" AS "q" JOIN "Posts" AS "a" ON "a"."ParentId" = "q"."Id" JOIN "PostTags" AS "pt" ON "pt"."PostId" = "q"."Id" JOIN "Tags" AS "t" ON "pt"."TagId" = "t"."Id" AND "q"."CreationDate" <= '2019-12-31' AND "q"."CreationDate" >= '2019-12-01' GROUP BY "t"."TagName" ORDER BY COUNT(*) DESC NULLS LAST
0.53418
CREATE TABLE complaints (complaint_status_code VARCHAR, complaint_type_code VARCHAR)
Find the number of complaints with Product Failure type for each complaint status.
SELECT complaint_status_code, COUNT(*) FROM complaints WHERE complaint_type_code = "Product Failure" GROUP BY complaint_status_code
SELECT "complaint_status_code", COUNT(*) FROM "complaints" WHERE "Product Failure" = "complaint_type_code" GROUP BY "complaint_status_code"
0.135742
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 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 vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
what is the minimum number of daily diagnosed cases of hepatorenal syndrome during the last year?
SELECT MIN(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'hepatorenal syndrome' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY STRFTIME('%y-%m-%d', diagnosis.diagnosistime)) AS t1
WITH "t1" AS (SELECT COUNT(DISTINCT "diagnosis"."patientunitstayid") AS "c1" FROM "diagnosis" WHERE "diagnosis"."diagnosisname" = 'hepatorenal syndrome' AND DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY STRFTIME('%y-%m-%d', "diagnosis"."diagnosistime")) SELECT MIN("t1"."c1") FROM "t1" AS "t1"
0.357422
CREATE TABLE table_10527215_3 (fastest_lap VARCHAR, winning_driver VARCHAR, pole_position VARCHAR)
What was Johnny Rutherford's fastest lap while Al Unser was the pole position?
SELECT fastest_lap FROM table_10527215_3 WHERE winning_driver = "Johnny Rutherford" AND pole_position = "Al Unser"
SELECT "fastest_lap" FROM "table_10527215_3" WHERE "Al Unser" = "pole_position" AND "Johnny Rutherford" = "winning_driver"
0.119141
CREATE TABLE table_40570 ("Team 1" TEXT, "Agg." TEXT, "Team 2" TEXT, "1st leg" TEXT, "2nd leg" TEXT)
What is the 2nd leg result when team 2 is Morocco?
SELECT "2nd leg" FROM table_40570 WHERE "Team 2" = 'morocco'
SELECT "2nd leg" FROM "table_40570" WHERE "Team 2" = 'morocco'
0.060547
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) 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 PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment 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 PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE 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 ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostTypes (Id DECIMAL, Name 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 ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress 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 PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
Query language tags by use.
SELECT * FROM Tags ORDER BY Count DESC LIMIT 100
SELECT * FROM "Tags" ORDER BY "Count" DESC NULLS LAST LIMIT 100
0.061523
CREATE TABLE table_46354 ("Date" TEXT, "Venue" TEXT, "Opponents" TEXT, "Score" TEXT, "Competition" TEXT, "Match Report" TEXT)
What is Competition, when Score is '2-1', and when Date is 'October 22, 2008'?
SELECT "Competition" FROM table_46354 WHERE "Score" = '2-1' AND "Date" = 'october 22, 2008'
SELECT "Competition" FROM "table_46354" WHERE "Date" = 'october 22, 2008' AND "Score" = '2-1'
0.09082
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 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 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)
provide the number of patients whose diagnoses icd9 code is 78909 and lab test abnormal status is 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.icd9_code = "78909" AND lab.flag = "delta"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "78909" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "delta" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.250977
CREATE TABLE table_21002034_7 (_number INT, air_date_netherlands_yyyy_mm_dd VARCHAR)
Name the most number for air date 2009/12/29
SELECT MAX(_number) FROM table_21002034_7 WHERE air_date_netherlands_yyyy_mm_dd = "2009/12/29"
SELECT MAX("_number") FROM "table_21002034_7" WHERE "2009/12/29" = "air_date_netherlands_yyyy_mm_dd"
0.097656
CREATE TABLE table_204_124 (id DECIMAL, "no." DECIMAL, "name" TEXT, "public access" DECIMAL, "location & map links" TEXT, "area\ ha" DECIMAL, "area\ acres" DECIMAL, "references" TEXT)
which woods has the same acreage as hardwick wood ?
SELECT "name" FROM table_204_124 WHERE "name" <> 'hardwick wood' AND "area\nacres" = (SELECT "area\nacres" FROM table_204_124 WHERE "name" = 'hardwick wood')
SELECT "name" FROM "table_204_124" WHERE "area\nacres" = (SELECT "area\nacres" FROM "table_204_124" WHERE "name" = 'hardwick wood') AND "name" <> 'hardwick wood'
0.157227
CREATE TABLE table_name_60 (interview INT, evening_gown VARCHAR, state VARCHAR, swimsuit VARCHAR, average VARCHAR)
What is the lowest interview for a contestant from North Carolina with a swimsuit larger than 9.021, an average smaller than 9.513, and an evening gown larger than 9.5?
SELECT MIN(interview) FROM table_name_60 WHERE swimsuit > 9.021 AND average < 9.513 AND state = "north carolina" AND evening_gown > 9.5
SELECT MIN("interview") FROM "table_name_60" WHERE "average" < 9.513 AND "evening_gown" > 9.5 AND "north carolina" = "state" AND "swimsuit" > 9.021
0.143555
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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)
give the primary disease of hector blair.
SELECT demographic.diagnosis FROM demographic WHERE demographic.name = "Hector Blair"
SELECT "demographic"."diagnosis" FROM "demographic" WHERE "Hector Blair" = "demographic"."name"
0.092773
CREATE TABLE table_35257 ("Rank" FLOAT, "Airport" TEXT, "Location" TEXT, "Code ( IATA ) " TEXT, "Total Cargo ( Metric Tonnes ) " TEXT, "2003 Rank" TEXT, "% Change" TEXT)
What is the 2003 rank for Los Angeles International airport?
SELECT "2003 Rank" FROM table_35257 WHERE "Airport" = 'los angeles international airport'
SELECT "2003 Rank" FROM "table_35257" WHERE "Airport" = 'los angeles international airport'
0.088867
CREATE TABLE table_name_71 (notes VARCHAR, rank VARCHAR, athlete VARCHAR)
Ioannis Christou with a rank smaller than 6 has what notes?
SELECT notes FROM table_name_71 WHERE rank < 6 AND athlete = "ioannis christou"
SELECT "notes" FROM "table_name_71" WHERE "athlete" = "ioannis christou" AND "rank" < 6
0.084961
CREATE TABLE table_name_11 (away_team VARCHAR, home_team VARCHAR)
who is the away team when the home team is luton town?
SELECT away_team FROM table_name_11 WHERE home_team = "luton town"
SELECT "away_team" FROM "table_name_11" WHERE "home_team" = "luton town"
0.070313
CREATE TABLE table_11900773_5 (design VARCHAR, theme VARCHAR)
Who was responsible for the design of the Jasper National Park theme?
SELECT design FROM table_11900773_5 WHERE theme = "Jasper National Park"
SELECT "design" FROM "table_11900773_5" WHERE "Jasper National Park" = "theme"
0.076172
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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
count the number of times that patient 006-80884 has received a anion gap laboratory test since 2105.
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-80884')) AND lab.labname = 'anion gap' AND STRFTIME('%y', lab.labresulttime) >= '2105'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-80884' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "lab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "lab"."patientunitstayid" WHERE "lab"."labname" = 'anion gap' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y', "lab"."labresulttime") >= '2105'
0.552734
CREATE TABLE table_70340 ("Title" TEXT, "Studio" TEXT, "Role" TEXT, "Leading lady" TEXT, "Director" TEXT)
Name the role for studio of rep with sheila mannors leading lady and title of westward ho
SELECT "Role" FROM table_70340 WHERE "Studio" = 'rep' AND "Leading lady" = 'sheila mannors' AND "Title" = 'westward ho'
SELECT "Role" FROM "table_70340" WHERE "Leading lady" = 'sheila mannors' AND "Studio" = 'rep' AND "Title" = 'westward ho'
0.118164
CREATE TABLE table_28853064_15 (general_classification VARCHAR, winner VARCHAR, points_classification VARCHAR)
Who was the General Classification awardee if Sergio Luis Henao was the winner and the Points Classification award was given to Sergio Luis Henao?
SELECT general_classification FROM table_28853064_15 WHERE winner = "Sergio Luis Henao" AND points_classification = "Sergio Luis Henao"
SELECT "general_classification" FROM "table_28853064_15" WHERE "Sergio Luis Henao" = "points_classification" AND "Sergio Luis Henao" = "winner"
0.139648
CREATE TABLE table_name_47 (born___died VARCHAR, connection_with_australia VARCHAR)
The person that was born in Sydney died in what year?
SELECT born___died FROM table_name_47 WHERE connection_with_australia = "born in sydney"
SELECT "born___died" FROM "table_name_47" WHERE "born in sydney" = "connection_with_australia"
0.091797
CREATE TABLE table_name_20 (venue VARCHAR, notes VARCHAR, year VARCHAR)
Which Venue has a Notes of heptathlon, and a Year of 1991?
SELECT venue FROM table_name_20 WHERE notes = "heptathlon" AND year = 1991
SELECT "venue" FROM "table_name_20" WHERE "heptathlon" = "notes" AND "year" = 1991
0.080078
CREATE TABLE table_59836 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" FLOAT, "To par" TEXT)
What was Craig Stadler's lowest score for United states?
SELECT MIN("Score") FROM table_59836 WHERE "Country" = 'united states' AND "Player" = 'craig stadler'
SELECT MIN("Score") FROM "table_59836" WHERE "Country" = 'united states' AND "Player" = 'craig stadler'
0.100586
CREATE TABLE table_name_86 (population_estimate_2005 VARCHAR, capital VARCHAR)
how many population estimate 2005 are for majene?
SELECT COUNT(population_estimate_2005) FROM table_name_86 WHERE capital = "majene"
SELECT COUNT("population_estimate_2005") FROM "table_name_86" WHERE "capital" = "majene"
0.085938
CREATE TABLE table_12722302_2 (original_air_date VARCHAR, us_viewers__million_ VARCHAR)
What was the original air date for the episode with 3.90 u.s. viewers (millions)?
SELECT original_air_date FROM table_12722302_2 WHERE us_viewers__million_ = "3.90"
SELECT "original_air_date" FROM "table_12722302_2" WHERE "3.90" = "us_viewers__million_"
0.085938
CREATE TABLE table_10935205_1 (title VARCHAR, us_airdate VARCHAR)
For the episode(s) aired in the U.S. on 4 april 2008, what were the names?
SELECT title FROM table_10935205_1 WHERE us_airdate = "4 April 2008"
SELECT "title" FROM "table_10935205_1" WHERE "4 April 2008" = "us_airdate"
0.072266
CREATE TABLE table_47879 ("Driver" TEXT, "Team" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT, "Points" TEXT)
What is the number of points associated with 165 laps?
SELECT "Points" FROM table_47879 WHERE "Laps" = '165'
SELECT "Points" FROM "table_47879" WHERE "Laps" = '165'
0.053711
CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) 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 countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL)
For all employees who have the letters D or S in their first name, give me the comparison about the average of employee_id over the hire_date bin hire_date by weekday, and display y-axis from low to high order please.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(EMPLOYEE_ID)
SELECT "HIRE_DATE", AVG("EMPLOYEE_ID") FROM "employees" WHERE "FIRST_NAME" LIKE '%D%' OR "FIRST_NAME" LIKE '%S%' ORDER BY AVG("EMPLOYEE_ID") NULLS FIRST
0.148438
CREATE TABLE table_47841 ("Tournament" TEXT, "1998" TEXT, "1999" TEXT, "2000" TEXT, "2001" TEXT, "2002" TEXT, "2003" TEXT, "2004" TEXT, "2005" TEXT, "2006" TEXT, "2007" TEXT, "2008" TEXT, "2009" TEXT, "2010" TEXT, "2011" TEXT, "2012" TEXT, "2013" TEXT)
what is 2000 when 2012 is 4r?
SELECT "2000" FROM table_47841 WHERE "2012" = '4r'
SELECT "2000" FROM "table_47841" WHERE "2012" = '4r'
0.050781
CREATE TABLE table_33364 ("Station" TEXT, "Municipality" TEXT, "County" TEXT, "Former railroad" TEXT, "Closed" FLOAT)
What municipality is the Benson Street station located in?
SELECT "Municipality" FROM table_33364 WHERE "Station" = 'benson street'
SELECT "Municipality" FROM "table_33364" WHERE "Station" = 'benson street'
0.072266
CREATE TABLE table_15621965_14 (player VARCHAR, school_club_team VARCHAR)
Name the number of players for louisiana state
SELECT COUNT(player) FROM table_15621965_14 WHERE school_club_team = "Louisiana State"
SELECT COUNT("player") FROM "table_15621965_14" WHERE "Louisiana State" = "school_club_team"
0.089844
CREATE TABLE table_16805 ("Week" TEXT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Kickoff [a ]" TEXT, "Game site" TEXT, "TV" TEXT, "Attendance" TEXT, "Record" TEXT)
Which channel had the game against the Minnesota Vikings?
SELECT "TV" FROM table_16805 WHERE "Opponent" = 'Minnesota Vikings'
SELECT "TV" FROM "table_16805" WHERE "Opponent" = 'Minnesota Vikings'
0.067383
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 (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 offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location 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_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 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 semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE 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 program_course (program_id INT, course_id INT, workload INT, category VARCHAR)
Are there any HJCS 400 -level courses that are 9 credits ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE program_course.category LIKE '%ULCS%' AND semester.semester = 'FA' AND semester.year = 2016
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%ULCS%' JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'FA' AND "semester"."year" = 2016
0.416016
CREATE TABLE table_13805773_2 (position INT, artist VARCHAR)
What is highest place reached by artist Ray Adams?
SELECT MAX(position) FROM table_13805773_2 WHERE artist = "Ray Adams"
SELECT MAX("position") FROM "table_13805773_2" WHERE "Ray Adams" = "artist"
0.073242
CREATE TABLE table_name_76 (away_team VARCHAR, tie_no VARCHAR)
In Tie #18, who was the away team?
SELECT away_team FROM table_name_76 WHERE tie_no = "18"
SELECT "away_team" FROM "table_name_76" WHERE "18" = "tie_no"
0.05957
CREATE TABLE table_171250_2 (census_ranking VARCHAR, population VARCHAR)
What are the census ranking(s) for a population of 284?
SELECT census_ranking FROM table_171250_2 WHERE population = 284
SELECT "census_ranking" FROM "table_171250_2" WHERE "population" = 284
0.068359
CREATE TABLE table_21284653_1 (municipal_status VARCHAR, population_density VARCHAR)
What is the municipal status where the population density is 895.5?
SELECT municipal_status FROM table_21284653_1 WHERE population_density = "895.5"
SELECT "municipal_status" FROM "table_21284653_1" WHERE "895.5" = "population_density"
0.083984
CREATE TABLE table_45838 ("Club" TEXT, "City" TEXT, "Stadium" TEXT, "Capacity" FLOAT, "2007\\u201308 season" TEXT)
What is the average capacity that has foligno as the city?
SELECT AVG("Capacity") FROM table_45838 WHERE "City" = 'foligno'
SELECT AVG("Capacity") FROM "table_45838" WHERE "City" = 'foligno'
0.064453
CREATE TABLE table_20504 ("Bowl Game" TEXT, "Date" TEXT, "Stadium" TEXT, "City" TEXT, "Television" TEXT, "Conference Matchups" TEXT, "Payout ( US$ ) " TEXT)
Which stadium has a payout of $3 million?
SELECT "Stadium" FROM table_20504 WHERE "Payout ( US$ )" = '$3 Million'
SELECT "Stadium" FROM "table_20504" WHERE "Payout ( US$ )" = '$3 Million'
0.071289
CREATE TABLE table_10350 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What is the crowd with Home team score of 16.9 (105)?
SELECT AVG("Crowd") FROM table_10350 WHERE "Home team score" = '16.9 (105)'
SELECT AVG("Crowd") FROM "table_10350" WHERE "Home team score" = '16.9 (105)'
0.075195
CREATE TABLE table_22597626_1 (year INT)
When was John McEnroe's minimum year?
SELECT MIN(year) FROM table_22597626_1
SELECT MIN("year") FROM "table_22597626_1"
0.041016
CREATE TABLE table_name_60 (winner VARCHAR, race_name VARCHAR)
Who was the winner of the tre valli varesine race?
SELECT winner FROM table_name_60 WHERE race_name = "tre valli varesine"
SELECT "winner" FROM "table_name_60" WHERE "race_name" = "tre valli varesine"
0.075195
CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) 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 regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL)
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, draw a bar chart about the distribution of hire_date and the sum of manager_id bin hire_date by weekday.
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
SELECT "HIRE_DATE", SUM("MANAGER_ID") FROM "employees" WHERE ("COMMISSION_PCT" <> "null" OR "DEPARTMENT_ID" <> 40) AND ("DEPARTMENT_ID" <> 40 OR "SALARY" <= 12000) AND ("DEPARTMENT_ID" <> 40 OR "SALARY" >= 8000)
0.206055
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 d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title 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 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 icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE diagnoses_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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) 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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
since 2102, when did patient 7165 go to the hospital for the first time?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 7165 AND STRFTIME('%y', admissions.admittime) >= '2102' ORDER BY admissions.admittime LIMIT 1
SELECT "admissions"."admittime" FROM "admissions" WHERE "admissions"."subject_id" = 7165 AND STRFTIME('%y', "admissions"."admittime") >= '2102' ORDER BY "admissions"."admittime" NULLS FIRST LIMIT 1
0.192383
CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT) CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT)
What are the names and prices of products that cost at least 180, sorted by price decreasing and name ascending. Show bar chart.
SELECT Name, Price FROM Products WHERE Price >= 180 ORDER BY Price DESC, Name
SELECT "Name", "Price" FROM "Products" WHERE "Price" >= 180 ORDER BY "Price" DESC NULLS LAST, "Name" NULLS FIRST
0.109375
CREATE TABLE table_40621 ("Outcome" TEXT, "Date" TEXT, "Tournament" TEXT, "Surface" TEXT, "Opponent" TEXT, "Score" TEXT)
What is the Tournament with a Score that is 2 6, 6 4, 3 6?
SELECT "Tournament" FROM table_40621 WHERE "Score" = '2–6, 6–4, 3–6'
SELECT "Tournament" FROM "table_40621" WHERE "Score" = '2–6, 6–4, 3–6'
0.068359
CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT) CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT)
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and the average of revenue , and group by attribute name, and could you display from high to low by the names?
SELECT T2.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name DESC
SELECT "T2"."Name", "T2"."Revenue" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T2"."Name" ORDER BY "T2"."Name" DESC NULLS LAST
0.177734
CREATE TABLE fielding (player_id TEXT, year INT, stint INT, team_id TEXT, league_id TEXT, pos TEXT, g INT, gs DECIMAL, inn_outs DECIMAL, po DECIMAL, a DECIMAL, e DECIMAL, dp DECIMAL, pb DECIMAL, wp DECIMAL, sb DECIMAL, cs DECIMAL, zr DECIMAL) CREATE TABLE team_franchise (franchise_id TEXT, franchise_name TEXT, active TEXT, na_assoc TEXT) CREATE TABLE postseason (year INT, round TEXT, team_id_winner TEXT, league_id_winner TEXT, team_id_loser TEXT, league_id_loser TEXT, wins INT, losses INT, ties INT) CREATE TABLE pitching_postseason (player_id TEXT, year INT, round TEXT, team_id TEXT, league_id TEXT, w INT, l INT, g INT, gs INT, cg INT, sho INT, sv INT, ipouts INT, h INT, er INT, hr INT, bb INT, so INT, baopp TEXT, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk DECIMAL, bfp DECIMAL, gf INT, r INT, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE manager_award (player_id TEXT, award_id TEXT, year INT, league_id TEXT, tie TEXT, notes DECIMAL) CREATE TABLE fielding_outfield (player_id TEXT, year INT, stint INT, glf DECIMAL, gcf DECIMAL, grf DECIMAL) CREATE TABLE manager (player_id TEXT, year INT, team_id TEXT, league_id TEXT, inseason INT, g INT, w INT, l INT, rank DECIMAL, plyr_mgr TEXT) CREATE TABLE salary (year INT, team_id TEXT, league_id TEXT, player_id TEXT, salary INT) CREATE TABLE manager_half (player_id TEXT, year INT, team_id TEXT, league_id TEXT, inseason INT, half INT, g INT, w INT, l INT, rank INT) CREATE TABLE player_award_vote (award_id TEXT, year INT, league_id TEXT, player_id TEXT, points_won DECIMAL, points_max INT, votes_first DECIMAL) CREATE TABLE team (year INT, league_id TEXT, team_id TEXT, franchise_id TEXT, div_id TEXT, rank INT, g INT, ghome DECIMAL, w INT, l INT, div_win TEXT, wc_win TEXT, lg_win TEXT, ws_win TEXT, r INT, ab INT, h INT, double INT, triple INT, hr INT, bb INT, so DECIMAL, sb DECIMAL, cs DECIMAL, hbp DECIMAL, sf DECIMAL, ra INT, er INT, era DECIMAL, cg INT, sho INT, sv INT, ipouts INT, ha INT, hra INT, bba INT, soa INT, e INT, dp DECIMAL, fp DECIMAL, name TEXT, park TEXT, attendance DECIMAL, bpf INT, ppf INT, team_id_br TEXT, team_id_lahman45 TEXT, team_id_retro TEXT) CREATE TABLE hall_of_fame (player_id TEXT, yearid INT, votedby TEXT, ballots DECIMAL, needed DECIMAL, votes DECIMAL, inducted TEXT, category TEXT, needed_note TEXT) CREATE TABLE team_half (year INT, league_id TEXT, team_id TEXT, half INT, div_id TEXT, div_win TEXT, rank INT, g INT, w INT, l INT) CREATE TABLE manager_award_vote (award_id TEXT, year INT, league_id TEXT, player_id TEXT, points_won INT, points_max INT, votes_first INT) CREATE TABLE pitching (player_id TEXT, year INT, stint INT, team_id TEXT, league_id TEXT, w INT, l INT, g INT, gs INT, cg INT, sho INT, sv INT, ipouts DECIMAL, h INT, er INT, hr INT, bb INT, so INT, baopp DECIMAL, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk INT, bfp DECIMAL, gf DECIMAL, r INT, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE all_star (player_id TEXT, year INT, game_num INT, game_id TEXT, team_id TEXT, league_id TEXT, gp DECIMAL, starting_pos DECIMAL) CREATE TABLE batting_postseason (year INT, round TEXT, player_id TEXT, team_id TEXT, league_id TEXT, g INT, ab INT, r INT, h INT, double INT, triple INT, hr INT, rbi INT, sb INT, cs DECIMAL, bb INT, so INT, ibb DECIMAL, hbp DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE home_game (year INT, league_id TEXT, team_id TEXT, park_id TEXT, span_first TEXT, span_last TEXT, games INT, openings INT, attendance INT) CREATE TABLE player_college (player_id TEXT, college_id TEXT, year INT) CREATE TABLE fielding_postseason (player_id TEXT, year INT, team_id TEXT, league_id TEXT, round TEXT, pos TEXT, g INT, gs DECIMAL, inn_outs DECIMAL, po INT, a INT, e INT, dp INT, tp INT, pb DECIMAL, sb DECIMAL, cs DECIMAL) CREATE TABLE batting (player_id TEXT, year INT, stint INT, team_id TEXT, league_id TEXT, g INT, ab DECIMAL, r DECIMAL, h DECIMAL, double DECIMAL, triple DECIMAL, hr DECIMAL, rbi DECIMAL, sb DECIMAL, cs DECIMAL, bb DECIMAL, so DECIMAL, ibb DECIMAL, hbp DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE appearances (year INT, team_id TEXT, league_id TEXT, player_id TEXT, g_all DECIMAL, gs DECIMAL, g_batting INT, g_defense DECIMAL, g_p INT, g_c INT, g_1b INT, g_2b INT, g_3b INT, g_ss INT, g_lf INT, g_cf INT, g_rf INT, g_of INT, g_dh DECIMAL, g_ph DECIMAL, g_pr DECIMAL) CREATE TABLE park (park_id TEXT, park_name TEXT, park_alias TEXT, city TEXT, state TEXT, country TEXT) CREATE TABLE player_award (player_id TEXT, award_id TEXT, year INT, league_id TEXT, tie TEXT, notes TEXT) CREATE TABLE player (player_id TEXT, birth_year DECIMAL, birth_month DECIMAL, birth_day DECIMAL, birth_country TEXT, birth_state TEXT, birth_city TEXT, death_year DECIMAL, death_month DECIMAL, death_day DECIMAL, death_country TEXT, death_state TEXT, death_city TEXT, name_first TEXT, name_last TEXT, name_given TEXT, weight DECIMAL, height DECIMAL, bats TEXT, throws TEXT, debut TEXT, final_game TEXT, retro_id TEXT, bbref_id TEXT) CREATE TABLE college (college_id TEXT, name_full TEXT, city TEXT, state TEXT, country TEXT)
How many home games by each year (bin the year attr into weekdays interval)? Give me a line chart, and display X-axis in descending order.
SELECT year, COUNT(year) FROM home_game ORDER BY year DESC
SELECT "year", COUNT("year") FROM "home_game" ORDER BY "year" DESC NULLS LAST
0.075195
CREATE TABLE table_54139 ("Year" FLOAT, "Pick" TEXT, "Player name" TEXT, "Position" TEXT, "College" TEXT)
In which year was a linebacker pick 17?
SELECT "Year" FROM table_54139 WHERE "Position" = 'linebacker' AND "Pick" = '17'
SELECT "Year" FROM "table_54139" WHERE "Pick" = '17' AND "Position" = 'linebacker'
0.080078
CREATE TABLE table_12271 ("Shooter" TEXT, "Event" TEXT, "Rank points" TEXT, "Score points" TEXT, "Total" TEXT)
Who is the shooter at the WC Rio De Janeiro event with 10 rank points?
SELECT "Shooter" FROM table_12271 WHERE "Event" = 'wc rio de janeiro' AND "Rank points" = '10'
SELECT "Shooter" FROM "table_12271" WHERE "Event" = 'wc rio de janeiro' AND "Rank points" = '10'
0.09375
CREATE TABLE table_4365 ("Year" FLOAT, "Wins" FLOAT, "Losses" FLOAT, "Percentage" FLOAT, "Finish" TEXT)
What is the most losses that the Royals had when they had a percentage over 0.461, won over 86 games, and finished 2nd in 1953?
SELECT MAX("Losses") FROM table_4365 WHERE "Percentage" > '0.461' AND "Wins" > '86' AND "Finish" = '2nd' AND "Year" = '1953'
SELECT MAX("Losses") FROM "table_4365" WHERE "Finish" = '2nd' AND "Percentage" > '0.461' AND "Wins" > '86' AND "Year" = '1953'
0.123047
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE 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 allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
how many hours has it been since the first time patient 006-157753 received procedure on the current hospital visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-157753' AND patient.hospitaldischargetime IS NULL)) ORDER BY treatment.treatmenttime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '006-157753' 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 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "treatment"."treatmenttime")) FROM "treatment" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "treatment"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL ORDER BY "treatment"."treatmenttime" NULLS FIRST LIMIT 1
0.655273
CREATE TABLE table_66142 ("Model number" TEXT, "sSpec number" TEXT, "Cores" TEXT, "Frequency" TEXT, "Turbo" TEXT, "L2 cache" TEXT, "L3 cache" TEXT, "GPU model" TEXT, "GPU frequency" TEXT, "Socket" TEXT, "I/O bus" TEXT, "Release date" TEXT, "Part number ( s ) " TEXT, "Release price ( USD ) " TEXT)
What is the I/O bus entry for the processor with a release price of $657?
SELECT "I/O bus" FROM table_66142 WHERE "Release price ( USD )" = '$657'
SELECT "I/O bus" FROM "table_66142" WHERE "Release price ( USD )" = '$657'
0.072266
CREATE TABLE table_37900 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" TEXT, "Result" TEXT)
What is the First elected of california 3?
SELECT "First elected" FROM table_37900 WHERE "District" = 'california 3'
SELECT "First elected" FROM "table_37900" WHERE "District" = 'california 3'
0.073242
CREATE TABLE table_204_639 (id DECIMAL, "poll company" TEXT, "source" TEXT, "publication date" TEXT, "psuv" DECIMAL, "opposition" DECIMAL, "undecided" DECIMAL)
which poll company has the most opposition ?
SELECT "poll company" FROM table_204_639 ORDER BY "opposition" DESC LIMIT 1
SELECT "poll company" FROM "table_204_639" ORDER BY "opposition" DESC NULLS LAST LIMIT 1
0.085938
CREATE TABLE table_18421 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Result" TEXT, "Candidates" TEXT)
What candidates were in the election when a republican was re-elected?
SELECT "Candidates" FROM table_18421 WHERE "Result" = 'Re-elected' AND "Party" = 'Republican'
SELECT "Candidates" FROM "table_18421" WHERE "Party" = 'Republican' AND "Result" = 'Re-elected'
0.092773
CREATE TABLE table_51195 ("Year" FLOAT, "Theme" TEXT, "Artist" TEXT, "Composition" TEXT, "Mintage" FLOAT, "Issue Price" TEXT)
What's the mintage when the theme was year of the rabbit?
SELECT "Mintage" FROM table_51195 WHERE "Theme" = 'year of the rabbit'
SELECT "Mintage" FROM "table_51195" WHERE "Theme" = 'year of the rabbit'
0.070313
CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT) CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT)
For those records from the products and each product's manufacturer, give me the comparison about the amount of headquarter over the headquarter , and group by attribute headquarter, I want to rank by the bars in ascending.
SELECT Headquarter, COUNT(Headquarter) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY Headquarter
SELECT "Headquarter", COUNT("Headquarter") FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Headquarter" ORDER BY "Headquarter" NULLS FIRST
0.185547
CREATE TABLE table_203_300 (id DECIMAL, "year" DECIMAL, "tournament" TEXT, "venue" TEXT, "result" TEXT, "extra" TEXT)
how many times was the venue in greece ?
SELECT COUNT(*) FROM table_203_300 WHERE "venue" = 'greece'
SELECT COUNT(*) FROM "table_203_300" WHERE "venue" = 'greece'
0.05957
CREATE TABLE table_name_43 (country VARCHAR, score VARCHAR)
What is the country that the player with a score of 70-69=139 from?
SELECT country FROM table_name_43 WHERE score = 70 - 69 = 139
SELECT "country" FROM "table_name_43" WHERE "score" = FALSE
0.057617
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 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 prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
give me the number of patients whose year of death is less than or equal to 2155 and procedure icd9 code is 3806?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2155.0" AND procedures.icd9_code = "3806"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "3806" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2155.0" >= "demographic"."dod_year"
0.213867
CREATE TABLE editor (Editor_ID INT, Name TEXT, Age FLOAT) CREATE TABLE journal_committee (Editor_ID INT, Journal_ID INT, Work_Type TEXT) CREATE TABLE journal (Journal_ID INT, Date TEXT, Theme TEXT, Sales INT)
Give me a bar chart to show the theme and their sales of the journal which did not have any of the listed editors serving on the committee, rank in descending by the x axis.
SELECT T1.Theme, T1.Sales FROM journal EXCEPT SELECT T1.Date, T1.Theme, T1.Sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.Journal_ID = T2.Journal_ID ORDER BY T1.Theme DESC
SELECT "T1"."Theme", "T1"."Sales" FROM "journal" EXCEPT SELECT "T1"."Date", "T1"."Theme" FROM "journal" AS "T1" JOIN "journal_committee" AS "T2" ON "T1"."Journal_ID" = "T2"."Journal_ID" ORDER BY "T1"."Theme" DESC NULLS LAST
0.217773
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 inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost 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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod 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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE 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 d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
when was the last time when patient 25965 was prescribed syringe (chemo) and chlorhexidine gluconate 0.12% oral rinse at the same time until 08/2105?
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'syringe (chemo)' AND admissions.subject_id = 25965 AND STRFTIME('%y-%m', prescriptions.startdate) <= '2105-08') AS t1 JOIN (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'chlorhexidine gluconate 0.12% oral rinse' AND admissions.subject_id = 25965 AND STRFTIME('%y-%m', prescriptions.startdate) <= '2105-08') AS t2 ON t1.subject_id = t2.subject_id WHERE DATETIME(t1.startdate) = DATETIME(t2.startdate) ORDER BY t1.startdate DESC LIMIT 1
WITH "t2" AS (SELECT "admissions"."subject_id", "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" AND "admissions"."subject_id" = 25965 WHERE "prescriptions"."drug" = 'chlorhexidine gluconate 0.12% oral rinse' AND STRFTIME('%y-%m', "prescriptions"."startdate") <= '2105-08') SELECT "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" AND "admissions"."subject_id" = 25965 JOIN "t2" AS "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND DATETIME("prescriptions"."startdate") = DATETIME("t2"."startdate") WHERE "prescriptions"."drug" = 'syringe (chemo)' AND STRFTIME('%y-%m', "prescriptions"."startdate") <= '2105-08' ORDER BY "prescriptions"."startdate" DESC NULLS LAST LIMIT 1
0.803711
CREATE TABLE table_48778 ("Title" TEXT, "Season" FLOAT, "Director" TEXT, "Teleplay" TEXT, "First Broadcast" TEXT)
What is Teleplay, when Director is 'George McCowan', when Season is less than 1.1400000000000001, and when First Broadcast is April 3, 1981?
SELECT "Teleplay" FROM table_48778 WHERE "Director" = 'george mccowan' AND "Season" < '1.1400000000000001' AND "First Broadcast" = 'april 3, 1981'
SELECT "Teleplay" FROM "table_48778" WHERE "Director" = 'george mccowan' AND "First Broadcast" = 'april 3, 1981' AND "Season" < '1.1400000000000001'
0.144531
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId 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 PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostHistoryTypes (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 SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
Question States over Time (Percent).
WITH Batches AS (SELECT DATEADD(mm, DATEPART(mm, Post.CreationDate) - 1, DATEADD(yy, DATEPART(yyyy, Post.CreationDate) - 1900, 0)) AS "date", COUNT(*) AS Total, SUM(CASE WHEN NOT Post.LastEditorUserId IS NULL THEN 1 ELSE 0 END) AS "edited" FROM Posts AS Post GROUP BY DATEPART(yyyy, Post.CreationDate), DATEPART(mm, Post.CreationDate)) SELECT 'date', Total, Edited FROM Batches ORDER BY Date
WITH "Batches" AS (SELECT MAX(1) AS "_" FROM "Posts" AS "Post" GROUP BY DATEPART("yyyy", "Post"."CreationDate"), DATEPART("mm", "Post"."CreationDate")) SELECT 'date', "Total", "Edited" FROM "Batches" ORDER BY "Date" NULLS FIRST
0.22168
CREATE TABLE table_203_203 (id DECIMAL, "year" DECIMAL, "majors" DECIMAL, "atp wins" DECIMAL, "total wins" DECIMAL, "earnings ( us$ ) " DECIMAL, "money list rank" DECIMAL)
top paid year ?
SELECT "year" FROM table_203_203 ORDER BY "earnings (us$)" DESC LIMIT 1
SELECT "year" FROM "table_203_203" ORDER BY "earnings (us$)" DESC NULLS LAST LIMIT 1
0.082031
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) 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)
how many patients whose ethnicity is asian and diagnoses long title is neutropenia, unspecified?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "ASIAN" AND diagnoses.long_title = "Neutropenia, unspecified"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Neutropenia, unspecified" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "ASIAN" = "demographic"."ethnicity"
0.230469
CREATE TABLE table_37431 ("Round" FLOAT, "Player" TEXT, "Position" TEXT, "Nationality" TEXT, "College/Junior/Club Team" TEXT)
What is the round of the defense player from the United States?
SELECT "Round" FROM table_37431 WHERE "Position" = 'defense' AND "Nationality" = 'united states'
SELECT "Round" FROM "table_37431" WHERE "Nationality" = 'united states' AND "Position" = 'defense'
0.095703
CREATE TABLE player (id DECIMAL, player_api_id DECIMAL, player_name TEXT, player_fifa_api_id DECIMAL, birthday TEXT, height DECIMAL, weight DECIMAL) CREATE TABLE team_attributes (id DECIMAL, team_fifa_api_id DECIMAL, team_api_id DECIMAL, date TEXT, buildupplayspeed DECIMAL, buildupplayspeedclass TEXT, buildupplaydribbling DECIMAL, buildupplaydribblingclass TEXT, buildupplaypassing DECIMAL, buildupplaypassingclass TEXT, buildupplaypositioningclass TEXT, chancecreationpassing DECIMAL, chancecreationpassingclass TEXT, chancecreationcrossing DECIMAL, chancecreationcrossingclass TEXT, chancecreationshooting DECIMAL, chancecreationshootingclass TEXT, chancecreationpositioningclass TEXT, defencepressure DECIMAL, defencepressureclass TEXT, defenceaggression DECIMAL, defenceaggressionclass TEXT, defenceteamwidth DECIMAL, defenceteamwidthclass TEXT, defencedefenderlineclass TEXT) CREATE TABLE country (id DECIMAL, name TEXT) CREATE TABLE league (id DECIMAL, country_id DECIMAL, name TEXT) CREATE TABLE player_attributes (id DECIMAL, player_fifa_api_id DECIMAL, player_api_id DECIMAL, date TEXT, overall_rating DECIMAL, potential DECIMAL, preferred_foot TEXT, attacking_work_rate TEXT, defensive_work_rate TEXT, crossing DECIMAL, finishing DECIMAL, heading_accuracy DECIMAL, short_passing DECIMAL, volleys DECIMAL, dribbling DECIMAL, curve DECIMAL, free_kick_accuracy DECIMAL, long_passing DECIMAL, ball_control DECIMAL, acceleration DECIMAL, sprint_speed DECIMAL, agility DECIMAL, reactions DECIMAL, balance DECIMAL, shot_power DECIMAL, jumping DECIMAL, stamina DECIMAL, strength DECIMAL, long_shots DECIMAL, aggression DECIMAL, interceptions DECIMAL, positioning DECIMAL, vision DECIMAL, penalties DECIMAL, marking DECIMAL, standing_tackle DECIMAL, sliding_tackle DECIMAL, gk_diving DECIMAL, gk_handling DECIMAL, gk_kicking DECIMAL, gk_positioning DECIMAL, gk_reflexes DECIMAL) CREATE TABLE sqlite_sequence (name TEXT, seq TEXT) CREATE TABLE team (id DECIMAL, team_api_id DECIMAL, team_fifa_api_id DECIMAL, team_long_name TEXT, team_short_name TEXT)
Of all players with an overall rating greater than 80, how many are right-footed and left-footed?
SELECT preferred_foot, COUNT(*) FROM player_attributes WHERE overall_rating > 80 GROUP BY preferred_foot
SELECT "preferred_foot", COUNT(*) FROM "player_attributes" WHERE "overall_rating" > 80 GROUP BY "preferred_foot"
0.109375
CREATE TABLE table_name_43 (lost INT, pool_round VARCHAR, played VARCHAR)
Can you tell me the highest Lost that has the Pool/Round of pool 2, and the Played smaller than 6?
SELECT MAX(lost) FROM table_name_43 WHERE pool_round = "pool 2" AND played < 6
SELECT MAX("lost") FROM "table_name_43" WHERE "played" < 6 AND "pool 2" = "pool_round"
0.083984
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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE 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 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 lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
in 11/last year, had patient 007-10135 had any allergies?
SELECT COUNT(*) > 0 FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-10135')) AND DATETIME(allergy.allergytime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', allergy.allergytime) = '11'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '007-10135' 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 "allergy" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "allergy"."patientunitstayid" WHERE DATETIME("allergy"."allergytime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL AND STRFTIME('%m', "allergy"."allergytime") = '11'
0.637695
CREATE TABLE table_204_626 (id DECIMAL, "image" DECIMAL, "name" TEXT, "birth date" TEXT, "death date" TEXT, "brief biography" TEXT)
how many children were born in february ?
SELECT COUNT("name") FROM table_204_626 WHERE "birth date" = 2
SELECT COUNT("name") FROM "table_204_626" WHERE "birth date" = 2
0.0625
CREATE TABLE table_name_22 (laps VARCHAR, grid VARCHAR, driver VARCHAR)
How many laps for alexander wurz with a grid under 12?
SELECT COUNT(laps) FROM table_name_22 WHERE grid < 12 AND driver = "alexander wurz"
SELECT COUNT("laps") FROM "table_name_22" WHERE "alexander wurz" = "driver" AND "grid" < 12
0.088867
CREATE TABLE table_1939367_1 (arabs_2011 VARCHAR, province VARCHAR)
If the province is Nunavut, what is the Arabs 2011 amount?
SELECT arabs_2011 FROM table_1939367_1 WHERE province = "Nunavut"
SELECT "arabs_2011" FROM "table_1939367_1" WHERE "Nunavut" = "province"
0.069336