schema
stringlengths
29
5.42k
question
stringlengths
0
752
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
8.94k
weight
float64
0
8.73
CREATE TABLE table_67147 ("Ship" CLOB, "Site" CLOB, "Guns" FLOAT, "Naval constructor" CLOB, "Superintendent" CLOB)
What is the site when the superintendent was John Barry?
SELECT "Site" FROM table_67147 WHERE "Superintendent" = 'john barry'
SELECT "Site" FROM "table_67147" WHERE "Superintendent" = 'john barry'
0.068359
CREATE TABLE table_26545 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" CLOB, "Directed by" CLOB, "Written by" CLOB, "Original air date" CLOB, "Production code" FLOAT)
What episode number in the series is 'dance to the music'?
SELECT MIN("No. in series") FROM table_26545 WHERE "Title" = 'Dance to the Music'
SELECT MIN("No. in series") FROM "table_26545" WHERE "Title" = 'Dance to the Music'
0.081055
CREATE TABLE table_name_29 (league_division VARCHAR2, club VARCHAR2)
What division is Sai Kung in?
SELECT league_division FROM table_name_29 WHERE club = "sai kung"
SELECT "league_division" FROM "table_name_29" WHERE "club" = "sai kung"
0.069336
CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2) CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER) CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER) CREATE TABLE employees (EMPLOYEE_ID NUMBER, FIRST_NAME VARCHAR2, LAST_NAME VARCHAR2, EMAIL VARCHAR2, PHONE_NUMBER VARCHAR2, HIRE_DATE DATE, JOB_ID VARCHAR2, SALARY NUMBER, COMMISSION_PCT NUMBER, MANAGER_ID NUMBER, DEPARTMENT_ID NUMBER)
For all employees in the same department as Clara excluding Clara, bin their hire date into the month interval, and count how many employees in each month for a bar chart, rank from low to high by the Y.
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE DEPARTMENT_ID = (SELECT DEPARTMENT_ID FROM employees WHERE FIRST_NAME = "Clara") AND FIRST_NAME <> "Clara" ORDER BY COUNT(HIRE_DATE)
SELECT "HIRE_DATE", COUNT("HIRE_DATE") FROM "employees" WHERE "Clara" <> "FIRST_NAME" AND "DEPARTMENT_ID" = (SELECT "DEPARTMENT_ID" FROM "employees" WHERE "Clara" = "FIRST_NAME") ORDER BY COUNT("HIRE_DATE")
0.201172
CREATE TABLE table_46422 ("Name" CLOB, "Country" CLOB, "Loan Club" CLOB, "Started" CLOB, "Ended" CLOB, "Start Source" CLOB, "End Source" CLOB)
when was the loan ended when the country is ghana?
SELECT "Ended" FROM table_46422 WHERE "Country" = 'ghana'
SELECT "Ended" FROM "table_46422" WHERE "Country" = 'ghana'
0.057617
CREATE TABLE table_name_88 (source VARCHAR2, knight VARCHAR2)
What source has a Knight of 2%?
SELECT source FROM table_name_88 WHERE knight = "2%"
SELECT "source" FROM "table_name_88" WHERE "2%" = "knight"
0.056641
CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER)
Top 10 question askers in Meta Stack Exchange.
SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS "row_number", OwnerUserId AS "user_link", COUNT(PostTypeId) AS "questions_count" FROM Posts WHERE NOT OwnerUserId IS NULL AND OwnerUserId != -1 AND PostTypeId = 1 GROUP BY OwnerUserId ORDER BY COUNT(PostTypeId) DESC LIMIT 10
WITH "_u_0" AS (SELECT NULL) SELECT ROW_NUMBER() OVER (ORDER BY MAX("_u_0"."NULL")) AS "row_number", "OwnerUserId" AS "user_link", COUNT("PostTypeId") AS "questions_count" FROM "Posts" CROSS JOIN "_u_0" "_u_0" WHERE "OwnerUserId" <> -1 AND "PostTypeId" = 1 AND NOT "OwnerUserId" IS NULL GROUP BY "OwnerUserId" ORDER BY COUNT("PostTypeId") DESC FETCH FIRST 10 ROWS ONLY
0.359375
CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2)
What ASIANLAN prerequisites are needed for CS majors ?
SELECT DISTINCT course.department, course.name, course.number FROM program_course INNER JOIN course ON program_course.course_id = course.course_id WHERE course.department = 'ASIANLAN'
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "program_course" JOIN "course" ON "course"."course_id" = "program_course"."course_id" AND "course"."department" = 'ASIANLAN'
0.198242
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
find out the birth date and status of death for patient dominga garvin.
SELECT demographic.dob, demographic.expire_flag FROM demographic WHERE demographic.name = "Dominga Garvin"
SELECT "demographic"."dob", "demographic"."expire_flag" FROM "demographic" WHERE "Dominga Garvin" = "demographic"."name"
0.117188
CREATE TABLE airport (airport_code VARCHAR2, airport_name CLOB, airport_location CLOB, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2, minimum_connect_time NUMBER) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE restriction (restriction_code CLOB, advance_purchase NUMBER, stopovers CLOB, saturday_stay_required CLOB, minimum_stay NUMBER, maximum_stay NUMBER, application CLOB, no_discounts CLOB) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE flight_stop (flight_id NUMBER, stop_number NUMBER, stop_days CLOB, stop_airport CLOB, arrival_time NUMBER, arrival_airline CLOB, arrival_flight_number NUMBER, departure_time NUMBER, departure_airline CLOB, departure_flight_number NUMBER, stop_time NUMBER) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE aircraft (aircraft_code VARCHAR2, aircraft_description VARCHAR2, manufacturer VARCHAR2, basic_type VARCHAR2, engines NUMBER, propulsion VARCHAR2, wide_body VARCHAR2, wing_span NUMBER, length NUMBER, weight NUMBER, capacity NUMBER, pay_load NUMBER, cruising_speed NUMBER, range_miles NUMBER, pressurized VARCHAR2) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB)
yes i live in WASHINGTON and i want to make a trip to SAN FRANCISCO which airlines may i use for this trip
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
SELECT DISTINCT "airline"."airline_code" FROM "airline" JOIN "flight" ON "airline"."airline_code" = "flight"."airline_code" JOIN "airport_service" "AIRPORT_SERVICE_0" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'WASHINGTON' JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SAN FRANCISCO'
0.5625
CREATE TABLE table_name_92 (season VARCHAR2, division_two VARCHAR2)
Which Season was the Division Two Fownhope Reserves champions?
SELECT season FROM table_name_92 WHERE division_two = "fownhope reserves"
SELECT "season" FROM "table_name_92" WHERE "division_two" = "fownhope reserves"
0.077148
CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2) CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER) CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) CREATE TABLE employees (EMPLOYEE_ID NUMBER, FIRST_NAME VARCHAR2, LAST_NAME VARCHAR2, EMAIL VARCHAR2, PHONE_NUMBER VARCHAR2, HIRE_DATE DATE, JOB_ID VARCHAR2, SALARY NUMBER, COMMISSION_PCT NUMBER, MANAGER_ID NUMBER, DEPARTMENT_ID NUMBER) CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER)
For those employees who did not have any job in the past, return a bar chart about the distribution of job_id and the average of manager_id , and group by attribute job_id, and I want to order by the bars from low to high.
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID
SELECT "JOB_ID", AVG("MANAGER_ID") FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history") GROUP BY "JOB_ID" ORDER BY "JOB_ID"
0.152344
CREATE TABLE table_6543 ("Year" FLOAT, "Men's singles" CLOB, "Women's singles" CLOB, "Men's doubles" CLOB, "Women's doubles" CLOB, "Mixed doubles" CLOB)
Name the total numbe rof years for gaby weissen mireille kosmala
SELECT COUNT("Year") FROM table_6543 WHERE "Women's doubles" = 'gaby weissen mireille kosmala'
SELECT COUNT("Year") FROM "table_6543" WHERE "Women's doubles" = 'gaby weissen mireille kosmala'
0.09375
CREATE TABLE table_44421 ("q > 1" FLOAT, "q > 1.05" FLOAT, "q > 1.1" FLOAT, "q > 1.2" FLOAT, "q > 1.3" FLOAT, "q > 1.4" FLOAT)
What is the mean q > 1 with a q > 1.2 less than 3,028, and a q > 1.4 of 51, and a q > 1.05 greater than 18,233?
SELECT AVG("q > 1") FROM table_44421 WHERE "q > 1.2" < '3,028' AND "q > 1.4" = '51' AND "q > 1.05" > '18,233'
SELECT AVG("q > 1") FROM "table_44421" WHERE "q > 1.05" > '18,233' AND "q > 1.2" < '3,028' AND "q > 1.4" = '51'
0.108398
CREATE TABLE table_name_56 (class VARCHAR2, date VARCHAR2)
what class has the date of 8/1954?
SELECT class FROM table_name_56 WHERE date = "8/1954"
SELECT "class" FROM "table_name_56" WHERE "8/1954" = "date"
0.057617
CREATE TABLE table_203_338 (id NUMBER, "#" NUMBER, "title" CLOB, "date" CLOB, "director" CLOB, "story" CLOB, "synopsis" CLOB, "notes" CLOB)
what is the last title listed in the table ?
SELECT "title" FROM table_203_338 ORDER BY id DESC LIMIT 1
SELECT "title" FROM "table_203_338" ORDER BY "id" DESC FETCH FIRST 1 ROWS ONLY
0.076172
CREATE TABLE table_203_382 (id NUMBER, "date" CLOB, "opponent" CLOB, "site" CLOB, "result" CLOB)
what are the total number of games played in october ?
SELECT COUNT(*) FROM table_203_382 WHERE "date" = 10
SELECT COUNT(*) FROM "table_203_382" WHERE "date" = 10
0.052734
CREATE TABLE table_name_66 (round VARCHAR2, college VARCHAR2, overall VARCHAR2)
In what Round with an Overall greater than 306 was the pick from the College of Virginia Tech?
SELECT COUNT(round) FROM table_name_66 WHERE college = "virginia tech" AND overall > 306
SELECT COUNT("round") FROM "table_name_66" WHERE "college" = "virginia tech" AND "overall" > 306
0.09375
CREATE TABLE table_203_569 (id NUMBER, "designation" CLOB, "classification" CLOB, "constellation" CLOB, "apparent magnitude" NUMBER)
what designation comes after the m65 designation ?
SELECT "designation" FROM table_203_569 WHERE id = (SELECT id FROM table_203_569 WHERE "designation" = 'm65') + 1
SELECT "designation" FROM "table_203_569" WHERE "id" = (SELECT "id" FROM "table_203_569" WHERE "designation" = 'm65') + 1
0.118164
CREATE TABLE table_40492 ("Rank" FLOAT, "City" CLOB, "Airport" CLOB, "Passengers" FLOAT, "Carriers" CLOB)
What was the airport with primary carrier of US Airways with a 2 ranking and more than 51,000 passengers?
SELECT "Airport" FROM table_40492 WHERE "Passengers" > '51,000' AND "Carriers" = 'us airways' AND "Rank" = '2'
SELECT "Airport" FROM "table_40492" WHERE "Carriers" = 'us airways' AND "Passengers" > '51,000' AND "Rank" = '2'
0.109375
CREATE TABLE table_name_27 (game NUMBER, time VARCHAR2, attendance VARCHAR2)
When was the last game that had a time of 2:46 and attendance of more than 57,533?
SELECT MAX(game) FROM table_name_27 WHERE time = "2:46" AND attendance > 57 OFFSET 533
SELECT MAX("game") FROM "table_name_27" WHERE "2:46" = "time" AND "attendance" > 57 OFFSET 533 ROWS
0.09668
CREATE TABLE Apartments (apt_id NUMBER, building_id NUMBER, apt_type_code CHAR, apt_number CHAR, bathroom_count NUMBER, bedroom_count NUMBER, room_count CHAR) CREATE TABLE Apartment_Bookings (apt_booking_id NUMBER, apt_id NUMBER, guest_id NUMBER, booking_status_code CHAR, booking_start_date DATETIME, booking_end_date DATETIME) CREATE TABLE Guests (guest_id NUMBER, gender_code CHAR, guest_first_name VARCHAR2, guest_last_name VARCHAR2, date_of_birth DATETIME) CREATE TABLE Apartment_Facilities (apt_id NUMBER, facility_code CHAR) CREATE TABLE Apartment_Buildings (building_id NUMBER, building_short_name CHAR, building_full_name VARCHAR2, building_description VARCHAR2, building_address VARCHAR2, building_manager VARCHAR2, building_phone VARCHAR2) CREATE TABLE View_Unit_Status (apt_id NUMBER, apt_booking_id NUMBER, status_date DATETIME, available_yn BIT)
How many bookings does each booking status have? List the booking status code and the number of corresponding bookings. Show 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 table_28673 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" CLOB, "Directed by" CLOB, "Written by" CLOB, "Original air date" CLOB, "Production code" CLOB, "U.S. viewers ( millions ) " CLOB)
what title was given to the episode with production code 6ajn08?
SELECT "Title" FROM table_28673 WHERE "Production code" = '6AJN08'
SELECT "Title" FROM "table_28673" WHERE "Production code" = '6AJN08'
0.066406
CREATE TABLE table_name_72 (nationality VARCHAR2, position VARCHAR2)
What is the nationality of the center?
SELECT nationality FROM table_name_72 WHERE position = "center"
SELECT "nationality" FROM "table_name_72" WHERE "center" = "position"
0.067383
CREATE TABLE debate (Debate_ID NUMBER, Date CLOB, Venue CLOB, Num_of_Audience NUMBER) CREATE TABLE people (People_ID NUMBER, District CLOB, Name CLOB, Party CLOB, Age NUMBER) CREATE TABLE debate_people (Debate_ID NUMBER, Affirmative NUMBER, Negative NUMBER, If_Affirmative_Win BOOLEAN)
A pie chart showing the number of debates in each venue for those on the affirmative side.
SELECT Venue, COUNT(Venue) FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID GROUP BY Venue
SELECT "Venue", COUNT("Venue") FROM "debate_people" "T1" JOIN "debate" "T2" ON "T1"."Debate_ID" = "T2"."Debate_ID" JOIN "people" "T3" ON "T1"."Affirmative" = "T3"."People_ID" GROUP BY "Venue"
0.186523
CREATE TABLE table_22839669_12 (year NUMBER, money_list_rank VARCHAR2)
In what year was his money list rank 3?
SELECT MIN(year) FROM table_22839669_12 WHERE money_list_rank = 3
SELECT MIN("year") FROM "table_22839669_12" WHERE "money_list_rank" = 3
0.069336
CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER)
Most viewed posts of me.
SELECT Id AS "post_link", ViewCount, Score, Tags FROM Posts WHERE Posts.OwnerUserId = @UserId AND ViewCount > 0 ORDER BY ViewCount DESC, Score DESC LIMIT 20
SELECT "Id" AS "post_link", "ViewCount", "Score", "Tags" FROM "Posts" WHERE "Posts"."OwnerUserId" = @UserId AND "ViewCount" > 0 ORDER BY "ViewCount" DESC, "Score" DESC FETCH FIRST 20 ROWS ONLY
0.1875
CREATE TABLE table_60790 ("Player" CLOB, "Country" CLOB, "Year ( s ) won" CLOB, "Total" FLOAT, "To par" CLOB, "Finish" CLOB)
What years did the player with a t71 finish win?
SELECT "Year(s) won" FROM table_60790 WHERE "Finish" = 't71'
SELECT "Year(s) won" FROM "table_60790" WHERE "Finish" = 't71'
0.060547
CREATE TABLE table_name_88 (date VARCHAR2, week VARCHAR2, opponent VARCHAR2)
On which date after week 11 was the opponent the arizona cardinals?
SELECT date FROM table_name_88 WHERE week > 11 AND opponent = "arizona cardinals"
SELECT "date" FROM "table_name_88" WHERE "arizona cardinals" = "opponent" AND "week" > 11
0.086914
CREATE TABLE table_23604 ("Title" CLOB, "Author" CLOB, "Reader" CLOB, "Format" CLOB, "Company" CLOB, "Release Date" CLOB, "Notes" CLOB)
If the reader is Syal, Meera Meera Syal, what was the release date?
SELECT "Release Date" FROM table_23604 WHERE "Reader" = 'Syal, Meera Meera Syal'
SELECT "Release Date" FROM "table_23604" WHERE "Reader" = 'Syal, Meera Meera Syal'
0.080078
CREATE TABLE table_name_78 (country VARCHAR2, notes VARCHAR2, athlete VARCHAR2)
What is Alan Campbell's Country with Notes of FA?
SELECT country FROM table_name_78 WHERE notes = "fa" AND athlete = "alan campbell"
SELECT "country" FROM "table_name_78" WHERE "alan campbell" = "athlete" AND "fa" = "notes"
0.087891
CREATE TABLE table_13018091_1 (drawn VARCHAR2, club VARCHAR2)
How many teams drew the widnes vikings?
SELECT COUNT(drawn) FROM table_13018091_1 WHERE club = "Widnes Vikings"
SELECT COUNT("drawn") FROM "table_13018091_1" WHERE "Widnes Vikings" = "club"
0.075195
CREATE TABLE table_29302711_12 (prize_money__usd_ NUMBER, name VARCHAR2)
how much prize money (in USD) did bob lutz win
SELECT MAX(prize_money__usd_) FROM table_29302711_12 WHERE name = "Bob Lutz"
SELECT MAX("prize_money__usd_") FROM "table_29302711_12" WHERE "Bob Lutz" = "name"
0.080078
CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME)
in 2105, what were the top four most frequent procedures that patients received during the same month after receiving a packed cell transfusion?
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 = 'packed cell transfusion') AND STRFTIME('%y', procedures_icd.charttime) = '2105') 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 WHERE STRFTIME('%y', procedures_icd.charttime) = '2105') 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" WHERE STRFTIME('%y', "procedures_icd"."charttime") = '2105'), "t3" AS (SELECT "t2"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) 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" "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") = '2105' GROUP BY "t2"."icd9_code"), "_u_1" AS (SELECT "t3"."icd9_code" FROM "t3" "t3" WHERE "t3"."c1" <= 4 GROUP BY "icd9_code") SELECT "d_icd_procedures"."short_title" FROM "d_icd_procedures" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "d_icd_procedures"."icd9_code" WHERE NOT "_u_1"."" IS NULL
1.136719
CREATE TABLE table_63890 ("Actor" CLOB, "Character" CLOB, "Soap Opera" CLOB, "Years" CLOB, "Duration" CLOB)
what is the soap opera when the duration is 18 years and the character is miley byrne?
SELECT "Soap Opera" FROM table_63890 WHERE "Duration" = '18 years' AND "Character" = 'miley byrne'
SELECT "Soap Opera" FROM "table_63890" WHERE "Character" = 'miley byrne' AND "Duration" = '18 years'
0.097656
CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME)
count how many hospital visits patient 015-66570 has in this year.
SELECT COUNT(DISTINCT patient.patienthealthsystemstayid) FROM patient WHERE patient.uniquepid = '015-66570' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
SELECT COUNT(DISTINCT "patient"."patienthealthsystemstayid") FROM "patient" WHERE "patient"."uniquepid" = '015-66570' AND DATETIME("patient"."hospitaladmittime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
0.227539
CREATE TABLE table_58990 ("Standard order" FLOAT, "English translation" CLOB, "Transcription ( based on Pinyin ) " CLOB, "Traditional Chinese" CLOB, "Simplified Chinese" CLOB)
What is the English translation of ?
SELECT "English translation" FROM table_58990 WHERE "Simplified Chinese" = '山鬼'
SELECT "English translation" FROM "table_58990" WHERE "Simplified Chinese" = '山鬼'
0.079102
CREATE TABLE table_1341423_40 (party VARCHAR2, candidates VARCHAR2)
what is the party when candidates is jim demint (r) 80%?
SELECT party FROM table_1341423_40 WHERE candidates = "Jim DeMint (R) 80%"
SELECT "party" FROM "table_1341423_40" WHERE "Jim DeMint (R) 80%" = "candidates"
0.078125
CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
did patient 031-9128 have any microbiology test results for his sputum, tracheal specimen since 138 months ago?
SELECT COUNT(*) FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-9128')) AND microlab.culturesite = 'sputum, tracheal specimen' AND DATETIME(microlab.culturetakentime) >= DATETIME(CURRENT_TIME(), '-138 month')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '031-9128' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "microlab" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "microlab"."patientunitstayid" WHERE "microlab"."culturesite" = 'sputum, tracheal specimen' AND DATETIME("microlab"."culturetakentime") >= DATETIME(CURRENT_TIME(), '-138 month') AND NOT "_u_1"."" IS NULL
0.613281
CREATE TABLE Course_Authors_and_Tutors (author_id NUMBER, author_tutor_ATB VARCHAR2, login_name VARCHAR2, password VARCHAR2, personal_name VARCHAR2, middle_name VARCHAR2, family_name VARCHAR2, gender_mf VARCHAR2, address_line_1 VARCHAR2) CREATE TABLE Subjects (subject_id NUMBER, subject_name VARCHAR2) CREATE TABLE Courses (course_id NUMBER, author_id NUMBER, subject_id NUMBER, course_name VARCHAR2, course_description VARCHAR2) CREATE TABLE Student_Course_Enrolment (registration_id NUMBER, student_id NUMBER, course_id NUMBER, date_of_enrolment DATETIME, date_of_completion DATETIME) CREATE TABLE Students (student_id NUMBER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR2, password VARCHAR2, personal_name VARCHAR2, middle_name VARCHAR2, family_name VARCHAR2) CREATE TABLE Student_Tests_Taken (registration_id NUMBER, date_test_taken DATETIME, test_result VARCHAR2)
A bar chart for finding the number of the enrollment date for all the tests that have 'Pass' result, and sort by the Y from low to high please.
SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" ORDER BY COUNT(date_of_enrolment)
SELECT "date_of_enrolment", COUNT("date_of_enrolment") FROM "Student_Course_Enrolment" "T1" JOIN "Student_Tests_Taken" "T2" ON "Pass" = "T2"."test_result" AND "T1"."registration_id" = "T2"."registration_id" ORDER BY COUNT("date_of_enrolment")
0.236328
CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME)
what were the three most common specimen test ordered for patients diagnosed with erythematous cond nec previously within the same hospital visit since 2103?
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'erythematous cond nec') AND STRFTIME('%y', diagnoses_icd.charttime) >= '2103') AS t1 JOIN (SELECT admissions.subject_id, microbiologyevents.spec_type_desc, microbiologyevents.charttime, admissions.hadm_id FROM microbiologyevents JOIN admissions ON microbiologyevents.hadm_id = admissions.hadm_id WHERE STRFTIME('%y', microbiologyevents.charttime) >= '2103') AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND t1.hadm_id = t2.hadm_id GROUP BY t2.spec_type_desc) AS t3 WHERE t3.c1 <= 3
WITH "t2" AS (SELECT "admissions"."subject_id", "microbiologyevents"."spec_type_desc", "microbiologyevents"."charttime", "admissions"."hadm_id" FROM "microbiologyevents" JOIN "admissions" ON "admissions"."hadm_id" = "microbiologyevents"."hadm_id" WHERE STRFTIME('%y', "microbiologyevents"."charttime") >= '2103'), "t3" AS (SELECT "t2"."spec_type_desc", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'erythematous cond nec' JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" JOIN "t2" "t2" ON "admissions"."hadm_id" = "t2"."hadm_id" AND "admissions"."subject_id" = "t2"."subject_id" AND "diagnoses_icd"."charttime" < "t2"."charttime" WHERE STRFTIME('%y', "diagnoses_icd"."charttime") >= '2103' GROUP BY "t2"."spec_type_desc") SELECT "t3"."spec_type_desc" FROM "t3" "t3" WHERE "t3"."c1" <= 3
0.9375
CREATE TABLE table_16849 ("Player" CLOB, "No." FLOAT, "Nationality" CLOB, "Position" CLOB, "Years for Jazz" CLOB, "School/Club Team" CLOB)
What is the player that played in 2004-05?
SELECT "Player" FROM table_16849 WHERE "Years for Jazz" = '2004-05'
SELECT "Player" FROM "table_16849" WHERE "Years for Jazz" = '2004-05'
0.067383
CREATE TABLE constructorResults (constructorResultsId NUMBER, raceId NUMBER, constructorId NUMBER, points FLOAT, status CLOB) CREATE TABLE results (resultId NUMBER, raceId NUMBER, driverId NUMBER, constructorId NUMBER, number NUMBER, grid NUMBER, position CLOB, positionText CLOB, positionOrder NUMBER, points FLOAT, laps CLOB, time CLOB, milliseconds CLOB, fastestLap CLOB, rank CLOB, fastestLapTime CLOB, fastestLapSpeed CLOB, statusId NUMBER) CREATE TABLE qualifying (qualifyId NUMBER, raceId NUMBER, driverId NUMBER, constructorId NUMBER, number NUMBER, position NUMBER, q1 CLOB, q2 CLOB, q3 CLOB) CREATE TABLE constructors (constructorId NUMBER, constructorRef CLOB, name CLOB, nationality CLOB, url CLOB) CREATE TABLE races (raceId NUMBER, year NUMBER, round NUMBER, circuitId NUMBER, name CLOB, date CLOB, time CLOB, url CLOB) CREATE TABLE driverStandings (driverStandingsId NUMBER, raceId NUMBER, driverId NUMBER, points FLOAT, position NUMBER, positionText CLOB, wins NUMBER) CREATE TABLE circuits (circuitId NUMBER, circuitRef CLOB, name CLOB, location CLOB, country CLOB, lat FLOAT, lng FLOAT, alt CLOB, url CLOB) CREATE TABLE seasons (year NUMBER, url CLOB) CREATE TABLE pitStops (raceId NUMBER, driverId NUMBER, stop NUMBER, lap NUMBER, time CLOB, duration CLOB, milliseconds NUMBER) CREATE TABLE status (statusId NUMBER, status CLOB) CREATE TABLE lapTimes (raceId NUMBER, driverId NUMBER, lap NUMBER, position NUMBER, time CLOB, milliseconds NUMBER) CREATE TABLE drivers (driverId NUMBER, driverRef CLOB, number CLOB, code CLOB, forename CLOB, surname CLOB, dob CLOB, nationality CLOB, url CLOB) CREATE TABLE constructorStandings (constructorStandingsId NUMBER, raceId NUMBER, constructorId NUMBER, points FLOAT, position NUMBER, positionText CLOB, wins NUMBER)
Find the names of Japanese constructors that have once earned more than 5 points, and count them by a bar chart, and I want to display x axis in desc order.
SELECT name, COUNT(name) FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = "Japanese" AND T2.points > 5 GROUP BY name ORDER BY name DESC
SELECT "name", COUNT("name") FROM "constructors" "T1" JOIN "constructorStandings" "T2" ON "T1"."constructorId" = "T2"."constructorId" AND "T2"."points" > 5 WHERE "Japanese" = "T1"."nationality" GROUP BY "name" ORDER BY "name" DESC
0.224609
CREATE TABLE table_40767 ("Club" CLOB, "Wins" FLOAT, "Losses" FLOAT, "Points For" FLOAT, "Points Against" FLOAT, "Percentage" FLOAT, "Points" FLOAT)
What is the total number of Losses when the percentage is 54.83, with more than 8 points?
SELECT COUNT("Losses") FROM table_40767 WHERE "Percentage" = '54.83' AND "Points" > '8'
SELECT COUNT("Losses") FROM "table_40767" WHERE "Percentage" = '54.83' AND "Points" > '8'
0.086914
CREATE TABLE table_54480 ("Track" FLOAT, "Title" CLOB, "Performer" CLOB, "Length" CLOB, "Original Album" CLOB)
On the title feature brad mehldau as the performer, what is the original album?
SELECT "Original Album" FROM table_54480 WHERE "Performer" = 'brad mehldau'
SELECT "Original Album" FROM "table_54480" WHERE "Performer" = 'brad mehldau'
0.075195
CREATE TABLE table_238124_1 (bleeding_time VARCHAR2, condition VARCHAR2)
What is the bleeding time for glanzmann's thrombasthenia?
SELECT bleeding_time FROM table_238124_1 WHERE condition = "Glanzmann's thrombasthenia"
SELECT "bleeding_time" FROM "table_238124_1" WHERE "Glanzmann's thrombasthenia" = "condition"
0.09082
CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME)
patient 030-52327 had undergone any lab tests on their current hospital visit?
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-52327' AND patient.hospitaldischargetime IS NULL))
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '030-52327' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "lab" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "lab"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL
0.511719
CREATE TABLE table_name_59 (opened VARCHAR2, country VARCHAR2)
Name the opened for spain
SELECT opened FROM table_name_59 WHERE country = "spain"
SELECT "opened" FROM "table_name_59" WHERE "country" = "spain"
0.060547
CREATE TABLE table_17741 ("Team" CLOB, "Car ( s ) " CLOB, "#" FLOAT, "Driver ( s ) " CLOB, "Primary Sponsor ( s ) " CLOB, "Owner ( s ) " CLOB, "Crew Chief" CLOB)
What's the total number of crew chiefs of the Fas Lane Racing team?
SELECT COUNT("Crew Chief") FROM table_17741 WHERE "Team" = 'FAS Lane Racing'
SELECT COUNT("Crew Chief") FROM "table_17741" WHERE "Team" = 'FAS Lane Racing'
0.076172
CREATE TABLE table_76611 ("Club" CLOB, "Played" CLOB, "Drawn" CLOB, "Lost" CLOB, "Points for" CLOB, "Points against" CLOB, "Tries for" CLOB, "Tries against" CLOB, "Try bonus" CLOB)
What is the points number when 20 shows for played, and lost is 0?
SELECT "Points for" FROM table_76611 WHERE "Played" = '20' AND "Lost" = '0'
SELECT "Points for" FROM "table_76611" WHERE "Lost" = '0' AND "Played" = '20'
0.075195
CREATE TABLE table_1566850_8 (cover_model VARCHAR2, date VARCHAR2)
What is the name of the cover model on 3-97?
SELECT cover_model FROM table_1566850_8 WHERE date = "3-97"
SELECT "cover_model" FROM "table_1566850_8" WHERE "3-97" = "date"
0.063477
CREATE TABLE student (ID VARCHAR2, name VARCHAR2, dept_name VARCHAR2, tot_cred NUMBER) CREATE TABLE classroom (building VARCHAR2, room_number VARCHAR2, capacity NUMBER) CREATE TABLE course (course_id VARCHAR2, title VARCHAR2, dept_name VARCHAR2, credits NUMBER) CREATE TABLE prereq (course_id VARCHAR2, prereq_id VARCHAR2) CREATE TABLE time_slot (time_slot_id VARCHAR2, day VARCHAR2, start_hr NUMBER, start_min NUMBER, end_hr NUMBER, end_min NUMBER) CREATE TABLE department (dept_name VARCHAR2, building VARCHAR2, budget NUMBER) CREATE TABLE advisor (s_ID VARCHAR2, i_ID VARCHAR2) CREATE TABLE teaches (ID VARCHAR2, course_id VARCHAR2, sec_id VARCHAR2, semester VARCHAR2, year NUMBER) CREATE TABLE instructor (ID VARCHAR2, name VARCHAR2, dept_name VARCHAR2, salary NUMBER) CREATE TABLE section (course_id VARCHAR2, sec_id VARCHAR2, semester VARCHAR2, year NUMBER, building VARCHAR2, room_number VARCHAR2, time_slot_id VARCHAR2) CREATE TABLE takes (ID VARCHAR2, course_id VARCHAR2, sec_id VARCHAR2, semester VARCHAR2, year NUMBER, grade VARCHAR2)
Display a bar chart for what are the names and budgets of departments with budgets greater than the average?, and order by the budget from high to low.
SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department) ORDER BY budget DESC
SELECT "dept_name", "budget" FROM "department" WHERE "budget" > (SELECT AVG("budget") FROM "department") ORDER BY "budget" DESC
0.124023
CREATE TABLE table_name_57 (livery VARCHAR2, date VARCHAR2)
Which livery is from 1919?
SELECT livery FROM table_name_57 WHERE date = "1919"
SELECT "livery" FROM "table_name_57" WHERE "1919" = "date"
0.056641
CREATE TABLE table_name_19 (april NUMBER, record VARCHAR2)
Name the most april with record of 38-33-10
SELECT MAX(april) FROM table_name_19 WHERE record = "38-33-10"
SELECT MAX("april") FROM "table_name_19" WHERE "38-33-10" = "record"
0.066406
CREATE TABLE table_10707142_2 (report VARCHAR2, circuit VARCHAR2)
what is the report called where the circuit took place at the nazareth speedway?
SELECT report FROM table_10707142_2 WHERE circuit = "Nazareth Speedway"
SELECT "report" FROM "table_10707142_2" WHERE "Nazareth Speedway" = "circuit"
0.075195
CREATE TABLE table_name_41 (qual_1 VARCHAR2, team VARCHAR2)
What is the qual 1 for conquest racing?
SELECT qual_1 FROM table_name_41 WHERE team = "conquest racing"
SELECT "qual_1" FROM "table_name_41" WHERE "conquest racing" = "team"
0.067383
CREATE TABLE table_204_188 (id NUMBER, "rank" NUMBER, "player" CLOB, "points" NUMBER, "points defending" NUMBER, "points won" NUMBER, "new points" NUMBER, "withdrew due to" CLOB)
which player was defending the highest number of points at the time of his withdrawal from the 2010 french open ?
SELECT "player" FROM table_204_188 ORDER BY "points defending" DESC LIMIT 1
SELECT "player" FROM "table_204_188" ORDER BY "points defending" DESC FETCH FIRST 1 ROWS ONLY
0.09082
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB)
provide the number of patients whose admission type is emergency and admission year is less than 2167?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.admityear < "2167"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2167" > "demographic"."admityear" AND "EMERGENCY" = "demographic"."admission_type"
0.154297
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
what number of patients trasferred from hosp/extram had drug code inrhi?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND prescriptions.formulary_drug_cd = "INRHI"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "INRHI" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "TRANSFER FROM HOSP/EXTRAM" = "demographic"."admission_location"
0.258789
CREATE TABLE table_35595 ("Length of game" CLOB, "Date" CLOB, "Away team" CLOB, "Score" CLOB, "Home team" CLOB)
What is the date of the that was played with the Baltimore Colts at home?
SELECT "Date" FROM table_35595 WHERE "Home team" = 'baltimore colts'
SELECT "Date" FROM "table_35595" WHERE "Home team" = 'baltimore colts'
0.068359
CREATE TABLE table_name_6 (score VARCHAR2, visitor VARCHAR2)
What was the score for the game against Atlanta?
SELECT score FROM table_name_6 WHERE visitor = "atlanta"
SELECT "score" FROM "table_name_6" WHERE "atlanta" = "visitor"
0.060547
CREATE TABLE table_17323042_11 (high_assists VARCHAR2, high_rebounds VARCHAR2)
Who was the High Assist when the High Rebounds was andre iguodala (8)?
SELECT high_assists FROM table_17323042_11 WHERE high_rebounds = "Andre Iguodala (8)"
SELECT "high_assists" FROM "table_17323042_11" WHERE "Andre Iguodala (8)" = "high_rebounds"
0.088867
CREATE TABLE table_76909 ("Rank" CLOB, "Nation" CLOB, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
What is the sum of Total, when Rank is 8, and when Bronze is less than 1?
SELECT SUM("Total") FROM table_76909 WHERE "Rank" = '8' AND "Bronze" < '1'
SELECT SUM("Total") FROM "table_76909" WHERE "Bronze" < '1' AND "Rank" = '8'
0.074219
CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other)
Quantity of content: Amount of posts.
SELECT Month = DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0), 'Quantity of content' = COUNT(*) FROM Posts GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0) ORDER BY Month
SELECT "Month" = DATEADD("MONTH", DATEDIFF(CAST("MONTH" AS DATETIME), CAST(0 AS DATETIME), CREATIONDATE), 0), COUNT(*) = 'Quantity of content' FROM "Posts" GROUP BY DATEADD("MONTH", DATEDIFF(CAST("MONTH" AS DATETIME), CAST(0 AS DATETIME), CREATIONDATE), 0) ORDER BY "Month"
0.266602
CREATE TABLE table_203_263 (id NUMBER, "alumni chapters and clubs" CLOB, "location" CLOB, "founding date" CLOB, "years active" CLOB, "province" CLOB)
which delta omicron chapter was founded before zeta beta ?
SELECT "alumni chapters and clubs" FROM table_203_263 WHERE id = (SELECT id FROM table_203_263 WHERE "alumni chapters and clubs" = 'zeta beta') - 1
SELECT "alumni chapters and clubs" FROM "table_203_263" WHERE "id" = (SELECT "id" FROM "table_203_263" WHERE "alumni chapters and clubs" = 'zeta beta') - 1
0.151367
CREATE TABLE table_77496 ("Date" CLOB, "Tournament" CLOB, "Winning score" CLOB, "To par" CLOB, "Margin of victory" CLOB, "Runner-up" CLOB)
A tournament on which date has a margin of victory of 2 strokes and a par of 16?
SELECT "Date" FROM table_77496 WHERE "Margin of victory" = '2 strokes' AND "To par" = '−16'
SELECT "Date" FROM "table_77496" WHERE "Margin of victory" = '2 strokes' AND "To par" = '−16'
0.09082
CREATE TABLE table_17157367_1 (output VARCHAR2, short_description VARCHAR2)
what ist he output where the short description is massive?
SELECT output FROM table_17157367_1 WHERE short_description = "massive"
SELECT "output" FROM "table_17157367_1" WHERE "massive" = "short_description"
0.075195
CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE employees (EMPLOYEE_ID NUMBER, FIRST_NAME VARCHAR2, LAST_NAME VARCHAR2, EMAIL VARCHAR2, PHONE_NUMBER VARCHAR2, HIRE_DATE DATE, JOB_ID VARCHAR2, SALARY NUMBER, COMMISSION_PCT NUMBER, MANAGER_ID NUMBER, DEPARTMENT_ID NUMBER) CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER) CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER) CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER)
For those employees who did not have any job in the past, give me the comparison about the sum of department_id over the hire_date bin hire_date by weekday, show by the y-axis from low to high.
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(DEPARTMENT_ID)
SELECT "HIRE_DATE", SUM("DEPARTMENT_ID") FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history") ORDER BY SUM("DEPARTMENT_ID")
0.152344
CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB)
count the number of patients who had a int insert dual-cham dev procedure performed two or more times.
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 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 = 'int insert dual-cham dev') GROUP BY admissions.subject_id) AS t1 WHERE t1.c1 >= 2
WITH "t1" AS (SELECT "admissions"."subject_id", COUNT(*) 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" = 'int insert dual-cham dev' JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id" GROUP BY "admissions"."subject_id") SELECT COUNT(DISTINCT "t1"."subject_id") FROM "t1" "t1" WHERE "t1"."c1" >= 2
0.416992
CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME)
SELECT * FROM Posts WHERE Id = 55440926.
SELECT p.*, u.ProfileImageUrl, u.DisplayName, u.WebsiteUrl FROM Posts AS p LEFT JOIN Users AS u ON u.Id = p.OwnerUserId LEFT JOIN Comments AS c ON c.PostId = p.Id WHERE p.Id = 55440926 OR p.ParentId = 55440926
SELECT "p".*, "u"."ProfileImageUrl", "u"."DisplayName", "u"."WebsiteUrl" FROM "Posts" "p" LEFT JOIN "Comments" "c" ON "c"."PostId" = "p"."Id" LEFT JOIN "Users" "u" ON "p"."OwnerUserId" = "u"."Id" WHERE "p"."Id" = 55440926 OR "p"."ParentId" = 55440926
0.244141
CREATE TABLE table_name_43 (pennant_number VARCHAR2, launched VARCHAR2, completed VARCHAR2)
Name the pennant number for completion of 30 october 1934 and launched 29 march 1934
SELECT pennant_number FROM table_name_43 WHERE launched = "29 march 1934" AND completed = "30 october 1934"
SELECT "pennant_number" FROM "table_name_43" WHERE "29 march 1934" = "launched" AND "30 october 1934" = "completed"
0.112305
CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER)
Questions Where the OP Posted An Answer. Finds 1000 answers posted by the person who originally posted the question where the answer was not accepted score of the answer is less than a parameter and the user's reputation is less than a parameter
SELECT question.Id AS "post_link", answer.Id AS "post_link" FROM Posts AS question INNER JOIN Posts AS answer ON question.Id = answer.ParentId INNER JOIN Users AS poster ON question.OwnerUserId = poster.Id WHERE question.OwnerUserId = answer.OwnerUserId AND question.AcceptedAnswerId != answer.Id AND answer.Score < '##maxanswerscore##' AND poster.Reputation < '##maxreputation:int##' LIMIT 1000
SELECT "question"."Id" AS "post_link", "answer"."Id" AS "post_link" FROM "Posts" "question" JOIN "Posts" "answer" ON "answer"."Id" <> "question"."AcceptedAnswerId" AND "answer"."OwnerUserId" = "question"."OwnerUserId" AND "answer"."ParentId" = "question"."Id" AND "answer"."Score" < '##maxanswerscore##' JOIN "Users" "poster" ON "poster"."Id" = "question"."OwnerUserId" AND "poster"."Reputation" < '##maxreputation:int##' FETCH FIRST 1000 ROWS ONLY
0.4375
CREATE TABLE chip_model (Model_name CLOB, Launch_year FLOAT, RAM_MiB FLOAT, ROM_MiB FLOAT, Slots CLOB, WiFi CLOB, Bluetooth CLOB) CREATE TABLE phone (Company_name CLOB, Hardware_Model_name CLOB, Accreditation_type CLOB, Accreditation_level CLOB, Date CLOB, chip_model CLOB, screen_mode CLOB) CREATE TABLE screen_mode (Graphics_mode FLOAT, Char_cells CLOB, Pixels CLOB, Hardware_colours FLOAT, used_kb FLOAT, map CLOB, Type CLOB)
Compare the number of chips from different company names for the phone whose screen mode type is 'Graphics' with a bar chart, list by the Company_name in asc please.
SELECT Company_name, COUNT(Company_name) FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = "Graphics" GROUP BY Company_name ORDER BY Company_name
SELECT "Company_name", COUNT("Company_name") FROM "screen_mode" "T1" JOIN "phone" "T2" ON "T1"."Graphics_mode" = "T2"."screen_mode" WHERE "Graphics" = "T1"."Type" GROUP BY "Company_name" ORDER BY "Company_name"
0.205078
CREATE TABLE table_25807 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
How many people led in assists on game 71?
SELECT COUNT("High assists") FROM table_25807 WHERE "Game" = '71'
SELECT COUNT("High assists") FROM "table_25807" WHERE "Game" = '71'
0.06543
CREATE TABLE table_68107 ("Year" CLOB, "Team" CLOB, "TTkl" FLOAT, "Solo" FLOAT, "Sacks" FLOAT, "Pass Def" FLOAT)
How many sacks have 2006 as the year, and a solo less than 62?
SELECT SUM("Sacks") FROM table_68107 WHERE "Year" = '2006' AND "Solo" < '62'
SELECT SUM("Sacks") FROM "table_68107" WHERE "Solo" < '62' AND "Year" = '2006'
0.076172
CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER)
when in a year before patient 26995 received for the last time a procedure?
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26995) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY procedures_icd.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 26995 GROUP BY "hadm_id") SELECT "procedures_icd"."charttime" FROM "procedures_icd" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_0"."" IS NULL ORDER BY "procedures_icd"."charttime" DESC FETCH FIRST 1 ROWS ONLY
0.446289
CREATE TABLE table_name_30 (championship VARCHAR2, year VARCHAR2)
What championship was in 1985?
SELECT championship FROM table_name_30 WHERE year = 1985
SELECT "championship" FROM "table_name_30" WHERE "year" = 1985
0.060547
CREATE TABLE table_76995 ("County" CLOB, "Kerry%" CLOB, "Kerry#" FLOAT, "Bush%" CLOB, "Bush#" FLOAT, "Others%" CLOB, "Others#" FLOAT)
What is the highest Bush#, when Others% is '1.7%', when Others# is less than 75, and when Kerry# is greater than 1,524?
SELECT MAX("Bush#") FROM table_76995 WHERE "Others%" = '1.7%' AND "Others#" < '75' AND "Kerry#" > '1,524'
SELECT MAX("Bush#") FROM "table_76995" WHERE "Kerry#" > '1,524' AND "Others#" < '75' AND "Others%" = '1.7%'
0.104492
CREATE TABLE station (Station_ID NUMBER, Name CLOB, Annual_entry_exit FLOAT, Annual_interchanges FLOAT, Total_Passengers FLOAT, Location CLOB, Main_Services CLOB, Number_of_Platforms NUMBER) CREATE TABLE train (Train_ID NUMBER, Name CLOB, Time CLOB, Service CLOB) CREATE TABLE train_station (Train_ID NUMBER, Station_ID NUMBER)
A bar chart shows how many locations, and sort from high to low by the X.
SELECT Location, COUNT(Location) FROM station GROUP BY Location ORDER BY Location DESC
SELECT "Location", COUNT("Location") FROM "station" GROUP BY "Location" ORDER BY "Location" DESC
0.09375
CREATE TABLE table_name_84 (city VARCHAR2, iata VARCHAR2)
PER is the IATA for which city?
SELECT city FROM table_name_84 WHERE iata = "per"
SELECT "city" FROM "table_name_84" WHERE "iata" = "per"
0.053711
CREATE TABLE table_name_75 (loses NUMBER, wins VARCHAR2, pos VARCHAR2)
Wins of 3, and a Pos. larger than 3 is what average loses?
SELECT AVG(loses) FROM table_name_75 WHERE wins = 3 AND pos > 3
SELECT AVG("loses") FROM "table_name_75" WHERE "pos" > 3 AND "wins" = 3
0.069336
CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
when was patient 71558 first prescribed a medication using the po route since 10/2103?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 71558) AND prescriptions.route = 'po' AND STRFTIME('%y-%m', prescriptions.startdate) >= '2103-10' ORDER BY prescriptions.startdate LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 71558 GROUP BY "hadm_id") SELECT "prescriptions"."startdate" FROM "prescriptions" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE "prescriptions"."route" = 'po' AND NOT "_u_0"."" IS NULL AND STRFTIME('%y-%m', "prescriptions"."startdate") >= '2103-10' ORDER BY "prescriptions"."startdate" FETCH FIRST 1 ROWS ONLY
0.421875
CREATE TABLE table_2150776_1 (driver VARCHAR2, laps VARCHAR2, year VARCHAR2)
Name the driver for 200 laps 1997
SELECT driver FROM table_2150776_1 WHERE laps = "200" AND year = "1997"
SELECT "driver" FROM "table_2150776_1" WHERE "1997" = "year" AND "200" = "laps"
0.077148
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
count the number of patients whose age is less than 24 and days of hospital stay is greater than 43?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "24" AND demographic.days_stay > "43"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "24" > "demographic"."age" AND "43" < "demographic"."days_stay"
0.134766
CREATE TABLE table_68130 ("Year" FLOAT, "Team" CLOB, "Co-Drivers" CLOB, "Class" CLOB, "Laps" FLOAT, "Pos." CLOB, "Class Pos." CLOB)
Which co drivers are 3rd in Joest racing?
SELECT "Co-Drivers" FROM table_68130 WHERE "Pos." = '3rd' AND "Team" = 'joest racing'
SELECT "Co-Drivers" FROM "table_68130" WHERE "Pos." = '3rd' AND "Team" = 'joest racing'
0.084961
CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB)
so, what was the last heart rate of patient 28443 in the previous day?
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 = 28443)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day') ORDER BY chartevents.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 28443 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'heart rate' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT "chartevents"."valuenum" FROM "chartevents" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE DATETIME("chartevents"."charttime", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL ORDER BY "chartevents"."charttime" DESC FETCH FIRST 1 ROWS ONLY
0.830078
CREATE TABLE table_name_36 (surface VARCHAR2, score VARCHAR2, date VARCHAR2)
What surface was played on with a score of 6 4, 6 3 and on 4 May 1992?
SELECT surface FROM table_name_36 WHERE score = "6–4, 6–3" AND date = "4 may 1992"
SELECT "surface" FROM "table_name_36" WHERE "4 may 1992" = "date" AND "6–4, 6–3" = "score"
0.087891
CREATE TABLE table_27119 ("Name" CLOB, "Nationality" CLOB, "Position" CLOB, "Sky Blue FC career" CLOB, "Appearances" FLOAT, "Starts" FLOAT, "Minutes" FLOAT, "Goals" FLOAT, "Assists" FLOAT)
What is the appearance maximum if the starts is 18?
SELECT MAX("Appearances") FROM table_27119 WHERE "Starts" = '18'
SELECT MAX("Appearances") FROM "table_27119" WHERE "Starts" = '18'
0.064453
CREATE TABLE table_58323 ("Race Name" CLOB, "Circuit" CLOB, "Date" CLOB, "Winning driver" CLOB, "Constructor" CLOB, "Report" CLOB)
What is the name of race that has a winning driver of Stirling moss and a Circuit of oulton park?
SELECT "Race Name" FROM table_58323 WHERE "Winning driver" = 'stirling moss' AND "Circuit" = 'oulton park'
SELECT "Race Name" FROM "table_58323" WHERE "Circuit" = 'oulton park' AND "Winning driver" = 'stirling moss'
0.105469
CREATE TABLE table_278229_1 (commandery VARCHAR2)
When nanhai is the commandery what is the commandery capital?
SELECT commandery AS capital FROM table_278229_1 WHERE commandery = "Nanhai 南海"
SELECT "commandery" AS "capital" FROM "table_278229_1" WHERE "Nanhai 南海" = "commandery"
0.084961
CREATE TABLE Projects (project_id NUMBER, organisation_id NUMBER, project_details VARCHAR2) CREATE TABLE Document_Types (document_type_code VARCHAR2, document_description VARCHAR2) CREATE TABLE Research_Staff (staff_id NUMBER, employer_organisation_id NUMBER, staff_details VARCHAR2) CREATE TABLE Grants (grant_id NUMBER, organisation_id NUMBER, grant_amount NUMBER, grant_start_date DATETIME, grant_end_date DATETIME, other_details VARCHAR2) CREATE TABLE Project_Outcomes (project_id NUMBER, outcome_code VARCHAR2, outcome_details VARCHAR2) CREATE TABLE Documents (document_id NUMBER, document_type_code VARCHAR2, grant_id NUMBER, sent_date DATETIME, response_received_date DATETIME, other_details VARCHAR2) CREATE TABLE Project_Staff (staff_id DOUBLE PRECISION, project_id NUMBER, role_code VARCHAR2, date_from DATETIME, date_to DATETIME, other_details VARCHAR2) CREATE TABLE Organisation_Types (organisation_type VARCHAR2, organisation_type_description VARCHAR2) CREATE TABLE Tasks (task_id NUMBER, project_id NUMBER, task_details VARCHAR2, "eg Agree Objectives" VARCHAR2) CREATE TABLE Organisations (organisation_id NUMBER, organisation_type VARCHAR2, organisation_details VARCHAR2) CREATE TABLE Staff_Roles (role_code VARCHAR2, role_description VARCHAR2) CREATE TABLE Research_Outcomes (outcome_code VARCHAR2, outcome_description VARCHAR2)
A pie chart for what are the number of the descriptions of all the project outcomes?
SELECT outcome_description, COUNT(outcome_description) FROM Research_Outcomes AS T1 JOIN Project_Outcomes AS T2 ON T1.outcome_code = T2.outcome_code GROUP BY outcome_description
SELECT "outcome_description", COUNT("outcome_description") FROM "Research_Outcomes" "T1" JOIN "Project_Outcomes" "T2" ON "T1"."outcome_code" = "T2"."outcome_code" GROUP BY "outcome_description"
0.188477
CREATE TABLE ship (Ship_ID NUMBER, Name CLOB, Type CLOB, Nationality CLOB, Tonnage NUMBER) CREATE TABLE mission (Mission_ID NUMBER, Ship_ID NUMBER, Code CLOB, Launched_Year NUMBER, Location CLOB, Speed_knots NUMBER, Fate CLOB)
Show different types of ships and the number of ships of each type in a bar chart, display y-axis in desc order.
SELECT Type, COUNT(*) FROM ship GROUP BY Type ORDER BY COUNT(*) DESC
SELECT "Type", COUNT(*) FROM "ship" GROUP BY "Type" ORDER BY COUNT(*) DESC
0.072266
CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB)
what are the five most commonly prescribed drugs that were prescribed to the patients 40s in the same hospital encounter after having been diagnosed with sepsis - sepsis with multi-organ dysfunction until 1 year ago?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sepsis - sepsis with multi-organ dysfunction' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.age BETWEEN 40 AND 49 AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime", "patient"."patienthealthsystemstayid" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."age" <= 49 AND "patient"."age" >= 40 WHERE DATETIME("medication"."drugstarttime") <= DATETIME(CURRENT_TIME(), '-1 year')), "t3" AS (SELECT "t2"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" "t2" ON "diagnosis"."diagnosistime" < "t2"."drugstarttime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "diagnosis"."diagnosisname" = 'sepsis - sepsis with multi-organ dysfunction' AND DATETIME("diagnosis"."diagnosistime") <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY "t2"."drugname") SELECT "t3"."drugname" FROM "t3" "t3" WHERE "t3"."c1" <= 5
0.974609
CREATE TABLE table_name_84 (date VARCHAR2, tournament VARCHAR2)
When was the Lagos tournament?
SELECT date FROM table_name_84 WHERE tournament = "lagos"
SELECT "date" FROM "table_name_84" WHERE "lagos" = "tournament"
0.061523
CREATE TABLE flight (flno NUMBER, origin VARCHAR2, destination VARCHAR2, distance NUMBER, departure_date DATE, arrival_date DATE, price NUMBER, aid NUMBER) CREATE TABLE employee (eid NUMBER, name VARCHAR2, salary NUMBER) CREATE TABLE certificate (eid NUMBER, aid NUMBER) CREATE TABLE aircraft (aid NUMBER, name VARCHAR2, distance NUMBER)
How many flights for each origin city? Return a pie chart.
SELECT origin, COUNT(origin) FROM flight GROUP BY origin
SELECT "origin", COUNT("origin") FROM "flight" GROUP BY "origin"
0.0625
CREATE TABLE table_31484 ("Pick #" FLOAT, "CFL Team" CLOB, "Player" CLOB, "Position" CLOB, "College" CLOB)
Which player(s) played at Howard college?
SELECT "Player" FROM table_31484 WHERE "College" = 'Howard'
SELECT "Player" FROM "table_31484" WHERE "College" = 'Howard'
0.05957
CREATE TABLE employees (EMPLOYEE_ID NUMBER, FIRST_NAME VARCHAR2, LAST_NAME VARCHAR2, EMAIL VARCHAR2, PHONE_NUMBER VARCHAR2, HIRE_DATE DATE, JOB_ID VARCHAR2, SALARY NUMBER, COMMISSION_PCT NUMBER, MANAGER_ID NUMBER, DEPARTMENT_ID NUMBER) CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER) CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2) CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER)
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of first_name and manager_id in a bar chart, and I want to sort from low to high by the y-axis please.
SELECT FIRST_NAME, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID
SELECT "FIRST_NAME", "MANAGER_ID" FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100) ORDER BY "MANAGER_ID"
0.19043
CREATE TABLE table_name_51 (result VARCHAR2, venue VARCHAR2)
What was the results of the game at Doha?
SELECT result FROM table_name_51 WHERE venue = "doha"
SELECT "result" FROM "table_name_51" WHERE "doha" = "venue"
0.057617
CREATE TABLE table_name_16 (gold NUMBER, rank VARCHAR2, total VARCHAR2)
Tell me the lowest gold for rank of 6 and total less than 2
SELECT MIN(gold) FROM table_name_16 WHERE rank = "6" AND total < 2
SELECT MIN("gold") FROM "table_name_16" WHERE "6" = "rank" AND "total" < 2
0.072266
CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER)
How many upper-level 15 -credit classes in ACC will there be this Spring ?
SELECT COUNT(DISTINCT course.course_id) FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.credits = 15 AND course.department = 'ACC' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Spring' AND semester.semester_id = course_offering.semester AND semester.year = 2016
SELECT COUNT(DISTINCT "course"."course_id") FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%ULCS%' JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'Spring' AND "semester"."year" = 2016 WHERE "course"."credits" = 15 AND "course"."department" = 'ACC'
0.453125