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_29942205_1 (miss_international INT)
What is the lowest value in the miss international column?
SELECT MIN(miss_international) FROM table_29942205_1
SELECT MIN("miss_international") FROM "table_29942205_1"
0.054688
CREATE TABLE table_68218 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Decision" TEXT, "Attendance" FLOAT, "Record" TEXT)
What was the total attendance at games when Detroit was the visiting team and the record was 36 13 5?
SELECT COUNT("Attendance") FROM table_68218 WHERE "Visitor" = 'detroit' AND "Record" = '36–13–5'
SELECT COUNT("Attendance") FROM "table_68218" WHERE "Record" = '36–13–5' AND "Visitor" = 'detroit'
0.095703
CREATE TABLE table_22815568_2 (status VARCHAR, poverty_rate VARCHAR)
What is the status of the county that has a 17.3% poverty rate?
SELECT status FROM table_22815568_2 WHERE poverty_rate = "17.3%"
SELECT "status" FROM "table_22815568_2" WHERE "17.3%" = "poverty_rate"
0.068359
CREATE TABLE table_name_86 (h___a VARCHAR, opponents VARCHAR)
Was the game with Kashima antlers at home or away?
SELECT h___a FROM table_name_86 WHERE opponents = "kashima antlers"
SELECT "h___a" FROM "table_name_86" WHERE "kashima antlers" = "opponents"
0.071289
CREATE TABLE table_22603701_1 (result VARCHAR, college VARCHAR)
What is the result for Wisconsin?
SELECT result FROM table_22603701_1 WHERE college = "Wisconsin"
SELECT "result" FROM "table_22603701_1" WHERE "Wisconsin" = "college"
0.067383
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE 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 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 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
what are the four most frequent procedure that patients have received during the same month after they have received a non-invasive mech vent procedure?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'non-invasive mech vent')) AS t1 JOIN (SELECT admissions.subject_id, procedures_icd.icd9_code, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND DATETIME(t1.charttime, 'start of month') = DATETIME(t2.charttime, 'start of month') GROUP BY t2.icd9_code) AS t3 WHERE t3.c1 <= 4)
WITH "t2" AS (SELECT "admissions"."subject_id", "procedures_icd"."icd9_code", "procedures_icd"."charttime" FROM "procedures_icd" JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id"), "t3" AS (SELECT "t2"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'non-invasive mech vent' JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id" JOIN "t2" AS "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND "procedures_icd"."charttime" < "t2"."charttime" AND DATETIME("procedures_icd"."charttime", 'start of month') = DATETIME("t2"."charttime", 'start of month') GROUP BY "t2"."icd9_code"), "_u_1" AS (SELECT "t3"."icd9_code" FROM "t3" AS "t3" WHERE "t3"."c1" <= 4 GROUP BY "icd9_code") SELECT "d_icd_procedures"."short_title" FROM "d_icd_procedures" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "d_icd_procedures"."icd9_code" WHERE NOT "_u_1"."" IS NULL
1.038086
CREATE TABLE table_name_31 (tournament VARCHAR, finalist VARCHAR)
WHich Tournament has a Finalist of gustavo kuerten (4)?
SELECT tournament FROM table_name_31 WHERE finalist = "gustavo kuerten (4)"
SELECT "tournament" FROM "table_name_31" WHERE "finalist" = "gustavo kuerten (4)"
0.079102
CREATE TABLE table_45819 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT)
What score has fred couples as the player?
SELECT "Score" FROM table_45819 WHERE "Player" = 'fred couples'
SELECT "Score" FROM "table_45819" WHERE "Player" = 'fred couples'
0.063477
CREATE TABLE table_name_81 (date VARCHAR, attendance VARCHAR)
What date was the attendance 82,500?
SELECT date FROM table_name_81 WHERE attendance = "82,500"
SELECT "date" FROM "table_name_81" WHERE "82,500" = "attendance"
0.0625
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 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 procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is the number of patients whose admission location is trsf within this facility and year of birth is less than 2138?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.dob_year < "2138"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2138" > "demographic"."dob_year" AND "TRSF WITHIN THIS FACILITY" = "demographic"."admission_location"
0.172852
CREATE TABLE table_name_27 (total INT, gold VARCHAR, bronze VARCHAR, nation VARCHAR)
What is the sum of all total medals with more than 2 bronze medals and more than 1 gold medal for the United States?
SELECT SUM(total) FROM table_name_27 WHERE bronze > 2 AND nation = "united states" AND gold > 1
SELECT SUM("total") FROM "table_name_27" WHERE "bronze" > 2 AND "gold" > 1 AND "nation" = "united states"
0.102539
CREATE TABLE table_203_612 (id DECIMAL, "rank" DECIMAL, "nation" TEXT, "gold" DECIMAL, "silver" DECIMAL, "bronze" DECIMAL, "total" DECIMAL)
how many nations have at least 20 gold medals ?
SELECT COUNT("nation") FROM table_203_612 WHERE "gold" >= 20
SELECT COUNT("nation") FROM "table_203_612" WHERE "gold" >= 20
0.060547
CREATE TABLE station (id INT, name TEXT, lat DECIMAL, long DECIMAL, dock_count INT, city TEXT, installation_date TEXT) CREATE TABLE trip (id INT, duration INT, start_date TEXT, start_station_name TEXT, start_station_id INT, end_date TEXT, end_station_name TEXT, end_station_id INT, bike_id INT, subscription_type TEXT, zip_code INT) CREATE TABLE weather (date TEXT, max_temperature_f INT, mean_temperature_f INT, min_temperature_f INT, max_dew_point_f INT, mean_dew_point_f INT, min_dew_point_f INT, max_humidity INT, mean_humidity INT, min_humidity INT, max_sea_level_pressure_inches DECIMAL, mean_sea_level_pressure_inches DECIMAL, min_sea_level_pressure_inches DECIMAL, max_visibility_miles INT, mean_visibility_miles INT, min_visibility_miles INT, max_wind_Speed_mph INT, mean_wind_speed_mph INT, max_gust_speed_mph INT, precipitation_inches INT, cloud_cover INT, events TEXT, wind_dir_degrees INT, zip_code INT) CREATE TABLE status (station_id INT, bikes_available INT, docks_available INT, time TEXT)
Visualize a scatter chart on what are the ids and durations of the trips with the top 3 durations?
SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3
SELECT "id", "duration" FROM "trip" ORDER BY "duration" DESC NULLS LAST LIMIT 3
0.077148
CREATE TABLE table_name_60 (date VARCHAR, location VARCHAR, cause VARCHAR, death_toll VARCHAR)
When has a cause of gas explosion, a Death toll smaller than 63, and a Location of penygraig?
SELECT date FROM table_name_60 WHERE cause = "gas explosion" AND death_toll < 63 AND location = "penygraig"
SELECT "date" FROM "table_name_60" WHERE "cause" = "gas explosion" AND "death_toll" < 63 AND "location" = "penygraig"
0.114258
CREATE TABLE table_name_5 (team VARCHAR, race_title VARCHAR)
What team has a title of calder?
SELECT team FROM table_name_5 WHERE race_title = "calder"
SELECT "team" FROM "table_name_5" WHERE "calder" = "race_title"
0.061523
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) 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)
count the number of patients whose diagnoses long title is embolism and thrombosis of iliac artery 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.long_title = "Embolism and thrombosis of iliac artery" AND lab.flag = "delta"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Embolism and thrombosis of iliac artery" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "delta" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.285156
CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT) CREATE TABLE voting_record (stuid DECIMAL, registration_date TEXT, election_cycle TEXT, president_vote DECIMAL, vice_president_vote DECIMAL, secretary_vote DECIMAL, treasurer_vote DECIMAL, class_president_vote DECIMAL, class_senator_vote DECIMAL)
What are the first names of all the students aged above 22?
SELECT fname FROM student WHERE age > 22
SELECT "fname" FROM "student" WHERE "age" > 22
0.044922
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
how many patients whose diagnoses short title is schizophrenia nos-unspec and lab test abnormal status is abnormal?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Schizophrenia NOS-unspec" AND lab.flag = "abnormal"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Schizophrenia NOS-unspec" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "abnormal" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.274414
CREATE TABLE Apartment_Buildings (building_id INT, building_short_name CHAR, building_full_name VARCHAR, building_description VARCHAR, building_address VARCHAR, building_manager VARCHAR, building_phone VARCHAR) CREATE TABLE Apartment_Facilities (apt_id INT, facility_code CHAR) CREATE TABLE Apartment_Bookings (apt_booking_id INT, apt_id INT, guest_id INT, booking_status_code CHAR, booking_start_date DATETIME, booking_end_date DATETIME) CREATE TABLE Guests (guest_id INT, gender_code CHAR, guest_first_name VARCHAR, guest_last_name VARCHAR, date_of_birth DATETIME) CREATE TABLE Apartments (apt_id INT, building_id INT, apt_type_code CHAR, apt_number CHAR, bathroom_count INT, bedroom_count INT, room_count CHAR) CREATE TABLE View_Unit_Status (apt_id INT, apt_booking_id INT, status_date DATETIME, available_yn BIT)
Show the booking status code and the corresponding number of bookings by a pie chart.
SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
SELECT "booking_status_code", COUNT(*) FROM "Apartment_Bookings" GROUP BY "booking_status_code"
0.092773
CREATE TABLE movie (director VARCHAR)
How many movie directors are there?
SELECT COUNT(DISTINCT director) FROM movie
SELECT COUNT(DISTINCT "director") FROM "movie"
0.044922
CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) 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 locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL)
For those employees who was hired before 2002-06-21, show me about the distribution of hire_date and the average of salary bin hire_date by time in a bar chart.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21'
SELECT "HIRE_DATE", AVG("SALARY") FROM "employees" WHERE "HIRE_DATE" < '2002-06-21'
0.081055
CREATE TABLE classroom (building VARCHAR, capacity INT)
Find the number of rooms with more than 50 capacity for each building.
SELECT COUNT(*), building FROM classroom WHERE capacity > 50 GROUP BY building
SELECT COUNT(*), "building" FROM "classroom" WHERE "capacity" > 50 GROUP BY "building"
0.083984
CREATE TABLE table_10122 ("Rank" FLOAT, "Nation" TEXT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
For ranks over 2 with Golds over 6 and Silvers over 5 what would be the lowest qualifying Total?
SELECT MIN("Total") FROM table_10122 WHERE "Gold" > '6' AND "Rank" > '2' AND "Silver" > '5'
SELECT MIN("Total") FROM "table_10122" WHERE "Gold" > '6' AND "Rank" > '2' AND "Silver" > '5'
0.09082
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 ReviewTaskStates (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 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId 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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE 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 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 PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange 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 PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (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 PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
Reciprocal accepting of answers for user questions.
WITH questions AS (SELECT p1.OwnerUserId AS question_userid, p2.OwnerUserId AS answer_userid, p1.Id FROM Posts AS p1 INNER JOIN Posts AS p2 ON p1.AcceptedAnswerId = p2.Id) SELECT q1.question_userid AS userid1, q1.answer_userid AS userid2, q1.Id, q2.Id FROM questions AS q1 INNER JOIN questions AS q2 ON q1.question_userid = q2.answer_userid AND q1.answer_userid = q2.question_userid AND q1.question_userid != q1.answer_userid
WITH "questions" AS (SELECT "p1"."OwnerUserId" AS "question_userid", "p2"."OwnerUserId" AS "answer_userid", "p1"."Id" FROM "Posts" AS "p1" JOIN "Posts" AS "p2" ON "p1"."AcceptedAnswerId" = "p2"."Id") SELECT "q1"."question_userid" AS "userid1", "q1"."answer_userid" AS "userid2", "q1"."Id", "q2"."Id" FROM "questions" AS "q1" JOIN "questions" AS "q2" ON "q1"."answer_userid" <> "q1"."question_userid" AND "q1"."answer_userid" = "q2"."question_userid" AND "q1"."question_userid" = "q2"."answer_userid"
0.487305
CREATE TABLE table_204_185 (id DECIMAL, "location" TEXT, "town" TEXT, "output ( mw ac ) " DECIMAL, "modules" DECIMAL, "number of arrays" DECIMAL)
there is at least how many locations ?
SELECT COUNT("location") FROM table_204_185
SELECT COUNT("location") FROM "table_204_185"
0.043945
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 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 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 job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL)
For those employees who did not have any job in the past, a bar chart shows the distribution of hire_date and the sum of manager_id bin hire_date by time.
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
SELECT "HIRE_DATE", SUM("MANAGER_ID") FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history")
0.120117
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
what is the number of patients admitted before the year 2168 and diagnosed for prim cardiomyopathy nec?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2168" AND diagnoses.short_title = "Prim cardiomyopathy NEC"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Prim cardiomyopathy NEC" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "2168" > "demographic"."admityear"
0.229492
CREATE TABLE basketball_match (All_Games VARCHAR, school_id VARCHAR) CREATE TABLE university (location VARCHAR, school_id VARCHAR)
Find the location and all games score of the school that has Clemson as its team name.
SELECT t2.All_Games, t1.location FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE team_name = 'Clemson'
SELECT "t2"."All_Games", "t1"."location" FROM "university" AS "t1" JOIN "basketball_match" AS "t2" ON "t1"."school_id" = "t2"."school_id" WHERE "team_name" = 'Clemson'
0.163086
CREATE TABLE table_train_198 ("id" INT, "hemoglobin_a1c_hba1c" FLOAT, "fasting_plasma_glucose" INT, "diabetes" BOOLEAN, "body_mass_index_bmi" FLOAT, "type_1_patients" BOOLEAN, "NOUSE" FLOAT)
hemoglobin a1c of 7 _ 10 % at screening.
SELECT * FROM table_train_198 WHERE hemoglobin_a1c_hba1c >= 7 AND hemoglobin_a1c_hba1c <= 10
SELECT * FROM "table_train_198" WHERE "hemoglobin_a1c_hba1c" <= 10 AND "hemoglobin_a1c_hba1c" >= 7
0.095703
CREATE TABLE table_name_87 (score VARCHAR)
What score has 15.0% as the 2012?
SELECT score FROM table_name_87 WHERE 2012 = "15.0%"
SELECT "score" FROM "table_name_87" WHERE "15.0%" = 2012
0.054688
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE 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 prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE 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 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)
calculate the number of visits to patient 72647's hospital since 2102.
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 72647 AND STRFTIME('%y', admissions.admittime) >= '2102'
SELECT COUNT(DISTINCT "admissions"."hadm_id") FROM "admissions" WHERE "admissions"."subject_id" = 72647 AND STRFTIME('%y', "admissions"."admittime") >= '2102'
0.154297
CREATE TABLE table_dev_40 ("id" INT, "tc" INT, "ldl_cholesterol" INT, "systolic_blood_pressure_sbp" INT, "untreated_hyperlipidemia" BOOLEAN, "hemoglobin_a1c_hba1c" FLOAT, "platelets" INT, "neutropenia" INT, "thrombocytopenia" FLOAT, "diastolic_blood_pressure_dbp" INT, "tgc" INT, "lymphopenia" INT, "insulin_requirement" FLOAT, "ldl" INT, "fasting_serum_lipoprotein" BOOLEAN, "triglyceride_tg" FLOAT, "hypertension" BOOLEAN, "NOUSE" FLOAT)
fasting serum lipoprotein values of: ldl _ cholesterol, > 160 mg / dl or triglycerides, > 500 mg / dl
SELECT * FROM table_dev_40 WHERE fasting_serum_lipoprotein = 1 OR ldl_cholesterol > 160 OR triglyceride_tg > 500
SELECT * FROM "table_dev_40" WHERE "fasting_serum_lipoprotein" = 1 OR "ldl_cholesterol" > 160 OR "triglyceride_tg" > 500
0.117188
CREATE TABLE products (code DECIMAL, name TEXT, price DECIMAL, manufacturer DECIMAL) CREATE TABLE manufacturers (code DECIMAL, name TEXT, headquarter TEXT, founder TEXT, revenue DECIMAL)
Find the name of companies whose revenue is between 100 and 150.
SELECT name FROM manufacturers WHERE revenue BETWEEN 100 AND 150
SELECT "name" FROM "manufacturers" WHERE "revenue" <= 150 AND "revenue" >= 100
0.076172
CREATE TABLE table_name_78 (third_place VARCHAR, fifth_place VARCHAR)
Who was third place when Fran Dieli was fifth place?
SELECT third_place FROM table_name_78 WHERE fifth_place = "fran dieli"
SELECT "third_place" FROM "table_name_78" WHERE "fifth_place" = "fran dieli"
0.074219
CREATE TABLE PlaylistTrack (PlaylistId INT, TrackId INT) CREATE TABLE InvoiceLine (InvoiceLineId INT, InvoiceId INT, TrackId INT, UnitPrice DECIMAL, Quantity INT) CREATE TABLE Employee (EmployeeId INT, LastName VARCHAR, FirstName VARCHAR, Title VARCHAR, ReportsTo INT, BirthDate DATETIME, HireDate DATETIME, Address VARCHAR, City VARCHAR, State VARCHAR, Country VARCHAR, PostalCode VARCHAR, Phone VARCHAR, Fax VARCHAR, Email VARCHAR) CREATE TABLE Playlist (PlaylistId INT, Name VARCHAR) CREATE TABLE Invoice (InvoiceId INT, CustomerId INT, InvoiceDate DATETIME, BillingAddress VARCHAR, BillingCity VARCHAR, BillingState VARCHAR, BillingCountry VARCHAR, BillingPostalCode VARCHAR, Total DECIMAL) CREATE TABLE Track (TrackId INT, Name VARCHAR, AlbumId INT, MediaTypeId INT, GenreId INT, Composer VARCHAR, Milliseconds INT, Bytes INT, UnitPrice DECIMAL) CREATE TABLE Album (AlbumId INT, Title VARCHAR, ArtistId INT) CREATE TABLE Customer (CustomerId INT, FirstName VARCHAR, LastName VARCHAR, Company VARCHAR, Address VARCHAR, City VARCHAR, State VARCHAR, Country VARCHAR, PostalCode VARCHAR, Phone VARCHAR, Fax VARCHAR, Email VARCHAR, SupportRepId INT) CREATE TABLE MediaType (MediaTypeId INT, Name VARCHAR) CREATE TABLE Artist (ArtistId INT, Name VARCHAR) CREATE TABLE Genre (GenreId INT, Name VARCHAR)
Return a histogram on what are the titles and ids for albums containing tracks with unit price greater than 1?, list by the x axis in ascending.
SELECT T1.Title, T1.AlbumId FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 ORDER BY T1.Title
SELECT "T1"."Title", "T1"."AlbumId" FROM "Album" AS "T1" JOIN "Track" AS "T2" ON "T1"."AlbumId" = "T2"."AlbumId" AND "T2"."UnitPrice" > 1 ORDER BY "T1"."Title" NULLS FIRST
0.166992
CREATE TABLE table_62055 ("Round" FLOAT, "Race" TEXT, "Circuit" TEXT, "Date" TEXT, "Event" TEXT, "Winning driver" TEXT)
What is the round for the Int. Adac-Preis Der Tourenwagen Von Sachsen-Anhalt?
SELECT "Round" FROM table_62055 WHERE "Race" = 'int. adac-preis der tourenwagen von sachsen-anhalt'
SELECT "Round" FROM "table_62055" WHERE "Race" = 'int. adac-preis der tourenwagen von sachsen-anhalt'
0.098633
CREATE TABLE Mailshot_Customers (mailshot_id INT, customer_id INT, outcome_code VARCHAR, mailshot_customer_date DATETIME) CREATE TABLE Premises (premise_id INT, premises_type VARCHAR, premise_details VARCHAR) CREATE TABLE Mailshot_Campaigns (mailshot_id INT, product_category VARCHAR, mailshot_name VARCHAR, mailshot_start_date DATETIME, mailshot_end_date DATETIME) CREATE TABLE Customer_Orders (order_id INT, customer_id INT, order_status_code VARCHAR, shipping_method_code VARCHAR, order_placed_datetime DATETIME, order_delivered_datetime DATETIME, order_shipping_charges VARCHAR) CREATE TABLE Order_Items (item_id INT, order_item_status_code VARCHAR, order_id INT, product_id INT, item_status_code VARCHAR, item_delivered_datetime DATETIME, item_order_quantity VARCHAR) CREATE TABLE Customer_Addresses (customer_id INT, premise_id INT, date_address_from DATETIME, address_type_code VARCHAR, date_address_to DATETIME) CREATE TABLE Products (product_id INT, product_category VARCHAR, product_name VARCHAR) CREATE TABLE Customers (customer_id INT, payment_method VARCHAR, customer_name VARCHAR, customer_phone VARCHAR, customer_email VARCHAR, customer_address VARCHAR, customer_login VARCHAR, customer_password VARCHAR)
Show each premise type and the number of premises in that type. Show a pie chart.
SELECT premises_type, COUNT(*) FROM Premises GROUP BY premises_type
SELECT "premises_type", COUNT(*) FROM "Premises" GROUP BY "premises_type"
0.071289
CREATE TABLE table_44481 ("Outcome" TEXT, "Date" TEXT, "Tournament" TEXT, "Surface" TEXT, "Opponent" TEXT, "Score" TEXT)
What is the tournament with greg rusedski as the opponent?
SELECT "Tournament" FROM table_44481 WHERE "Opponent" = 'greg rusedski'
SELECT "Tournament" FROM "table_44481" WHERE "Opponent" = 'greg rusedski'
0.071289
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
what are the four most frequently performed microbiology tests for patients that have received insulin previously during the same month until 2104?
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'insulin' AND STRFTIME('%y', treatment.treatmenttime) <= '2104') AS t1 JOIN (SELECT patient.uniquepid, microlab.culturesite, microlab.culturetakentime FROM microlab JOIN patient ON microlab.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', microlab.culturetakentime) <= '2104') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.culturetakentime AND DATETIME(t1.treatmenttime, 'start of month') = DATETIME(t2.culturetakentime, 'start of month') GROUP BY t2.culturesite) AS t3 WHERE t3.c1 <= 4
WITH "t2" AS (SELECT "patient"."uniquepid", "microlab"."culturesite", "microlab"."culturetakentime" FROM "microlab" JOIN "patient" ON "microlab"."patientunitstayid" = "patient"."patientunitstayid" WHERE STRFTIME('%y', "microlab"."culturetakentime") <= '2104'), "t3" AS (SELECT "t2"."culturesite", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" JOIN "t2" AS "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND "t2"."culturetakentime" > "treatment"."treatmenttime" AND DATETIME("t2"."culturetakentime", 'start of month') = DATETIME("treatment"."treatmenttime", 'start of month') WHERE "treatment"."treatmentname" = 'insulin' AND STRFTIME('%y', "treatment"."treatmenttime") <= '2104' GROUP BY "t2"."culturesite") SELECT "t3"."culturesite" FROM "t3" AS "t3" WHERE "t3"."c1" <= 4
0.868164
CREATE TABLE table_31363 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
Who is every high rebound when the team is Mount St. Mary's?
SELECT "High rebounds" FROM table_31363 WHERE "Team" = 'Mount St. Mary''s'
SELECT "High rebounds" FROM "table_31363" WHERE "Team" = 'Mount St. Mary\'s'
0.074219
CREATE TABLE table_78551 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What was Hawthorn's score as the home team?
SELECT "Home team score" FROM table_78551 WHERE "Home team" = 'hawthorn'
SELECT "Home team score" FROM "table_78551" WHERE "Home team" = 'hawthorn'
0.072266
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 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 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 age is less than 30 and diagnoses long title is pure hyperglyceridemia?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "30" AND diagnoses.long_title = "Pure hyperglyceridemia"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Pure hyperglyceridemia" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "30" > "demographic"."age"
0.219727
CREATE TABLE table_name_32 (west VARCHAR, east VARCHAR)
Who was in the West when ESV Gebensbach was in the East?
SELECT west FROM table_name_32 WHERE east = "esv gebensbach"
SELECT "west" FROM "table_name_32" WHERE "east" = "esv gebensbach"
0.064453
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE 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 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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) 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_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime 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 diagnoses_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)
how much does patient 26469 last weigh during their first hospital encounter?
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26469 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') ORDER BY chartevents.charttime DESC LIMIT 1
WITH "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'admit wt' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT "chartevents"."valuenum" FROM "chartevents" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE "chartevents"."icustay_id" IN (SELECT "icustays"."icustay_id" FROM "icustays" WHERE "icustays"."hadm_id" IN (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 26469 AND NOT "admissions"."dischtime" IS NULL ORDER BY "admissions"."admittime" NULLS FIRST LIMIT 1)) AND NOT "_u_2"."" IS NULL ORDER BY "chartevents"."charttime" DESC NULLS LAST LIMIT 1
0.637695
CREATE TABLE table_7482 ("Year" FLOAT, "Events played" FLOAT, "Cuts made" FLOAT, "Wins" FLOAT, "2nds" FLOAT, "Top 10s" FLOAT, "Best finish" TEXT, "Earnings ( $ ) " FLOAT, "Rank" TEXT, "Scoring average" FLOAT, "Scoring rank" TEXT)
What is the Scoring rank when there are less than 21 events played with a rank of n/a in years less than 2011?
SELECT "Scoring rank" FROM table_7482 WHERE "Events played" < '21' AND "Rank" = 'n/a' AND "Year" < '2011'
SELECT "Scoring rank" FROM "table_7482" WHERE "Events played" < '21' AND "Rank" = 'n/a' AND "Year" < '2011'
0.104492
CREATE TABLE Apartment_Buildings (building_id INT, building_short_name CHAR, building_full_name VARCHAR, building_description VARCHAR, building_address VARCHAR, building_manager VARCHAR, building_phone VARCHAR) CREATE TABLE Apartment_Bookings (apt_booking_id INT, apt_id INT, guest_id INT, booking_status_code CHAR, booking_start_date DATETIME, booking_end_date DATETIME) CREATE TABLE Apartments (apt_id INT, building_id INT, apt_type_code CHAR, apt_number CHAR, bathroom_count INT, bedroom_count INT, room_count CHAR) CREATE TABLE View_Unit_Status (apt_id INT, apt_booking_id INT, status_date DATETIME, available_yn BIT) CREATE TABLE Apartment_Facilities (apt_id INT, facility_code CHAR) CREATE TABLE Guests (guest_id INT, gender_code CHAR, guest_first_name VARCHAR, guest_last_name VARCHAR, date_of_birth DATETIME)
How many bookings for each apartment number? Plot a bar chart, display x-axis in descending order.
SELECT apt_number, COUNT(apt_number) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id GROUP BY apt_number ORDER BY apt_number DESC
SELECT "apt_number", COUNT("apt_number") FROM "Apartment_Bookings" AS "T1" JOIN "Apartments" AS "T2" ON "T1"."apt_id" = "T2"."apt_id" GROUP BY "apt_number" ORDER BY "apt_number" DESC NULLS LAST
0.188477
CREATE TABLE table_name_18 (year_in_novel VARCHAR, published_as_serial VARCHAR)
Which year in novel has a Published as serial of november 1934-april 1935, blue book?
SELECT year_in_novel FROM table_name_18 WHERE published_as_serial = "november 1934-april 1935, blue book"
SELECT "year_in_novel" FROM "table_name_18" WHERE "november 1934-april 1935, blue book" = "published_as_serial"
0.108398
CREATE TABLE grapes (ID INT, Grape TEXT, Color TEXT) CREATE TABLE appellations (No INT, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT) 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)
What is the number of counties for all appellations?, and order Y-axis in ascending order.
SELECT County, COUNT(County) FROM appellations GROUP BY County ORDER BY COUNT(County)
SELECT "County", COUNT("County") FROM "appellations" GROUP BY "County" ORDER BY COUNT("County") NULLS FIRST
0.104492
CREATE TABLE table_name_19 (gender VARCHAR, university_students_and_adults__18yrs VARCHAR, _ VARCHAR)
Which gender is associated with University students and adults of 25mm?
SELECT gender FROM table_name_19 WHERE university_students_and_adults__18yrs + _ = "25mm"
SELECT "gender" FROM "table_name_19" WHERE "25mm" = "university_students_and_adults__18yrs" + "_"
0.094727
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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 procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is insurance and drug code of subject id 24425?
SELECT demographic.insurance, prescriptions.formulary_drug_cd FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "24425"
SELECT "demographic"."insurance", "prescriptions"."formulary_drug_cd" FROM "demographic" JOIN "prescriptions" ON "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "24425" = "demographic"."subject_id"
0.202148
CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT) CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT) 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)
Show me about the distribution of name and meter_100 in a bar chart, rank y axis in desc order please.
SELECT name, meter_100 FROM swimmer ORDER BY meter_100 DESC
SELECT "name", "meter_100" FROM "swimmer" ORDER BY "meter_100" DESC NULLS LAST
0.076172
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) 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)
Get the list of white-russian patients with a neb route of drug administration.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.route = "NEB"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "NEB" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "WHITE - RUSSIAN" = "demographic"."ethnicity"
0.226563
CREATE TABLE table_name_88 (place VARCHAR, event VARCHAR)
What is the Place of the half marathon Event?
SELECT place FROM table_name_88 WHERE event = "half marathon"
SELECT "place" FROM "table_name_88" WHERE "event" = "half marathon"
0.06543
CREATE TABLE table_64411 ("Opposing Team" TEXT, "Against" FLOAT, "Date" TEXT, "Venue" TEXT, "Round" TEXT)
What was the date of the game against Oxford United?
SELECT "Date" FROM table_64411 WHERE "Opposing Team" = 'oxford united'
SELECT "Date" FROM "table_64411" WHERE "Opposing Team" = 'oxford united'
0.070313
CREATE TABLE table_43045 ("Volume" TEXT, "Series" TEXT, "Title" TEXT, "Cover" TEXT, "Published" TEXT, "ISBN" TEXT)
What cover has a published date of May 27, 2009 (hc) May 20, 2009 (tpb)?
SELECT "Cover" FROM table_43045 WHERE "Published" = 'may 27, 2009 (hc) may 20, 2009 (tpb)'
SELECT "Cover" FROM "table_43045" WHERE "Published" = 'may 27, 2009 (hc) may 20, 2009 (tpb)'
0.089844
CREATE TABLE table_20006 ("Year" FLOAT, "Dates" TEXT, "Champion" TEXT, "Country" TEXT, "Score" TEXT, "Tournament location" TEXT, "Purse ( $ ) " FLOAT, "Winners share ( $ ) " FLOAT)
How many prizes were available when Jenny Shin became the champion?
SELECT COUNT("Purse ($)") FROM table_20006 WHERE "Champion" = 'Jenny Shin'
SELECT COUNT("Purse ($)") FROM "table_20006" WHERE "Champion" = 'Jenny Shin'
0.074219
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 ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name 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 FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostTags (PostId DECIMAL, TagId 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) 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 PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId 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 ReviewTaskTypes (Id DECIMAL, Name TEXT, Description 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 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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
Wikitravel mentions (for offline postprocessing).
SELECT p.Id, p.ParentId, p.PostTypeId, p.Body, t.TagName FROM Posts AS p LEFT JOIN Tags AS t ON p.Id = t.WikiPostId WHERE p.Body LIKE '%http://wikitravel.org/%'
SELECT "p"."Id", "p"."ParentId", "p"."PostTypeId", "p"."Body", "t"."TagName" FROM "Posts" AS "p" LEFT JOIN "Tags" AS "t" ON "p"."Id" = "t"."WikiPostId" WHERE "p"."Body" LIKE '%http://wikitravel.org/%'
0.195313
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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 prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_icd_diagnoses (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 inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
what are the five most commonly given diagnoses for patients who previously received packed cell transfusion during the same month in 2103?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'packed cell transfusion') AND STRFTIME('%y', procedures_icd.charttime) = '2103') AS t1 JOIN (SELECT admissions.subject_id, diagnoses_icd.icd9_code, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE STRFTIME('%y', diagnoses_icd.charttime) = '2103') AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND DATETIME(t1.charttime, 'start of month') = DATETIME(t2.charttime, 'start of month') GROUP BY t2.icd9_code) AS t3 WHERE t3.c1 <= 5)
WITH "t2" AS (SELECT "admissions"."subject_id", "diagnoses_icd"."icd9_code", "diagnoses_icd"."charttime" FROM "diagnoses_icd" JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" WHERE STRFTIME('%y', "diagnoses_icd"."charttime") = '2103'), "t3" AS (SELECT "t2"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'packed cell transfusion' JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id" JOIN "t2" AS "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND "procedures_icd"."charttime" < "t2"."charttime" AND DATETIME("procedures_icd"."charttime", 'start of month') = DATETIME("t2"."charttime", 'start of month') WHERE STRFTIME('%y', "procedures_icd"."charttime") = '2103' GROUP BY "t2"."icd9_code"), "_u_1" AS (SELECT "t3"."icd9_code" FROM "t3" AS "t3" WHERE "t3"."c1" <= 5 GROUP BY "icd9_code") SELECT "d_icd_diagnoses"."short_title" FROM "d_icd_diagnoses" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "d_icd_diagnoses"."icd9_code" WHERE NOT "_u_1"."" IS NULL
1.148438
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) 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)
what is primary disease and diagnoses icd9 code of subject id 990?
SELECT demographic.diagnosis, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "990"
SELECT "demographic"."diagnosis", "diagnoses"."icd9_code" FROM "demographic" JOIN "diagnoses" ON "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "990" = "demographic"."subject_id"
0.180664
CREATE TABLE table_27969432_4 (us_viewers__in_millions_ VARCHAR, no_in_season VARCHAR)
How many viewers in millions were there for episode 4 of this season?
SELECT COUNT(us_viewers__in_millions_) FROM table_27969432_4 WHERE no_in_season = 4
SELECT COUNT("us_viewers__in_millions_") FROM "table_27969432_4" WHERE "no_in_season" = 4
0.086914
CREATE TABLE table_204_902 (id DECIMAL, "rank" DECIMAL, "name" TEXT, "nationality" TEXT, "time" TEXT, "notes" TEXT)
who was the top ranked competitor in this race ?
SELECT "name" FROM table_204_902 WHERE "rank" = 1
SELECT "name" FROM "table_204_902" WHERE "rank" = 1
0.049805
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime 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 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) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE 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 intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
patient 030-34260 has received a diagnosis in their current hospital encounter?
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-34260' AND patient.hospitaldischargetime IS NULL))
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '030-34260' 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 "diagnosis" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "diagnosis"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL
0.529297
CREATE TABLE pitching_postseason (player_id TEXT, year DECIMAL, round TEXT, team_id TEXT, league_id TEXT, w DECIMAL, l DECIMAL, g DECIMAL, gs DECIMAL, cg DECIMAL, sho DECIMAL, sv DECIMAL, ipouts DECIMAL, h DECIMAL, er DECIMAL, hr DECIMAL, bb DECIMAL, so DECIMAL, baopp TEXT, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk DECIMAL, bfp DECIMAL, gf DECIMAL, r DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE home_game (year DECIMAL, league_id TEXT, team_id TEXT, park_id TEXT, span_first TEXT, span_last TEXT, games DECIMAL, openings DECIMAL, attendance DECIMAL) CREATE TABLE batting_postseason (year DECIMAL, round TEXT, player_id TEXT, team_id TEXT, league_id TEXT, g DECIMAL, 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 player_award (player_id TEXT, award_id TEXT, year DECIMAL, league_id TEXT, tie TEXT, notes TEXT) CREATE TABLE team_franchise (franchise_id TEXT, franchise_name TEXT, active TEXT, na_assoc 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 manager_half (player_id TEXT, year DECIMAL, team_id TEXT, league_id TEXT, inseason DECIMAL, half DECIMAL, g DECIMAL, w DECIMAL, l DECIMAL, rank DECIMAL) CREATE TABLE college (college_id TEXT, name_full TEXT, city TEXT, state TEXT, country TEXT) CREATE TABLE pitching (player_id TEXT, year DECIMAL, stint DECIMAL, team_id TEXT, league_id TEXT, w DECIMAL, l DECIMAL, g DECIMAL, gs DECIMAL, cg DECIMAL, sho DECIMAL, sv DECIMAL, ipouts DECIMAL, h DECIMAL, er DECIMAL, hr DECIMAL, bb DECIMAL, so DECIMAL, baopp DECIMAL, era DECIMAL, ibb DECIMAL, wp DECIMAL, hbp DECIMAL, bk DECIMAL, bfp DECIMAL, gf DECIMAL, r DECIMAL, sh DECIMAL, sf DECIMAL, g_idp DECIMAL) CREATE TABLE manager_award_vote (award_id TEXT, year DECIMAL, league_id TEXT, player_id TEXT, points_won DECIMAL, points_max DECIMAL, votes_first DECIMAL) CREATE TABLE fielding_postseason (player_id TEXT, year DECIMAL, team_id TEXT, league_id TEXT, round TEXT, pos TEXT, g DECIMAL, gs DECIMAL, inn_outs DECIMAL, po DECIMAL, a DECIMAL, e DECIMAL, dp DECIMAL, tp DECIMAL, pb DECIMAL, sb DECIMAL, cs DECIMAL) CREATE TABLE postseason (year DECIMAL, round TEXT, team_id_winner TEXT, league_id_winner TEXT, team_id_loser TEXT, league_id_loser TEXT, wins DECIMAL, losses DECIMAL, ties DECIMAL) CREATE TABLE player_award_vote (award_id TEXT, year DECIMAL, league_id TEXT, player_id TEXT, points_won DECIMAL, points_max DECIMAL, votes_first DECIMAL) CREATE TABLE batting (player_id TEXT, year DECIMAL, stint DECIMAL, team_id TEXT, league_id TEXT, g DECIMAL, 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 team_half (year DECIMAL, league_id TEXT, team_id TEXT, half DECIMAL, div_id TEXT, div_win TEXT, rank DECIMAL, g DECIMAL, w DECIMAL, l DECIMAL) CREATE TABLE team (year DECIMAL, league_id TEXT, team_id TEXT, franchise_id TEXT, div_id TEXT, rank DECIMAL, g DECIMAL, ghome DECIMAL, w DECIMAL, l DECIMAL, div_win TEXT, wc_win TEXT, lg_win TEXT, ws_win TEXT, r DECIMAL, ab DECIMAL, h DECIMAL, double DECIMAL, triple DECIMAL, hr DECIMAL, bb DECIMAL, so DECIMAL, sb DECIMAL, cs DECIMAL, hbp DECIMAL, sf DECIMAL, ra DECIMAL, er DECIMAL, era DECIMAL, cg DECIMAL, sho DECIMAL, sv DECIMAL, ipouts DECIMAL, ha DECIMAL, hra DECIMAL, bba DECIMAL, soa DECIMAL, e DECIMAL, dp DECIMAL, fp DECIMAL, name TEXT, park TEXT, attendance DECIMAL, bpf DECIMAL, ppf DECIMAL, team_id_br TEXT, team_id_lahman45 TEXT, team_id_retro TEXT) CREATE TABLE fielding (player_id TEXT, year DECIMAL, stint DECIMAL, team_id TEXT, league_id TEXT, pos TEXT, g DECIMAL, 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 manager_award (player_id TEXT, award_id TEXT, year DECIMAL, league_id TEXT, tie TEXT, notes DECIMAL) CREATE TABLE manager (player_id TEXT, year DECIMAL, team_id TEXT, league_id TEXT, inseason DECIMAL, g DECIMAL, w DECIMAL, l DECIMAL, rank DECIMAL, plyr_mgr TEXT) CREATE TABLE park (park_id TEXT, park_name TEXT, park_alias TEXT, city TEXT, state TEXT, country TEXT) CREATE TABLE fielding_outfield (player_id TEXT, year DECIMAL, stint DECIMAL, glf DECIMAL, gcf DECIMAL, grf DECIMAL) CREATE TABLE player_college (player_id TEXT, college_id TEXT, year DECIMAL) CREATE TABLE hall_of_fame (player_id TEXT, yearid DECIMAL, votedby TEXT, ballots DECIMAL, needed DECIMAL, votes DECIMAL, inducted TEXT, category TEXT, needed_note TEXT) CREATE TABLE all_star (player_id TEXT, year DECIMAL, game_num DECIMAL, game_id TEXT, team_id TEXT, league_id TEXT, gp DECIMAL, starting_pos DECIMAL) CREATE TABLE salary (year DECIMAL, team_id TEXT, league_id TEXT, player_id TEXT, salary DECIMAL) CREATE TABLE appearances (year DECIMAL, team_id TEXT, league_id TEXT, player_id TEXT, g_all DECIMAL, gs DECIMAL, g_batting DECIMAL, g_defense DECIMAL, g_p DECIMAL, g_c DECIMAL, g_1b DECIMAL, g_2b DECIMAL, g_3b DECIMAL, g_ss DECIMAL, g_lf DECIMAL, g_cf DECIMAL, g_rf DECIMAL, g_of DECIMAL, g_dh DECIMAL, g_ph DECIMAL, g_pr DECIMAL)
How many games were played in city Atlanta in 2000?
SELECT COUNT(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2000 AND T2.city = 'Atlanta'
SELECT COUNT(*) FROM "home_game" AS "T1" JOIN "park" AS "T2" ON "T1"."park_id" = "T2"."park_id" AND "T2"."city" = 'Atlanta' WHERE "T1"."year" = 2000
0.144531
CREATE TABLE table_name_33 (college VARCHAR, pick VARCHAR)
What college has pick 45
SELECT college FROM table_name_33 WHERE pick = 45
SELECT "college" FROM "table_name_33" WHERE "pick" = 45
0.053711
CREATE TABLE table_61176 ("Club" TEXT, "Nickname" TEXT, "Location" TEXT, "Home Ground" TEXT, "GFL Premierships" TEXT, "Years in GFL" TEXT)
What's the GFL Premiership when the home ground was Leopold Memorial Park?
SELECT "GFL Premierships" FROM table_61176 WHERE "Home Ground" = 'leopold memorial park'
SELECT "GFL Premierships" FROM "table_61176" WHERE "Home Ground" = 'leopold memorial park'
0.087891
CREATE TABLE ReviewTaskResultTypes (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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE FlagTypes (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 PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount 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 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 ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostTags (PostId DECIMAL, TagId 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 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 PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE 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 PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
attempting to measure votiness over time.
SELECT CAST(FLOOR(CAST(p.CreationDate AS FLOAT) / 7.0) * 7 AS DATETIME) AS postweek, SUM(CASE WHEN v.VoteTypeId = 2 THEN 1 ELSE 0 END) * 1.0 / COUNT(DISTINCT PostId) AS upvotes_per_question FROM Votes AS v INNER JOIN Posts AS p ON p.Id = v.PostId AND FLOOR(CAST(v.CreationDate AS FLOAT) / 7.0) = FLOOR(CAST(p.CreationDate AS FLOAT) / 7.0) WHERE p.PostTypeId = 1 GROUP BY CAST(FLOOR(CAST(p.CreationDate AS FLOAT) / 7.0) * 7 AS DATETIME) ORDER BY postweek
SELECT CAST(FLOOR(CAST("p"."CreationDate" AS FLOAT) / NULLIF(7.0, 0)) * 7 AS DATETIME) AS "postweek", SUM(CASE WHEN "v"."VoteTypeId" = 2 THEN 1 ELSE 0 END) * 1.0 / NULLIF(COUNT(DISTINCT "PostId"), 0) AS "upvotes_per_question" FROM "Votes" AS "v" JOIN "Posts" AS "p" ON "p"."Id" = "v"."PostId" AND "p"."PostTypeId" = 1 AND FLOOR(CAST("p"."CreationDate" AS FLOAT) / NULLIF(7.0, 0)) = FLOOR(CAST("v"."CreationDate" AS FLOAT) / NULLIF(7.0, 0)) GROUP BY CAST(FLOOR(CAST("p"."CreationDate" AS FLOAT) / NULLIF(7.0, 0)) * 7 AS DATETIME) ORDER BY "postweek" NULLS FIRST
0.546875
CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT) CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT) CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year 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 meter_700 and meter_100 , and visualize them by a bar chart.
SELECT meter_700, meter_100 FROM swimmer
SELECT "meter_700", "meter_100" FROM "swimmer"
0.044922
CREATE TABLE table_22791 ("Year" FLOAT, "Host" TEXT, "1st Place" TEXT, "2nd Place" TEXT, "3rd Place" TEXT, "4th Place" TEXT, "5th Place" TEXT)
What is the 1st place when Pennsylvania finished 2nd place?
SELECT "1st Place" FROM table_22791 WHERE "2nd Place" = 'Pennsylvania'
SELECT "1st Place" FROM "table_22791" WHERE "2nd Place" = 'Pennsylvania'
0.070313
CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category 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 offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year 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 program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req 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 area (course_id INT, area VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname 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 gsi (course_offering_id INT, student_id INT) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR)
Next Winter , which professor is teaching Other classes ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE program_course.category LIKE '%Other%' AND semester.semester = 'Winter' AND semester.year = 2017
SELECT DISTINCT "instructor"."name" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "offering_instructor" ON "course_offering"."offering_id" = "offering_instructor"."offering_id" JOIN "program_course" ON "course_offering"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%Other%' JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'Winter' AND "semester"."year" = 2017 JOIN "instructor" ON "instructor"."instructor_id" = "offering_instructor"."instructor_id"
0.578125
CREATE TABLE course (course_id TEXT, title TEXT, dept_name TEXT, credits DECIMAL) CREATE TABLE prereq (course_id TEXT, prereq_id TEXT) CREATE TABLE department (dept_name TEXT, building TEXT, budget DECIMAL) CREATE TABLE takes (id TEXT, course_id TEXT, sec_id TEXT, semester TEXT, year DECIMAL, grade TEXT) CREATE TABLE classroom (building TEXT, room_number TEXT, capacity DECIMAL) CREATE TABLE student (id TEXT, name TEXT, dept_name TEXT, tot_cred DECIMAL) CREATE TABLE teaches (id TEXT, course_id TEXT, sec_id TEXT, semester TEXT, year DECIMAL) CREATE TABLE advisor (s_id TEXT, i_id TEXT) CREATE TABLE time_slot (time_slot_id TEXT, day TEXT, start_hr DECIMAL, start_min DECIMAL, end_hr DECIMAL, end_min DECIMAL) CREATE TABLE instructor (id TEXT, name TEXT, dept_name TEXT, salary DECIMAL) CREATE TABLE section (course_id TEXT, sec_id TEXT, semester TEXT, year DECIMAL, building TEXT, room_number TEXT, time_slot_id TEXT)
How many courses are provided in each semester and year?
SELECT COUNT(*), semester, year FROM section GROUP BY semester, year
SELECT COUNT(*), "semester", "year" FROM "section" GROUP BY "semester", "year"
0.076172
CREATE TABLE table_35036 ("Game" FLOAT, "December" FLOAT, "Opponent" TEXT, "Score" TEXT, "Record" TEXT, "Points" FLOAT)
Which Game is the highest one that has a Score of 3 2?
SELECT MAX("Game") FROM table_35036 WHERE "Score" = '3–2'
SELECT MAX("Game") FROM "table_35036" WHERE "Score" = '3–2'
0.057617
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId 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 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 ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE FlagTypes (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 PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId 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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate 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 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 ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (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 CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
High-reputation users who no longer visit the site.
SELECT Id AS "user_link", LastAccessDate FROM Users WHERE Reputation >= '##MinReputation##' ORDER BY LastAccessDate
SELECT "Id" AS "user_link", "LastAccessDate" FROM "Users" WHERE "Reputation" >= '##MinReputation##' ORDER BY "LastAccessDate" NULLS FIRST
0.133789
CREATE TABLE table_23486853_6 (record VARCHAR, opponent VARCHAR)
What is the record when the opposing team was the Pittsburgh Penguins?
SELECT record FROM table_23486853_6 WHERE opponent = "Pittsburgh Penguins"
SELECT "record" FROM "table_23486853_6" WHERE "Pittsburgh Penguins" = "opponent"
0.078125
CREATE TABLE table_204_939 (id DECIMAL, "year" DECIMAL, "chassis" TEXT, "engine" TEXT, "start" TEXT, "finish" TEXT)
what chassis is previous to year 1989 ?
SELECT "chassis" FROM table_204_939 WHERE "year" = 1989 - 1
SELECT "chassis" FROM "table_204_939" WHERE "year" = 1988
0.055664
CREATE TABLE product_characteristics (product_id DECIMAL, characteristic_id DECIMAL, product_characteristic_value TEXT) CREATE TABLE products (product_id DECIMAL, color_code TEXT, product_category_code TEXT, product_name TEXT, typical_buying_price TEXT, typical_selling_price TEXT, product_description TEXT, other_product_details TEXT) CREATE TABLE ref_colors (color_code TEXT, color_description TEXT) CREATE TABLE ref_characteristic_types (characteristic_type_code TEXT, characteristic_type_description TEXT) CREATE TABLE ref_product_categories (product_category_code TEXT, product_category_description TEXT, unit_of_measure TEXT) CREATE TABLE characteristics (characteristic_id DECIMAL, characteristic_type_code TEXT, characteristic_data_type TEXT, characteristic_name TEXT, other_characteristic_details TEXT)
Find the product category description of the product category with code 'Spices'.
SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices"
SELECT "product_category_description" FROM "ref_product_categories" WHERE "Spices" = "product_category_code"
0.105469
CREATE TABLE table_20630462_1 (also_currently_known_as VARCHAR, tournament VARCHAR)
What is the current tournament name for the event in Tampa?
SELECT also_currently_known_as FROM table_20630462_1 WHERE tournament = "Tampa"
SELECT "also_currently_known_as" FROM "table_20630462_1" WHERE "Tampa" = "tournament"
0.083008
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, find founder and the average of price , and group by attribute founder, and visualize them by a bar chart, and could you rank by the Founder in asc?
SELECT Founder, AVG(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder
SELECT "Founder", AVG("Price") FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Founder" ORDER BY "Founder" NULLS FIRST
0.166016
CREATE TABLE table_63399 ("Tournament" TEXT, "2007" TEXT, "2010" TEXT, "2011" TEXT, "2012" TEXT, "2013" TEXT)
What is the 2007 result when the 2010 result was 2r, at the US Open?
SELECT "2007" FROM table_63399 WHERE "2010" = '2r' AND "Tournament" = 'us open'
SELECT "2007" FROM "table_63399" WHERE "2010" = '2r' AND "Tournament" = 'us open'
0.079102
CREATE TABLE table_name_93 (home_team VARCHAR)
What is richmond's score as the home team?
SELECT home_team AS score FROM table_name_93 WHERE home_team = "richmond"
SELECT "home_team" AS "score" FROM "table_name_93" WHERE "home_team" = "richmond"
0.079102
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 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 gender is f and primary disease is rash?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "RASH"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "F" = "demographic"."gender" AND "RASH" = "demographic"."diagnosis"
0.138672
CREATE TABLE table_35632 ("Date" TEXT, "City" TEXT, "Opponent" TEXT, "Results\\u00b9" TEXT, "Type of game" TEXT)
On November 22, what were the results of the friendly type game?
SELECT "Results\u00b9" FROM table_35632 WHERE "Type of game" = 'friendly' AND "Date" = 'november 22'
SELECT "Results\u00b9" FROM "table_35632" WHERE "Date" = 'november 22' AND "Type of game" = 'friendly'
0.099609
CREATE TABLE table_204_445 (id DECIMAL, "year" DECIMAL, "competition" TEXT, "venue" TEXT, "position" TEXT, "notes" TEXT)
what is peter widen 's top most position ever in world indoor championships ?
SELECT MIN("position") FROM table_204_445 WHERE "competition" = 'world indoor championships'
SELECT MIN("position") FROM "table_204_445" WHERE "competition" = 'world indoor championships'
0.091797
CREATE TABLE table_23145 ("County" TEXT, "Starky #" FLOAT, "Starky %" TEXT, "Hancock #" FLOAT, "Hancock %" TEXT, "McCain #" FLOAT, "McCain %" TEXT, "Total" FLOAT)
where did hancock get 3.09%
SELECT "County" FROM table_23145 WHERE "Hancock %" = '3.09%'
SELECT "County" FROM "table_23145" WHERE "Hancock %" = '3.09%'
0.060547
CREATE TABLE table_29390 ("Province" TEXT, "Registered voters" FLOAT, "People voted" FLOAT, "Valid votes" FLOAT, "Invalid votes" FLOAT, "Yes" FLOAT, "Yes ( % ) " TEXT, "No" FLOAT, "No ( % ) " TEXT, "Turnout ( % ) " TEXT)
What province had a turnout of 54.09%?
SELECT "Province" FROM table_29390 WHERE "Turnout (%)" = '54.09'
SELECT "Province" FROM "table_29390" WHERE "Turnout (%)" = '54.09'
0.064453
CREATE TABLE table_8851 ("Pick" FLOAT, "Player" TEXT, "Position" TEXT, "Nationality" TEXT, "Former Team" TEXT)
Which Former Team has a Pick larger than 20?
SELECT "Former Team" FROM table_8851 WHERE "Pick" > '20'
SELECT "Former Team" FROM "table_8851" WHERE "Pick" > '20'
0.056641
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)
how many patients aged below 74 years had the procedure icd9 code 14?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "74" AND procedures.icd9_code = "14"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "14" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "74" > "demographic"."age"
0.202148
CREATE TABLE table_name_59 (total_rebounds INT, player VARCHAR)
What was Peter Woolfolk's Total Rebound average?
SELECT SUM(total_rebounds) FROM table_name_59 WHERE player = "peter woolfolk"
SELECT SUM("total_rebounds") FROM "table_name_59" WHERE "peter woolfolk" = "player"
0.081055
CREATE TABLE table_name_84 (total INT, gold VARCHAR, bronze VARCHAR)
What average Total has a Gold award of 13 and a Bronze award less than 13?
SELECT AVG(total) FROM table_name_84 WHERE gold = 13 AND bronze < 13
SELECT AVG("total") FROM "table_name_84" WHERE "bronze" < 13 AND "gold" = 13
0.074219
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 jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname 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 area (course_id INT, area VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR)
For the last time she taught 497 , was an exam set by Prof. David Schoem ?
SELECT DISTINCT course_offering.has_final_exam FROM course_offering INNER JOIN course ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE course_offering.semester = (SELECT MAX(SEMESTERalias0.semester_id) FROM semester AS SEMESTERalias0 INNER JOIN course_offering AS COURSE_OFFERINGalias1 ON SEMESTERalias0.semester_id = COURSE_OFFERINGalias1.semester INNER JOIN course AS COURSEalias1 ON COURSEalias1.course_id = COURSE_OFFERINGalias1.course_id INNER JOIN offering_instructor AS OFFERING_INSTRUCTORalias1 ON OFFERING_INSTRUCTORalias1.offering_id = COURSE_OFFERINGalias1.offering_id INNER JOIN instructor AS INSTRUCTORalias1 ON OFFERING_INSTRUCTORalias1.instructor_id = INSTRUCTORalias1.instructor_id WHERE COURSEalias1.department = 'EECS' AND COURSEalias1.number = 497 AND INSTRUCTORalias1.name LIKE '%David Schoem%' AND SEMESTERalias0.year < 2016) AND course.department = 'EECS' AND course.number = 497 AND instructor.name LIKE '%David Schoem%'
WITH "_u_0" AS (SELECT MAX("SEMESTERalias0"."semester_id") FROM "semester" AS "SEMESTERalias0" JOIN "course_offering" AS "COURSE_OFFERINGalias1" ON "COURSE_OFFERINGalias1"."semester" = "SEMESTERalias0"."semester_id" JOIN "course" AS "COURSEalias1" ON "COURSE_OFFERINGalias1"."course_id" = "COURSEalias1"."course_id" AND "COURSEalias1"."department" = 'EECS' AND "COURSEalias1"."number" = 497 JOIN "offering_instructor" AS "OFFERING_INSTRUCTORalias1" ON "COURSE_OFFERINGalias1"."offering_id" = "OFFERING_INSTRUCTORalias1"."offering_id" JOIN "instructor" AS "INSTRUCTORalias1" ON "INSTRUCTORalias1"."instructor_id" = "OFFERING_INSTRUCTORalias1"."instructor_id" AND "INSTRUCTORalias1"."name" LIKE '%David Schoem%' WHERE "SEMESTERalias0"."year" < 2016) SELECT DISTINCT "course_offering"."has_final_exam" FROM "course_offering" JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "course_offering"."semester" JOIN "course" ON "course"."course_id" = "course_offering"."course_id" AND "course"."department" = 'EECS' AND "course"."number" = 497 JOIN "offering_instructor" ON "course_offering"."offering_id" = "offering_instructor"."offering_id" JOIN "instructor" ON "instructor"."instructor_id" = "offering_instructor"."instructor_id" AND "instructor"."name" LIKE '%David Schoem%'
1.226563
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 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 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)
what is the number of patients whose insurance is self pay and procedure is other closed [endoscopic] biopsy of biliary duct or sphincter of oddi?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Self Pay" AND procedures.long_title = "Other closed [endoscopic] biopsy of biliary duct or sphincter of Oddi"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Other closed [endoscopic] biopsy of biliary duct or sphincter of Oddi" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "Self Pay" = "demographic"."insurance"
0.280273
CREATE TABLE table_63685 ("School" TEXT, "Location" TEXT, "Mascot" TEXT, "County" TEXT, "Year Joined" FLOAT, "Year Left" FLOAT, "Conference Joined" TEXT)
what is the school that left in 1966?
SELECT "School" FROM table_63685 WHERE "Year Left" = '1966'
SELECT "School" FROM "table_63685" WHERE "Year Left" = '1966'
0.05957
CREATE TABLE table_name_58 (nickname VARCHAR, weight_at_birth VARCHAR)
What is the nickname of the baby with the birth weight of 730g (23.5 oz.)?
SELECT nickname FROM table_name_58 WHERE weight_at_birth = "730g (23.5 oz.)"
SELECT "nickname" FROM "table_name_58" WHERE "730g (23.5 oz.)" = "weight_at_birth"
0.080078
CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction 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 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 gsi (course_offering_id INT, student_id INT) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req 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 semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR)
Do the Spring terms have the 500 -level classes , or Summer terms ?
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('SP', 'SU', 'SS') AND semester.semester_id = course_offering.semester AND semester.year = 2016
SELECT DISTINCT "course"."department", "course"."name", "course"."number", "semester"."semester" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" IN ('SP', 'SU', 'SS') AND "semester"."year" = 2016 WHERE "course"."department" = 'department0' AND "course"."number" <= 600 AND "course"."number" >= 500
0.432617
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 prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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)
Calculate the maximum age of english speaking patients who have pituitary bleed as the primary disease.
SELECT MAX(demographic.age) FROM demographic WHERE demographic.language = "ENGL" AND demographic.diagnosis = "PITUITARY BLEED"
SELECT MAX("demographic"."age") FROM "demographic" WHERE "ENGL" = "demographic"."language" AND "PITUITARY BLEED" = "demographic"."diagnosis"
0.136719
CREATE TABLE table_name_45 (venue VARCHAR, date VARCHAR)
What is Venue, when Date is '7 September'?
SELECT venue FROM table_name_45 WHERE date = "7 september"
SELECT "venue" FROM "table_name_45" WHERE "7 september" = "date"
0.0625
CREATE TABLE table_name_80 (total_goals VARCHAR, total_apps VARCHAR, league_goals VARCHAR)
How many total goals have 0 (3) as total apps, with league goals less than 0?
SELECT COUNT(total_goals) FROM table_name_80 WHERE total_apps = "0 (3)" AND league_goals < 0
SELECT COUNT("total_goals") FROM "table_name_80" WHERE "0 (3)" = "total_apps" AND "league_goals" < 0
0.097656
CREATE TABLE table_name_54 (team VARCHAR, driver VARCHAR, rounds VARCHAR, engine VARCHAR)
what is the team when the rounds is all engine is mercedes hwa and driver is sam abay?
SELECT team FROM table_name_54 WHERE rounds = "all" AND engine = "mercedes hwa" AND driver = "sam abay"
SELECT "team" FROM "table_name_54" WHERE "all" = "rounds" AND "driver" = "sam abay" AND "engine" = "mercedes hwa"
0.110352
CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT) CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT)
Just list the name and price of its most expensive product in a bar chart, and show in ascending by the Y.
SELECT T1.Name, MAX(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY MAX(T1.Price)
SELECT "T1"."Name", MAX("T1"."Price") FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T1"."Name" ORDER BY MAX("T1"."Price") NULLS FIRST
0.182617
CREATE TABLE table_47077 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" FLOAT)
What is the lowest attendance when the Atlanta Falcons were the opponent?
SELECT MIN("Week") FROM table_47077 WHERE "Opponent" = 'atlanta falcons'
SELECT MIN("Week") FROM "table_47077" WHERE "Opponent" = 'atlanta falcons'
0.072266
CREATE TABLE table_76323 ("Episode" TEXT, "First broadcast" TEXT, "Graeme's guest" TEXT, "Jeremy's guest" TEXT, "Votes ( % ) " TEXT)
What is Votes (%), when Episode is '1x03'?
SELECT "Votes (%)" FROM table_76323 WHERE "Episode" = '1x03'
SELECT "Votes (%)" FROM "table_76323" WHERE "Episode" = '1x03'
0.060547