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_13618358_1 (income_poverty_f VARCHAR2, exports__usd_mn__2011 VARCHAR2)
What was the depravitiy of earnings where international sales was 2470?
SELECT income_poverty_f FROM table_13618358_1 WHERE exports__usd_mn__2011 = 2470
SELECT "income_poverty_f" FROM "table_13618358_1" WHERE "exports__usd_mn__2011" = 2470
0.083984
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER) CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
For those records from the products and each product's manufacturer, show me about the distribution of name and code , and group by attribute headquarter in a bar chart, could you show bar from high to low order please?
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Name DESC
SELECT "T1"."Name", "T1"."Code" FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Headquarter", "T1"."Name" ORDER BY "T1"."Name" DESC
0.172852
CREATE TABLE table_18210 ("District" CLOB, "Incumbent" CLOB, "Party" CLOB, "First elected" FLOAT, "Result" CLOB, "Candidates" CLOB)
how many first elected with result being re-elected and incumbent being gary ackerman redistricted from the 7th district
SELECT COUNT("First elected") FROM table_18210 WHERE "Result" = 'Re-elected' AND "Incumbent" = 'Gary Ackerman Redistricted from the 7th district'
SELECT COUNT("First elected") FROM "table_18210" WHERE "Incumbent" = 'Gary Ackerman Redistricted from the 7th district' AND "Result" = 'Re-elected'
0.143555
CREATE TABLE swimmer (ID NUMBER, name CLOB, Nationality CLOB, meter_100 FLOAT, meter_200 CLOB, meter_300 CLOB, meter_400 CLOB, meter_500 CLOB, meter_600 CLOB, meter_700 CLOB, Time CLOB) CREATE TABLE record (ID NUMBER, Result CLOB, Swimmer_ID NUMBER, Event_ID NUMBER) CREATE TABLE stadium (ID NUMBER, name CLOB, Capacity NUMBER, City CLOB, Country CLOB, Opening_year NUMBER) CREATE TABLE event (ID NUMBER, Name CLOB, Stadium_ID NUMBER, Year CLOB)
Draw a bar chart about the distribution of meter_300 and ID , I want to show from low to high by the y axis please.
SELECT meter_300, ID FROM swimmer ORDER BY ID
SELECT "meter_300", "ID" FROM "swimmer" ORDER BY "ID"
0.051758
CREATE TABLE table_78017 ("Rank" FLOAT, "Player" CLOB, "Club" CLOB, "Country" CLOB, "Titles" FLOAT, "Seasons" CLOB)
What player is ranked 2 and played in the seasons of 1982 83, 1983 84, 1984 85?
SELECT "Player" FROM table_78017 WHERE "Rank" = '2' AND "Seasons" = '1982–83, 1983–84, 1984–85'
SELECT "Player" FROM "table_78017" WHERE "Rank" = '2' AND "Seasons" = '1982–83, 1983–84, 1984–85'
0.094727
CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_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) 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 program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) 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 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 comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE area (course_id NUMBER, area 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 program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2)
Are there any upper level classes that do not require 490 ?
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%topic0%' OR name LIKE '%topic0%') AND department = 'EECS'
SELECT DISTINCT "department", "name", "number" FROM "course" WHERE "department" = 'EECS' AND ("description" LIKE '%topic0%' OR "name" LIKE '%topic0%')
0.146484
CREATE TABLE table_6078 ("Image" CLOB, "Father" CLOB, "Birth" CLOB, "Ceased to be Duchess" CLOB, "Death" CLOB, "Husband" CLOB)
What is the death date of elisabeth of lorraine?
SELECT "Death" FROM table_6078 WHERE "Image" = 'elisabeth of lorraine'
SELECT "Death" FROM "table_6078" WHERE "Image" = 'elisabeth of lorraine'
0.070313
CREATE TABLE table_47339 ("Party" CLOB, "Previous council" FLOAT, "Staying councillors" FLOAT, "Seats up for election" FLOAT, "Election result" FLOAT, "New council" FLOAT)
Which Seats up for election have an Election result larger than 8, and Staying councillors of 24?
SELECT MAX("Seats up for election") FROM table_47339 WHERE "Election result" > '8' AND "Staying councillors" = '24'
SELECT MAX("Seats up for election") FROM "table_47339" WHERE "Election result" > '8' AND "Staying councillors" = '24'
0.114258
CREATE TABLE table_name_11 (college_junior_club_team VARCHAR2, round VARCHAR2)
Which College/junior/club team has a Round of 2?
SELECT college_junior_club_team FROM table_name_11 WHERE round = 2
SELECT "college_junior_club_team" FROM "table_name_11" WHERE "round" = 2
0.070313
CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_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) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) 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 regions (REGION_ID NUMBER, REGION_NAME VARCHAR2)
Find employee with ID and name of the country presently where (s)he is working Visualize by bar chart, and I want to order by the bars from low to high.
SELECT COUNTRY_NAME, SUM(EMPLOYEE_ID) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID JOIN locations AS T3 ON T2.LOCATION_ID = T3.LOCATION_ID JOIN countries AS T4 ON T3.COUNTRY_ID = T4.COUNTRY_ID GROUP BY COUNTRY_NAME ORDER BY COUNTRY_NAME
SELECT "COUNTRY_NAME", SUM("EMPLOYEE_ID") FROM "employees" "T1" JOIN "departments" "T2" ON "T1"."DEPARTMENT_ID" = "T2"."DEPARTMENT_ID" JOIN "locations" "T3" ON "T2"."LOCATION_ID" = "T3"."LOCATION_ID" JOIN "countries" "T4" ON "T3"."COUNTRY_ID" = "T4"."COUNTRY_ID" GROUP BY "COUNTRY_NAME" ORDER BY "COUNTRY_NAME"
0.302734
CREATE TABLE table_25459 ("#" FLOAT, "Date" CLOB, "Visitor" CLOB, "Score" CLOB, "Arena Attendance" CLOB, "High Points" CLOB, "High Rebounds" CLOB, "High Assists" CLOB, "Record" CLOB)
Name the record for march 16
SELECT "Record" FROM table_25459 WHERE "Date" = 'March 16'
SELECT "Record" FROM "table_25459" WHERE "Date" = 'March 16'
0.058594
CREATE TABLE table_72302 ("Election" FLOAT, "# of candidates nominated" FLOAT, "# of seats won" FLOAT, "# of total votes" FLOAT, "% of popular vote" CLOB)
What year was the election when the # of seats won was 65?
SELECT "Election" FROM table_72302 WHERE "# of seats won" = '65'
SELECT "Election" FROM "table_72302" WHERE "# of seats won" = '65'
0.064453
CREATE TABLE table_72069 ("Player" CLOB, "No." CLOB, "Nationality" CLOB, "Position" CLOB, "Years in Toronto" CLOB, "School/Club Team" CLOB)
What school did player number 21 play for?
SELECT "School/Club Team" FROM table_72069 WHERE "No." = '21'
SELECT "School/Club Team" FROM "table_72069" WHERE "No." = '21'
0.061523
CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE d_icd_diagnoses (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 chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_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 cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB)
what were the top five medicines that were frequently prescribed?
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 5
WITH "t1" AS (SELECT "prescriptions"."drug", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "prescriptions" GROUP BY "prescriptions"."drug") SELECT "t1"."drug" FROM "t1" "t1" WHERE "t1"."c1" <= 5
0.199219
CREATE TABLE table_name_19 (result VARCHAR2, round VARCHAR2, opponent VARCHAR2)
What resulted after 4 rounds with Ed Mahone?
SELECT result FROM table_name_19 WHERE round > 4 AND opponent = "ed mahone"
SELECT "result" FROM "table_name_19" WHERE "ed mahone" = "opponent" AND "round" > 4
0.081055
CREATE TABLE table_197638_6 (player VARCHAR2, us_open VARCHAR2)
Who won the US Open in 1937?
SELECT player FROM table_197638_6 WHERE us_open = 1937
SELECT "player" FROM "table_197638_6" WHERE "us_open" = 1937
0.058594
CREATE TABLE table_name_70 (year NUMBER, movie VARCHAR2, awards VARCHAR2)
In what year was the movie 8 women up for a C sar Award?
SELECT MIN(year) FROM table_name_70 WHERE movie = "8 women" AND awards = "césar award"
SELECT MIN("year") FROM "table_name_70" WHERE "8 women" = "movie" AND "awards" = "césar award"
0.091797
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 time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) 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 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 dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE days (days_code VARCHAR2, day_name 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 time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE code_description (code VARCHAR2, description CLOB) 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 city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) 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 flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) 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 date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2)
show me flights to SAN FRANCISCO arriving before 100
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'SAN FRANCISCO' AND flight.arrival_time < 100 AND flight.to_airport = airport_service.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" JOIN "city" ON "airport_service"."city_code" = "city"."city_code" AND "city"."city_name" = 'SAN FRANCISCO' JOIN "flight" ON "airport_service"."airport_code" = "flight"."to_airport" AND "flight"."arrival_time" < 100
0.267578
CREATE TABLE table_name_28 (trans_1 VARCHAR2, total_time VARCHAR2)
How long did the trans 1 take when 2:00:40.20 is the total time?
SELECT trans_1 FROM table_name_28 WHERE total_time = "2:00:40.20"
SELECT "trans_1" FROM "table_name_28" WHERE "2:00:40.20" = "total_time"
0.069336
CREATE TABLE table_1242 ("Year" FLOAT, "Division" FLOAT, "League" CLOB, "Regular Season" CLOB, "Playoffs" CLOB, "Open Cup" CLOB)
What was the regular season from year 2012?
SELECT "Regular Season" FROM table_1242 WHERE "Year" = '2012'
SELECT "Regular Season" FROM "table_1242" WHERE "Year" = '2012'
0.061523
CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) 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 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 medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB)
where were the top three most frequent procedures in the patients of age 40s until 4 years ago?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 3
WITH "_u_0" AS (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."age" <= 49 AND "patient"."age" >= 40 GROUP BY "patientunitstayid"), "t1" AS (SELECT "treatment"."treatmentname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "treatment" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "treatment"."patientunitstayid" WHERE DATETIME("treatment"."treatmenttime") <= DATETIME(CURRENT_TIME(), '-4 year') AND NOT "_u_0"."" IS NULL GROUP BY "treatment"."treatmentname") SELECT "t1"."treatmentname" FROM "t1" "t1" WHERE "t1"."c1" <= 3
0.53418
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 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 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 ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) 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 ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) 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 TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskResultTypes (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 PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId 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 Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB)
List-of-X popularity by tag usage.
SELECT t.TagName, COUNT(*) AS NumberOfQuestions FROM Posts AS p INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE PostTypeId = 1 AND t.TagName IN ('suitest', 'doh', 'lbrtw-ut', 'jsunit', 'enhance-js', 'qunit', 'rhunit', 'crosscheck', 'j3unit', 'mocha', 'intern', 'jsnunit', 'yui-test', 'jsspec', 'unittesting', 'jspec', 'jasmine', 'screw-unit', 'test.simple', 'test.more', 'testcase', 'testit', 'jsunittest', 'jstest', 'jstest.net', 'jsunity', 'rhinounit', 'jasunit', 'fireunit', 'js-test-driver', 'js-test-runner', 'sinon.js', 'soatest', 'vows', 'nodeunit', 'tyrtle', 'wru', 'buster.js') GROUP BY t.TagName
SELECT "t"."TagName", COUNT(*) AS "NumberOfQuestions" FROM "Posts" "p" JOIN "PostTags" "pt" ON "p"."Id" = "pt"."PostId" JOIN "Tags" "t" ON "pt"."TagId" = "t"."Id" AND "t"."TagName" IN ('suitest', 'doh', 'lbrtw-ut', 'jsunit', 'enhance-js', 'qunit', 'rhunit', 'crosscheck', 'j3unit', 'mocha', 'intern', 'jsnunit', 'yui-test', 'jsspec', 'unittesting', 'jspec', 'jasmine', 'screw-unit', 'test.simple', 'test.more', 'testcase', 'testit', 'jsunittest', 'jstest', 'jstest.net', 'jsunity', 'rhinounit', 'jasunit', 'fireunit', 'js-test-driver', 'js-test-runner', 'sinon.js', 'soatest', 'vows', 'nodeunit', 'tyrtle', 'wru', 'buster.js') WHERE "PostTypeId" = 1 GROUP BY "t"."TagName"
0.65625
CREATE TABLE table_name_14 (election VARCHAR2)
Which 2nd Party has a Election of 1857?
SELECT 2 AS nd_party FROM table_name_14 WHERE election = "1857"
SELECT 2 AS "nd_party" FROM "table_name_14" WHERE "1857" = "election"
0.067383
CREATE TABLE Apartment_Facilities (apt_id NUMBER, facility_code 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 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) CREATE TABLE Guests (guest_id NUMBER, gender_code CHAR, guest_first_name VARCHAR2, guest_last_name VARCHAR2, date_of_birth DATETIME) 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)
Show the number of apartment bookings in each weekday and bin booking start date by weekday with a bar chart, and I want to show in desc by the Y.
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings ORDER BY COUNT(booking_start_date) DESC
SELECT "booking_start_date", COUNT("booking_start_date") FROM "Apartment_Bookings" ORDER BY COUNT("booking_start_date") DESC
0.121094
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 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 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 do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of last_name and department_id , list by the total number from low to high.
SELECT LAST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID
SELECT "LAST_NAME", "DEPARTMENT_ID" FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100) ORDER BY "DEPARTMENT_ID"
0.195313
CREATE TABLE table_59225 ("Opposing Teams" CLOB, "Against" FLOAT, "Date" CLOB, "Venue" CLOB, "Status" CLOB)
What is Against, when Venue is 'Twickenham , London', and when Date is '04/03/2000'?
SELECT "Against" FROM table_59225 WHERE "Venue" = 'twickenham , london' AND "Date" = '04/03/2000'
SELECT "Against" FROM "table_59225" WHERE "Date" = '04/03/2000' AND "Venue" = 'twickenham , london'
0.09668
CREATE TABLE table_67270 ("Date" CLOB, "Visitor" CLOB, "Score" CLOB, "Home" CLOB, "Decision" CLOB, "Attendance" FLOAT, "Record" CLOB)
What is the record for November 26, with the decision made by Prusek?
SELECT "Record" FROM table_67270 WHERE "Decision" = 'prusek' AND "Date" = 'november 26'
SELECT "Record" FROM "table_67270" WHERE "Date" = 'november 26' AND "Decision" = 'prusek'
0.086914
CREATE TABLE table_name_96 (high_assists VARCHAR2, record VARCHAR2)
Which High assists have a Record of 4-2?
SELECT high_assists FROM table_name_96 WHERE record = "4-2"
SELECT "high_assists" FROM "table_name_96" WHERE "4-2" = "record"
0.063477
CREATE TABLE table_55696 ("D 41" CLOB, "D 42" CLOB, "D 43" CLOB, "D 44" CLOB, "D 45" CLOB, "D 46" CLOB, "D 47" CLOB, "R 53" CLOB, "R 52" CLOB, "R 51" CLOB)
I want the D 46 which has a D 44 of r 17
SELECT "D 46" FROM table_55696 WHERE "D 44" = 'r 17'
SELECT "D 46" FROM "table_55696" WHERE "D 44" = 'r 17'
0.052734
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) 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)
count the number of patients whose admission location is trsf within this facility and drug code is ketr30i?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.formulary_drug_cd = "KETR30I"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "KETR30I" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "TRSF WITHIN THIS FACILITY" = "demographic"."admission_location"
0.260742
CREATE TABLE table_name_22 (year NUMBER, opponent VARCHAR2)
what year was the opponent caroline garcia?
SELECT SUM(year) FROM table_name_22 WHERE opponent = "caroline garcia"
SELECT SUM("year") FROM "table_name_22" WHERE "caroline garcia" = "opponent"
0.074219
CREATE TABLE table_11545282_7 (no VARCHAR2, years_for_jazz VARCHAR2)
How many players only played for the Jazz in only 2010?
SELECT COUNT(no) FROM table_11545282_7 WHERE years_for_jazz = "2010"
SELECT COUNT("no") FROM "table_11545282_7" WHERE "2010" = "years_for_jazz"
0.072266
CREATE TABLE table_23143607_1 (television_channels VARCHAR2, radio_stations VARCHAR2)
What is the total number of television channels when one of the radio stations is onda madrid?
SELECT COUNT(television_channels) FROM table_23143607_1 WHERE radio_stations = "Onda Madrid"
SELECT COUNT("television_channels") FROM "table_23143607_1" WHERE "Onda Madrid" = "radio_stations"
0.095703
CREATE TABLE table_80048 ("Year" FLOAT, "Entrant" CLOB, "Chassis" CLOB, "Engine" CLOB, "Points" FLOAT)
Which of the biggest points numbers had a year more recent than 1953?
SELECT MAX("Points") FROM table_80048 WHERE "Year" > '1953'
SELECT MAX("Points") FROM "table_80048" WHERE "Year" > '1953'
0.05957
CREATE TABLE table_name_42 (pick VARCHAR2, player VARCHAR2)
What was the pick number when mark hayes was drafted?
SELECT pick FROM table_name_42 WHERE player = "mark hayes"
SELECT "pick" FROM "table_name_42" WHERE "mark hayes" = "player"
0.0625
CREATE TABLE table_name_51 (frequency_mhz NUMBER, call_sign VARCHAR2)
What is K236AM's lowest frequency in MHz?
SELECT MIN(frequency_mhz) FROM table_name_51 WHERE call_sign = "k236am"
SELECT MIN("frequency_mhz") FROM "table_name_51" WHERE "call_sign" = "k236am"
0.075195
CREATE TABLE table_53381 ("Rider" CLOB, "Horse" CLOB, "Time ( s ) " CLOB, "Faults" CLOB, "Total time ( s ) " CLOB, "Points" FLOAT)
What is the average amount of points when the time (s) is 81.78?
SELECT AVG("Points") FROM table_53381 WHERE "Time ( s )" = '81.78'
SELECT AVG("Points") FROM "table_53381" WHERE "Time ( s )" = '81.78'
0.066406
CREATE TABLE table_1558 ("Team" CLOB, "Average" CLOB, "Points" FLOAT, "Played" FLOAT, "1991-92" CLOB, "1992-93" CLOB, "1993-94" FLOAT)
Name the average is 1991-92 is 39
SELECT "Average" FROM table_1558 WHERE "1991-92" = '39'
SELECT "Average" FROM "table_1558" WHERE "1991-92" = '39'
0.055664
CREATE TABLE table_18220 ("District" CLOB, "Incumbent" CLOB, "Party" CLOB, "Elected" FLOAT, "Status" CLOB, "Opponent" CLOB)
What are the locations where the year of election is 1980?
SELECT "District" FROM table_18220 WHERE "Elected" = '1980'
SELECT "District" FROM "table_18220" WHERE "Elected" = '1980'
0.05957
CREATE TABLE Ref_Calendar (Calendar_Date DATETIME, Day_Number NUMBER) CREATE TABLE Documents_to_be_Destroyed (Document_ID NUMBER, Destruction_Authorised_by_Employee_ID NUMBER, Destroyed_by_Employee_ID NUMBER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR2) CREATE TABLE Employees (Employee_ID NUMBER, Role_Code CHAR, Employee_Name VARCHAR2, Gender_MFU CHAR, Date_of_Birth DATETIME, Other_Details VARCHAR2) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR2, Document_Type_Description VARCHAR2) CREATE TABLE Ref_Locations (Location_Code CHAR, Location_Name VARCHAR2, Location_Description VARCHAR2) CREATE TABLE All_Documents (Document_ID NUMBER, Date_Stored DATETIME, Document_Type_Code CHAR, Document_Name CHAR, Document_Description CHAR, Other_Details VARCHAR2) CREATE TABLE Roles (Role_Code CHAR, Role_Name VARCHAR2, Role_Description VARCHAR2) CREATE TABLE Document_Locations (Document_ID NUMBER, Location_Code CHAR, Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME)
How many documents are stored? Bin the store date by weekday in a bar chart, and I want to show in desc by the y-axis.
SELECT Date_Stored, COUNT(Date_Stored) FROM All_Documents AS T1 JOIN Ref_Calendar AS T2 ON T1.Date_Stored = T2.Calendar_Date ORDER BY COUNT(Date_Stored) DESC
SELECT "Date_Stored", COUNT("Date_Stored") FROM "All_Documents" "T1" JOIN "Ref_Calendar" "T2" ON "T1"."Date_Stored" = "T2"."Calendar_Date" ORDER BY COUNT("Date_Stored") DESC
0.168945
CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) 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 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 TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) 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 PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress 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 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 Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE VoteTypes (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 ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) 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)
Quality of questions For an answer.
SELECT AVG(CAST(q.Score AS FLOAT(15, 5))) FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId WHERE a.OwnerUserId = '##UserId##'
SELECT AVG(CAST("q"."Score" AS FLOAT(15, 5))) FROM "Posts" "q" JOIN "Posts" "a" ON "a"."OwnerUserId" = '##UserId##' AND "a"."ParentId" = "q"."Id"
0.141602
CREATE TABLE table_name_57 (rank NUMBER, rider VARCHAR2)
What was Andrew Neill's rank?
SELECT SUM(rank) FROM table_name_57 WHERE rider = "andrew neill"
SELECT SUM("rank") FROM "table_name_57" WHERE "andrew neill" = "rider"
0.068359
CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) 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 ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE ReviewTaskTypes (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 Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) 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 CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE VoteTypes (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 PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE ReviewTaskStates (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 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 PostHistoryTypes (Id NUMBER, Name CLOB)
Which high reputation users have we lost?.
SELECT u.Id AS "user_link", u.Reputation, u.LastAccessDate FROM Users AS u WHERE Reputation >= 10000 AND LastAccessDate < '20200901'
SELECT "u"."Id" AS "user_link", "u"."Reputation", "u"."LastAccessDate" FROM "Users" "u" WHERE "LastAccessDate" < '20200901' AND "Reputation" >= 10000
0.145508
CREATE TABLE table_40866 ("Played" CLOB, "Wins" CLOB, "Losses" CLOB, "Tied" CLOB, "Win %" CLOB)
Which win has 38.67% wins?
SELECT "Wins" FROM table_40866 WHERE "Win %" = '38.67%'
SELECT "Wins" FROM "table_40866" WHERE "Win %" = '38.67%'
0.055664
CREATE TABLE table_name_89 (wins NUMBER, poles VARCHAR2, series VARCHAR2, season VARCHAR2)
WHAT IS THE HIGHEST WINS WITH A SERIES OF BRITISH FORMULA THREE, SEASON 2005, POLES SMALLER THAN 0?
SELECT MAX(wins) FROM table_name_89 WHERE series = "british formula three" AND season = "2005" AND poles < 0
SELECT MAX("wins") FROM "table_name_89" WHERE "2005" = "season" AND "british formula three" = "series" AND "poles" < 0
0.115234
CREATE TABLE station (id NUMBER, network_name CLOB, services CLOB, local_authority CLOB) CREATE TABLE train (id NUMBER, train_number NUMBER, name CLOB, origin CLOB, destination CLOB, time CLOB, interval CLOB) CREATE TABLE route (train_id NUMBER, station_id NUMBER) CREATE TABLE weekly_weather (station_id NUMBER, day_of_week CLOB, high_temperature NUMBER, low_temperature NUMBER, precipitation FLOAT, wind_speed_mph NUMBER)
Give me the times and numbers of all trains that go to Chennai.
SELECT time, train_number FROM train WHERE destination = 'Chennai'
SELECT "time", "train_number" FROM "train" WHERE "destination" = 'Chennai'
0.072266
CREATE TABLE table_name_35 (fcc_info VARCHAR2, erp_w VARCHAR2, call_sign VARCHAR2)
Which FCC info has a ERP W smaller than 222, and a Call sign of k297ai?
SELECT fcc_info FROM table_name_35 WHERE erp_w < 222 AND call_sign = "k297ai"
SELECT "fcc_info" FROM "table_name_35" WHERE "call_sign" = "k297ai" AND "erp_w" < 222
0.083008
CREATE TABLE table_74133 ("Game" FLOAT, "November" FLOAT, "Opponent" CLOB, "Score" CLOB, "Location/Attendance" CLOB, "Record" CLOB, "Points" FLOAT)
What is every record for game 13?
SELECT "Record" FROM table_74133 WHERE "Game" = '13'
SELECT "Record" FROM "table_74133" WHERE "Game" = '13'
0.052734
CREATE TABLE table_28707 ("Rank" FLOAT, "Athlete" CLOB, "Country" CLOB, "Distance ( metres ) " CLOB, "Points" CLOB, "Adjusted Points" FLOAT)
What is the country(s) where the points equal 723.075?
SELECT "Country" FROM table_28707 WHERE "Points" = '723.075'
SELECT "Country" FROM "table_28707" WHERE "Points" = '723.075'
0.060547
CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2) CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER) CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) CREATE TABLE 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 those employees who was hired before 2002-06-21, show me the trend about employee_id over hire_date with a line chart.
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21'
SELECT "HIRE_DATE", "EMPLOYEE_ID" FROM "employees" WHERE "HIRE_DATE" < '2002-06-21'
0.081055
CREATE TABLE table_51932 ("Driver" CLOB, "Constructor" CLOB, "Laps" FLOAT, "Time/Retired" CLOB, "Grid" FLOAT)
what is the lowest grid when the laps is more than 7 and the driver is rubens barrichello?
SELECT MIN("Grid") FROM table_51932 WHERE "Laps" > '7' AND "Driver" = 'rubens barrichello'
SELECT MIN("Grid") FROM "table_51932" WHERE "Driver" = 'rubens barrichello' AND "Laps" > '7'
0.089844
CREATE TABLE table_train_229 ("id" NUMBER, "hemoglobin_a1c_hba1c" FLOAT, "active_metabolic" BOOLEAN, "body_weight" FLOAT, "hba1c" FLOAT, "age" FLOAT, "NOUSE" FLOAT)
hba1c between 7 and 9 %
SELECT * FROM table_train_229 WHERE hba1c >= 7 AND hemoglobin_a1c_hba1c <= 9
SELECT * FROM "table_train_229" WHERE "hba1c" >= 7 AND "hemoglobin_a1c_hba1c" <= 9
0.080078
CREATE TABLE table_name_78 (dipole_moment___d__ VARCHAR2, solvent VARCHAR2)
What's the dipole moment of ethyl acetate (etoac)?
SELECT dipole_moment___d__ FROM table_name_78 WHERE solvent = "ethyl acetate (etoac)"
SELECT "dipole_moment___d__" FROM "table_name_78" WHERE "ethyl acetate (etoac)" = "solvent"
0.088867
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 Staff_Roles (role_code VARCHAR2, role_description 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 Tasks (task_id NUMBER, project_id NUMBER, task_details VARCHAR2, "eg Agree Objectives" 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_Outcomes (project_id NUMBER, outcome_code VARCHAR2, outcome_details VARCHAR2) CREATE TABLE Organisation_Types (organisation_type VARCHAR2, organisation_type_description VARCHAR2) CREATE TABLE Research_Staff (staff_id NUMBER, employer_organisation_id NUMBER, staff_details VARCHAR2) 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 Organisations (organisation_id NUMBER, organisation_type VARCHAR2, organisation_details VARCHAR2) CREATE TABLE Research_Outcomes (outcome_code VARCHAR2, outcome_description VARCHAR2)
List the description of the outcomes for all projects, and count them by a bar chart, and display in descending by the bars.
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 ORDER BY outcome_description DESC
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" ORDER BY "outcome_description" DESC
0.223633
CREATE TABLE Department_Stores (dept_store_id NUMBER, dept_store_chain_id NUMBER, store_name VARCHAR2, store_address VARCHAR2, store_phone VARCHAR2, store_email VARCHAR2) CREATE TABLE Customer_Orders (order_id NUMBER, customer_id NUMBER, order_status_code VARCHAR2, order_date DATETIME) CREATE TABLE Order_Items (order_item_id NUMBER, order_id NUMBER, product_id NUMBER) CREATE TABLE Addresses (address_id NUMBER, address_details VARCHAR2) CREATE TABLE Staff (staff_id NUMBER, staff_gender VARCHAR2, staff_name VARCHAR2) CREATE TABLE Department_Store_Chain (dept_store_chain_id NUMBER, dept_store_chain_name VARCHAR2) CREATE TABLE Suppliers (supplier_id NUMBER, supplier_name VARCHAR2, supplier_phone VARCHAR2) CREATE TABLE Supplier_Addresses (supplier_id NUMBER, address_id NUMBER, date_from DATETIME, date_to DATETIME) CREATE TABLE Departments (department_id NUMBER, dept_store_id NUMBER, department_name VARCHAR2) CREATE TABLE Customer_Addresses (customer_id NUMBER, address_id NUMBER, date_from DATETIME, date_to DATETIME) CREATE TABLE Staff_Department_Assignments (staff_id NUMBER, department_id NUMBER, date_assigned_from DATETIME, job_title_code VARCHAR2, date_assigned_to DATETIME) CREATE TABLE Customers (customer_id NUMBER, payment_method_code VARCHAR2, customer_code VARCHAR2, customer_name VARCHAR2, customer_address VARCHAR2, customer_phone VARCHAR2, customer_email VARCHAR2) CREATE TABLE Products (product_id NUMBER, product_type_code VARCHAR2, product_name VARCHAR2, product_price NUMBER) CREATE TABLE Product_Suppliers (product_id NUMBER, supplier_id NUMBER, date_supplied_from DATETIME, date_supplied_to DATETIME, total_amount_purchased VARCHAR2, total_value_purchased NUMBER)
Show the relationship between minimum product price and maximum product price and group by product type code in a group scatter chart.
SELECT MAX(product_price), MIN(product_price) FROM Products GROUP BY product_type_code
SELECT MAX("product_price"), MIN("product_price") FROM "Products" GROUP BY "product_type_code"
0.091797
CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) 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 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 days (days_code VARCHAR2, day_name VARCHAR2) 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 equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE month (month_number NUMBER, month_name CLOB) 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 airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant 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 code_description (code VARCHAR2, 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 ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) 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 time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2)
in economy class from DALLAS to BALTIMORE arriving 7 7 i'd like to know what 's the cheapest ticket possible
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE ((((((flight.arrival_time < flight.departure_time) AND DATE_DAY_1.day_number = 6 AND DATE_DAY_1.month_number = 7 AND DATE_DAY_1.year = 1991 AND DAYS_1.day_name = DATE_DAY_1.day_name AND flight.flight_days = DAYS_1.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND DATE_DAY_0.day_number = 6 AND DATE_DAY_0.month_number = 7 AND DATE_DAY_0.year = 1991 AND DAYS_0.day_name = DATE_DAY_0.day_name AND FARE_BASIS_1.basis_days = DAYS_0.days_code AND fare.fare_basis_code = FARE_BASIS_1.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) OR ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND DATE_DAY_1.day_number = 7 AND DATE_DAY_1.month_number = 7 AND DATE_DAY_1.year = 1991 AND DAYS_1.day_name = DATE_DAY_1.day_name AND flight.flight_days = DAYS_1.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND DATE_DAY_0.day_number = 7 AND DATE_DAY_0.month_number = 7 AND DATE_DAY_0.year = 1991 AND DAYS_0.day_name = DATE_DAY_0.day_name AND FARE_BASIS_1.basis_days = DAYS_0.days_code AND fare.fare_basis_code = FARE_BASIS_1.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code)) AND FARE_BASIS_0.economy = 'YES' AND fare.fare_basis_code = FARE_BASIS_0.fare_basis_code) AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, date_day AS DATE_DAYalias2, date_day AS DATE_DAYalias3, days AS DAYSalias2, days AS DAYSalias3, fare AS FAREalias1, fare_basis AS FARE_BASISalias2, fare_basis AS FARE_BASISalias3, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE (((((FLIGHTalias1.arrival_time < FLIGHTalias1.departure_time) AND DATE_DAYalias3.day_number = 6 AND DATE_DAYalias3.month_number = 7 AND DATE_DAYalias3.year = 1991 AND DAYSalias3.day_name = DATE_DAYalias3.day_name AND FLIGHTalias1.flight_days = DAYSalias3.days_code) AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'BALTIMORE' AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'DALLAS' AND DATE_DAYalias2.day_number = 6 AND DATE_DAYalias2.month_number = 7 AND DATE_DAYalias2.year = 1991 AND DAYSalias2.day_name = DATE_DAYalias2.day_name AND FARE_BASISalias3.basis_days = DAYSalias2.days_code AND FAREalias1.fare_basis_code = FARE_BASISalias3.fare_basis_code AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code) OR ((CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'BALTIMORE' AND DATE_DAYalias3.day_number = 7 AND DATE_DAYalias3.month_number = 7 AND DATE_DAYalias3.year = 1991 AND DAYSalias3.day_name = DATE_DAYalias3.day_name AND FLIGHTalias1.flight_days = DAYSalias3.days_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'DALLAS' AND DATE_DAYalias2.day_number = 7 AND DATE_DAYalias2.month_number = 7 AND DATE_DAYalias2.year = 1991 AND DAYSalias2.day_name = DATE_DAYalias2.day_name AND FARE_BASISalias3.basis_days = DAYSalias2.days_code AND FAREalias1.fare_basis_code = FARE_BASISalias3.fare_basis_code AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code)) AND FARE_BASISalias2.economy = 'YES' AND FAREalias1.fare_basis_code = FARE_BASISalias2.fare_basis_code)
WITH "_u_0" AS (SELECT MIN("FAREalias1"."one_direction_cost") FROM "airport_service" "AIRPORT_SERVICEalias2" CROSS JOIN "city" "CITYalias2" CROSS JOIN "city" "CITYalias3" CROSS JOIN "date_day" "DATE_DAYalias2" CROSS JOIN "date_day" "DATE_DAYalias3" CROSS JOIN "days" "DAYSalias2" CROSS JOIN "days" "DAYSalias3" CROSS JOIN "fare_basis" "FARE_BASISalias3" CROSS JOIN "fare" "FAREalias1" CROSS JOIN "flight_fare" "FLIGHT_FAREalias1" CROSS JOIN "flight" "FLIGHTalias1" JOIN "airport_service" "AIRPORT_SERVICEalias3" ON ("AIRPORT_SERVICEalias2"."airport_code" = "FLIGHTalias1"."from_airport" AND "AIRPORT_SERVICEalias2"."city_code" = "CITYalias2"."city_code" AND "AIRPORT_SERVICEalias3"."airport_code" = "FLIGHTalias1"."to_airport" AND "AIRPORT_SERVICEalias3"."city_code" = "CITYalias3"."city_code" AND "CITYalias2"."city_name" = 'DALLAS' AND "CITYalias3"."city_name" = 'BALTIMORE' AND "DATE_DAYalias2"."day_name" = "DAYSalias2"."day_name" AND "DATE_DAYalias2"."day_number" = 6 AND "DATE_DAYalias2"."month_number" = 7 AND "DATE_DAYalias2"."year" = 1991 AND "DATE_DAYalias3"."day_name" = "DAYSalias3"."day_name" AND "DATE_DAYalias3"."day_number" = 6 AND "DATE_DAYalias3"."month_number" = 7 AND "DATE_DAYalias3"."year" = 1991 AND "DAYSalias2"."days_code" = "FARE_BASISalias3"."basis_days" AND "DAYSalias3"."days_code" = "FLIGHTalias1"."flight_days" AND "FARE_BASISalias3"."fare_basis_code" = "FAREalias1"."fare_basis_code" AND "FAREalias1"."fare_id" = "FLIGHT_FAREalias1"."fare_id" AND "FLIGHT_FAREalias1"."flight_id" = "FLIGHTalias1"."flight_id" AND "FLIGHTalias1"."arrival_time" < "FLIGHTalias1"."departure_time") OR ("AIRPORT_SERVICEalias2"."airport_code" = "FLIGHTalias1"."from_airport" AND "AIRPORT_SERVICEalias2"."city_code" = "CITYalias2"."city_code" AND "AIRPORT_SERVICEalias3"."airport_code" = "FLIGHTalias1"."to_airport" AND "AIRPORT_SERVICEalias3"."city_code" = "CITYalias3"."city_code" AND "CITYalias2"."city_name" = 'DALLAS' AND "CITYalias3"."city_name" = 'BALTIMORE' AND "DATE_DAYalias2"."day_name" = "DAYSalias2"."day_name" AND "DATE_DAYalias2"."day_number" = 7 AND "DATE_DAYalias2"."month_number" = 7 AND "DATE_DAYalias2"."year" = 1991 AND "DATE_DAYalias3"."day_name" = "DAYSalias3"."day_name" AND "DATE_DAYalias3"."day_number" = 7 AND "DATE_DAYalias3"."month_number" = 7 AND "DATE_DAYalias3"."year" = 1991 AND "DAYSalias2"."days_code" = "FARE_BASISalias3"."basis_days" AND "DAYSalias3"."days_code" = "FLIGHTalias1"."flight_days" AND "FARE_BASISalias3"."fare_basis_code" = "FAREalias1"."fare_basis_code" AND "FAREalias1"."fare_id" = "FLIGHT_FAREalias1"."fare_id" AND "FLIGHT_FAREalias1"."flight_id" = "FLIGHTalias1"."flight_id") JOIN "fare_basis" "FARE_BASISalias2" ON "FARE_BASISalias2"."economy" = 'YES' AND "FARE_BASISalias2"."fare_basis_code" = "FAREalias1"."fare_basis_code") SELECT DISTINCT "fare"."fare_id" FROM "airport_service" "AIRPORT_SERVICE_0" CROSS JOIN "city" "CITY_0" CROSS JOIN "city" "CITY_1" CROSS JOIN "date_day" "DATE_DAY_0" CROSS JOIN "date_day" "DATE_DAY_1" CROSS JOIN "days" "DAYS_0" CROSS JOIN "days" "DAYS_1" CROSS JOIN "fare_basis" "FARE_BASIS_1" CROSS JOIN "fare" CROSS JOIN "flight" CROSS JOIN "flight_fare" JOIN "airport_service" "AIRPORT_SERVICE_1" ON ("AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" AND "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_0"."city_name" = 'DALLAS' AND "CITY_1"."city_name" = 'BALTIMORE' AND "DATE_DAY_0"."day_name" = "DAYS_0"."day_name" AND "DATE_DAY_0"."day_number" = 6 AND "DATE_DAY_0"."month_number" = 7 AND "DATE_DAY_0"."year" = 1991 AND "DATE_DAY_1"."day_name" = "DAYS_1"."day_name" AND "DATE_DAY_1"."day_number" = 6 AND "DATE_DAY_1"."month_number" = 7 AND "DATE_DAY_1"."year" = 1991 AND "DAYS_0"."days_code" = "FARE_BASIS_1"."basis_days" AND "DAYS_1"."days_code" = "flight"."flight_days" AND "FARE_BASIS_1"."fare_basis_code" = "fare"."fare_basis_code" AND "fare"."fare_id" = "flight_fare"."fare_id" AND "flight"."arrival_time" < "flight"."departure_time" AND "flight"."flight_id" = "flight_fare"."flight_id") OR ("AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" AND "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_0"."city_name" = 'DALLAS' AND "CITY_1"."city_name" = 'BALTIMORE' AND "DATE_DAY_0"."day_name" = "DAYS_0"."day_name" AND "DATE_DAY_0"."day_number" = 7 AND "DATE_DAY_0"."month_number" = 7 AND "DATE_DAY_0"."year" = 1991 AND "DATE_DAY_1"."day_name" = "DAYS_1"."day_name" AND "DATE_DAY_1"."day_number" = 7 AND "DATE_DAY_1"."month_number" = 7 AND "DATE_DAY_1"."year" = 1991 AND "DAYS_0"."days_code" = "FARE_BASIS_1"."basis_days" AND "DAYS_1"."days_code" = "flight"."flight_days" AND "FARE_BASIS_1"."fare_basis_code" = "fare"."fare_basis_code" AND "fare"."fare_id" = "flight_fare"."fare_id" AND "flight"."flight_id" = "flight_fare"."flight_id") JOIN "fare_basis" "FARE_BASIS_0" ON "FARE_BASIS_0"."economy" = 'YES' AND "FARE_BASIS_0"."fare_basis_code" = "fare"."fare_basis_code" JOIN "_u_0" "_u_0" ON "_u_0"."" = "fare"."one_direction_cost"
5.102539
CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 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 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) 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 outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) 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 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 d_labitems (row_id NUMBER, itemid NUMBER, label CLOB)
when was the first time patient 2425 had a lab test, until 35 months ago?
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2425) AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-35 month') ORDER BY labevents.charttime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 2425 GROUP BY "hadm_id") SELECT "labevents"."charttime" FROM "labevents" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "labevents"."hadm_id" WHERE DATETIME("labevents"."charttime") <= DATETIME(CURRENT_TIME(), '-35 month') AND NOT "_u_0"."" IS NULL ORDER BY "labevents"."charttime" FETCH FIRST 1 ROWS ONLY
0.385742
CREATE TABLE table_76666 ("Film" CLOB, "Opening" CLOB, "Budget" CLOB, "Domestic" CLOB, "Worldwide" CLOB)
WHAT IS THE OPENING WITH A WORLDWIDE NUMBER OF $559,852,396?
SELECT "Opening" FROM table_76666 WHERE "Worldwide" = '$559,852,396'
SELECT "Opening" FROM "table_76666" WHERE "Worldwide" = '$559,852,396'
0.068359
CREATE TABLE table_29077342_19 (mountains_classification VARCHAR2, team_classification VARCHAR2, general_classification VARCHAR2)
Name the mountains classification for rabobank and damiano cunego
SELECT mountains_classification FROM table_29077342_19 WHERE team_classification = "Rabobank" AND general_classification = "Damiano Cunego"
SELECT "mountains_classification" FROM "table_29077342_19" WHERE "Damiano Cunego" = "general_classification" AND "Rabobank" = "team_classification"
0.143555
CREATE TABLE table_42895 ("Year" FLOAT, "Award" CLOB, "Category" CLOB, "Recipient" CLOB, "Result" CLOB)
Which award show nominated Cole Sprouse for the Favorite TV Actor category?
SELECT "Award" FROM table_42895 WHERE "Category" = 'favorite tv actor' AND "Recipient" = 'cole sprouse'
SELECT "Award" FROM "table_42895" WHERE "Category" = 'favorite tv actor' AND "Recipient" = 'cole sprouse'
0.102539
CREATE TABLE table_name_47 (valley_vista VARCHAR2, willow_canyon VARCHAR2)
What Valley Vista has a Willow Canyon of 2169?
SELECT valley_vista FROM table_name_47 WHERE willow_canyon = "2169"
SELECT "valley_vista" FROM "table_name_47" WHERE "2169" = "willow_canyon"
0.071289
CREATE TABLE table_name_76 (away_team VARCHAR2, home_team VARCHAR2)
When fitzroy was the home team, how much did the away team score?
SELECT away_team AS score FROM table_name_76 WHERE home_team = "fitzroy"
SELECT "away_team" AS "score" FROM "table_name_76" WHERE "fitzroy" = "home_team"
0.078125
CREATE TABLE Behavior_Incident (incident_id NUMBER, incident_type_code VARCHAR2, student_id NUMBER, date_incident_start DATETIME, date_incident_end DATETIME, incident_summary VARCHAR2, recommendations VARCHAR2, other_details VARCHAR2) CREATE TABLE Ref_Detention_Type (detention_type_code VARCHAR2, detention_type_description VARCHAR2) CREATE TABLE Students_in_Detention (student_id NUMBER, detention_id NUMBER, incident_id NUMBER) CREATE TABLE Students (student_id NUMBER, address_id NUMBER, first_name VARCHAR2, middle_name VARCHAR2, last_name VARCHAR2, cell_mobile_number VARCHAR2, email_address VARCHAR2, date_first_rental DATETIME, date_left_university DATETIME, other_student_details VARCHAR2) CREATE TABLE Assessment_Notes (notes_id NUMBER, student_id NUMBER, teacher_id NUMBER, date_of_notes DATETIME, text_of_notes VARCHAR2, other_details VARCHAR2) CREATE TABLE Teachers (teacher_id NUMBER, address_id NUMBER, first_name VARCHAR2, middle_name VARCHAR2, last_name VARCHAR2, gender VARCHAR2, cell_mobile_number VARCHAR2, email_address VARCHAR2, other_details VARCHAR2) CREATE TABLE Student_Addresses (student_id NUMBER, address_id NUMBER, date_address_from DATETIME, date_address_to DATETIME, monthly_rental NUMBER, other_details VARCHAR2) CREATE TABLE Ref_Incident_Type (incident_type_code VARCHAR2, incident_type_description VARCHAR2) CREATE TABLE Detention (detention_id NUMBER, detention_type_code VARCHAR2, teacher_id NUMBER, datetime_detention_start DATETIME, datetime_detention_end DATETIME, detention_summary VARCHAR2, other_details VARCHAR2) CREATE TABLE Addresses (address_id NUMBER, line_1 VARCHAR2, line_2 VARCHAR2, line_3 VARCHAR2, city VARCHAR2, zip_postcode VARCHAR2, state_province_county VARCHAR2, country VARCHAR2, other_address_details VARCHAR2) CREATE TABLE Ref_Address_Types (address_type_code VARCHAR2, address_type_description VARCHAR2)
A line chart shows the change of monthly_rental over date_address_from
SELECT date_address_from, monthly_rental FROM Student_Addresses ORDER BY monthly_rental DESC
SELECT "date_address_from", "monthly_rental" FROM "Student_Addresses" ORDER BY "monthly_rental" DESC
0.097656
CREATE TABLE table_76169 ("Year" CLOB, "Winner" CLOB, "Points" FLOAT, "Playoff result" CLOB, "Win #" FLOAT)
What is the lowest Win #, when Year is '2011-12', and when Points is less than 97?
SELECT MIN("Win #") FROM table_76169 WHERE "Year" = '2011-12' AND "Points" < '97'
SELECT MIN("Win #") FROM "table_76169" WHERE "Points" < '97' AND "Year" = '2011-12'
0.081055
CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE 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 VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE ReviewTaskTypes (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 ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description 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 Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense 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 PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) 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 CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name 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)
Number of users with 20k+ rep. Number of users with 20k+ rep
SELECT COUNT(*) FROM Users WHERE Reputation >= '##N:int?20000##'
SELECT COUNT(*) FROM "Users" WHERE "Reputation" >= '##N:int?20000##'
0.066406
CREATE TABLE table_68244 ("Date" CLOB, "Opponent" CLOB, "Score" CLOB, "Loss" CLOB, "Attendance" CLOB, "Record" CLOB)
Which of the opponents has a record of 17-25?
SELECT "Opponent" FROM table_68244 WHERE "Record" = '17-25'
SELECT "Opponent" FROM "table_68244" WHERE "Record" = '17-25'
0.05957
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE 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)
Provide the number of patients whose primary disease is left colon cancer and were born before the year 2041.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "LEFT COLON CANCER" AND demographic.dob_year < "2041"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2041" > "demographic"."dob_year" AND "LEFT COLON CANCER" = "demographic"."diagnosis"
0.15625
CREATE TABLE table_8386 ("Year" FLOAT, "Division" FLOAT, "League" CLOB, "Regular Season" CLOB, "Playoffs" CLOB, "Open Cup" CLOB)
In 2012, which round in the Open Cup did Real Colorado Foxes make it to the conference semifinal?
SELECT "Open Cup" FROM table_8386 WHERE "Playoffs" = 'conference semifinal' AND "Year" = '2012'
SELECT "Open Cup" FROM "table_8386" WHERE "Playoffs" = 'conference semifinal' AND "Year" = '2012'
0.094727
CREATE TABLE table_name_35 (rank NUMBER, time VARCHAR2, lane VARCHAR2)
What is the Rank of the Athlete with a Time of 1:47.65 and in Lane 3 or larger?
SELECT MAX(rank) FROM table_name_35 WHERE time = "1:47.65" AND lane > 3
SELECT MAX("rank") FROM "table_name_35" WHERE "1:47.65" = "time" AND "lane" > 3
0.077148
CREATE TABLE table_name_89 (top_5 NUMBER, events VARCHAR2, cuts_made VARCHAR2, tournament VARCHAR2)
What is the average value for Top-5, when the value Cuts is 5, and when the tournament is the Open Championship, and when the value Events is less than 6?
SELECT AVG(top_5) FROM table_name_89 WHERE cuts_made = 5 AND tournament = "the open championship" AND events < 6
SELECT AVG("top_5") FROM "table_name_89" WHERE "cuts_made" = 5 AND "events" < 6 AND "the open championship" = "tournament"
0.119141
CREATE TABLE table_203_476 (id NUMBER, "no." NUMBER, "title ( latin ) " CLOB, "title ( english translation ) " CLOB, "subject" CLOB, "date" CLOB)
how many titles did not list an english translation ?
SELECT COUNT(*) FROM table_203_476 WHERE "title (english translation)" IS NULL
SELECT COUNT(*) FROM "table_203_476" WHERE "title (english translation)" IS NULL
0.078125
CREATE TABLE table_41814 ("Year" FLOAT, "Tournament Name" CLOB, "Champions" CLOB, "Runners-up" CLOB, "Score" CLOB)
What year was the Grand Prix Passing Shot Bordeaux that had Runners-up of Diego Nargiso?
SELECT "Year" FROM table_41814 WHERE "Tournament Name" = 'grand prix passing shot bordeaux' AND "Runners-up" = 'diego nargiso'
SELECT "Year" FROM "table_41814" WHERE "Runners-up" = 'diego nargiso' AND "Tournament Name" = 'grand prix passing shot bordeaux'
0.125
CREATE TABLE table_40197 ("Round" CLOB, "Date" CLOB, "Matches" FLOAT, "Clubs" CLOB, "Prize money" CLOB)
What is the average Matches, when Round is Third Qualifying Round?
SELECT AVG("Matches") FROM table_40197 WHERE "Round" = 'third qualifying round'
SELECT AVG("Matches") FROM "table_40197" WHERE "Round" = 'third qualifying round'
0.079102
CREATE TABLE table_train_179 ("id" NUMBER, "systolic_blood_pressure_sbp" NUMBER, "fasting_plasma_glucose_fpg" FLOAT, "diastolic_blood_pressure_dbp" NUMBER, "diabetes" BOOLEAN, "body_mass_index_bmi" FLOAT, "triglyceride_tg" FLOAT, "hypertension" BOOLEAN, "age" FLOAT, "NOUSE" FLOAT)
fasting glucose > 100 mg / dl and < 126 mg / dl all individuals enrolled in the study should have at least 6th grade reading / writing ability.
SELECT * FROM table_train_179 WHERE fasting_plasma_glucose_fpg > 100 AND fasting_plasma_glucose_fpg < 126
SELECT * FROM "table_train_179" WHERE "fasting_plasma_glucose_fpg" < 126 AND "fasting_plasma_glucose_fpg" > 100
0.108398
CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name 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 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 code_description (code VARCHAR2, description CLOB) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE month (month_number NUMBER, month_name 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 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 time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) 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 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 compartment_class (compartment VARCHAR2, class_type 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)
what are the fares for flights between BOSTON and WASHINGTON
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND CITY_1.state_code = 'DC' AND NOT fare.round_trip_cost IS NULL AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
SELECT DISTINCT "fare"."fare_id" FROM "airport_service" "AIRPORT_SERVICE_0" JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'BOSTON' JOIN "flight" 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 "flight_fare" ON "flight"."flight_id" = "flight_fare"."flight_id" JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'WASHINGTON' AND "CITY_1"."state_code" = 'DC' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" AND NOT "fare"."round_trip_cost" IS NULL
0.678711
CREATE TABLE accounts (custid NUMBER, name CLOB) CREATE TABLE checking (custid NUMBER, balance NUMBER) CREATE TABLE savings (custid NUMBER, balance NUMBER)
How many accounts are there in total?
SELECT COUNT(*) FROM accounts
SELECT COUNT(*) FROM "accounts"
0.030273
CREATE TABLE table_204_902 (id NUMBER, "rank" NUMBER, "name" CLOB, "nationality" CLOB, "time" CLOB, "notes" CLOB)
what country was the top performer from ?
SELECT "nationality" FROM table_204_902 ORDER BY "rank" LIMIT 1
SELECT "nationality" FROM "table_204_902" ORDER BY "rank" FETCH FIRST 1 ROWS ONLY
0.079102
CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value 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 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 procedures_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 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 inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB)
what is the age of patient 85169 in the first hospital encounter?
SELECT admissions.age FROM admissions WHERE admissions.subject_id = 85169 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1
SELECT "admissions"."age" FROM "admissions" WHERE "admissions"."subject_id" = 85169 AND NOT "admissions"."dischtime" IS NULL ORDER BY "admissions"."admittime" FETCH FIRST 1 ROWS ONLY
0.177734
CREATE TABLE table_42317 ("Date" CLOB, "Score" CLOB, "Set 1" CLOB, "Set 2" CLOB, "Set 3" CLOB, "Set 4" CLOB, "Set 5" CLOB, "Total" CLOB)
What is the Set 2 with a Date that is jun 29?
SELECT "Set 2" FROM table_42317 WHERE "Date" = 'jun 29'
SELECT "Set 2" FROM "table_42317" WHERE "Date" = 'jun 29'
0.055664
CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT) CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER)
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and code , and group by attribute name, rank from low to high by the bars.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Name
SELECT "T1"."Name", "T1"."Code" FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T1"."Name", "T1"."Name" ORDER BY "T1"."Name"
0.166016
CREATE TABLE table_61199 ("7:00 am" CLOB, "7:30 am" CLOB, "8:00 am" CLOB, "9:00 am" CLOB, "11:00 am" CLOB, "noon" CLOB, "12:30 pm" CLOB, "1:00 pm" CLOB, "1:30 pm" CLOB, "2:00 pm" CLOB, "3:00 pm" CLOB, "3:30 pm" CLOB, "4:00 pm" CLOB, "4:30 pm" CLOB, "5:00 pm" CLOB, "6:30 pm" CLOB)
What shows at 7:30 am when 3:30 pm is Big Guy and Rusty the Boy Robot?
SELECT "7:30 am" FROM table_61199 WHERE "3:30 pm" = 'big guy and rusty the boy robot'
SELECT "7:30 am" FROM "table_61199" WHERE "3:30 pm" = 'big guy and rusty the boy robot'
0.084961
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 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 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 departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_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, show me about the correlation between commission_pct and manager_id in a scatter chart.
SELECT COMMISSION_PCT, MANAGER_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
SELECT "COMMISSION_PCT", "MANAGER_ID" FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history")
0.120117
CREATE TABLE table_name_10 (place VARCHAR2, player VARCHAR2)
Which place has horton smith as the player?
SELECT place FROM table_name_10 WHERE player = "horton smith"
SELECT "place" FROM "table_name_10" WHERE "horton smith" = "player"
0.06543
CREATE TABLE table_22754310_1 (party VARCHAR2, constituency VARCHAR2)
Name the party a for sriperumbudur
SELECT party AS a FROM table_22754310_1 WHERE constituency = "Sriperumbudur"
SELECT "party" AS "a" FROM "table_22754310_1" WHERE "Sriperumbudur" = "constituency"
0.082031
CREATE TABLE table_name_86 (artist VARCHAR2, label VARCHAR2, standard_number VARCHAR2)
Which Artist has the Label of Columbia and the Standard number of COCC-72073?
SELECT artist FROM table_name_86 WHERE label = "columbia" AND standard_number = "cocc-72073"
SELECT "artist" FROM "table_name_86" WHERE "cocc-72073" = "standard_number" AND "columbia" = "label"
0.097656
CREATE TABLE table_train_230 ("id" NUMBER, "anemia" BOOLEAN, "diabetic" CLOB, "lactose_intolerance" BOOLEAN, "hb" FLOAT, "body_mass_index_bmi" FLOAT, "NOUSE" FLOAT)
bmi between 10 to 85 percentile
SELECT * FROM table_train_230 WHERE body_mass_index_bmi >= 10 AND body_mass_index_bmi <= 85
SELECT * FROM "table_train_230" WHERE "body_mass_index_bmi" <= 85 AND "body_mass_index_bmi" >= 10
0.094727
CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, 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 Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE ReviewTaskStates (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 TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE 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 ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) 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 PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER)
Top 300 Users in India. It will gives you Top 300 Users who belongs to India.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%india%' OR UPPER(Location) LIKE '%IND' ORDER BY Reputation DESC LIMIT 300
SELECT ROW_NUMBER() OVER (ORDER BY "Reputation" DESC) AS "#", "Id" AS "user_link", "Reputation" FROM "Users" WHERE LOWER("Location") LIKE '%india%' OR UPPER("Location") LIKE '%IND' ORDER BY "Reputation" DESC FETCH FIRST 300 ROWS ONLY
0.227539
CREATE TABLE table_33046 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
What was the crowd when the VFL played Windy Hill?
SELECT SUM("Crowd") FROM table_33046 WHERE "Venue" = 'windy hill'
SELECT SUM("Crowd") FROM "table_33046" WHERE "Venue" = 'windy hill'
0.06543
CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost 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 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 inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE 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 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_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 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_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB)
what was the last time to be admitted into a hospital that patient 7512 was admitted via the er admit until 2101?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 7512 AND admissions.admission_location = 'emergency room admit' AND STRFTIME('%y', admissions.admittime) <= '2101' ORDER BY admissions.admittime DESC LIMIT 1
SELECT "admissions"."admittime" FROM "admissions" WHERE "admissions"."admission_location" = 'emergency room admit' AND "admissions"."subject_id" = 7512 AND STRFTIME('%y', "admissions"."admittime") <= '2101' ORDER BY "admissions"."admittime" DESC FETCH FIRST 1 ROWS ONLY
0.262695
CREATE TABLE table_23847 ("Parish" CLOB, "Obama%" CLOB, "Obama#" FLOAT, "McCain%" CLOB, "McCain#" FLOAT)
What was McCain's vote when Obama had 48.35%
SELECT MIN("McCain#") FROM table_23847 WHERE "Obama%" = '48.35%'
SELECT MIN("McCain#") FROM "table_23847" WHERE "Obama%" = '48.35%'
0.064453
CREATE TABLE table_43451 ("Frequency" CLOB, "Call sign" CLOB, "Branding" CLOB, "Format" CLOB, "Owner" CLOB)
Which Frequency has a Branding of country 600?
SELECT "Frequency" FROM table_43451 WHERE "Branding" = 'country 600'
SELECT "Frequency" FROM "table_43451" WHERE "Branding" = 'country 600'
0.068359
CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskTypes (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 PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE 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 TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate 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 ReviewTaskStates (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 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 Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) 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 ReviewTaskResultTypes (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 PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB)
Posts reviewed by a moderator.
SELECT p.Id AS "post_link", v.CreationDate FROM Votes AS v INNER JOIN Posts AS p ON v.PostId = p.Id AND p.OwnerUserId = '##UserId##' WHERE v.VoteTypeId = 15
SELECT "p"."Id" AS "post_link", "v"."CreationDate" FROM "Votes" "v" JOIN "Posts" "p" ON "p"."Id" = "v"."PostId" AND "p"."OwnerUserId" = '##UserId##' WHERE "v"."VoteTypeId" = 15
0.171875
CREATE TABLE table_name_35 (preliminary NUMBER, state VARCHAR2, interview VARCHAR2)
What is the best preliminary for a contestant from New Mexico with interview less than 9.533?
SELECT MAX(preliminary) FROM table_name_35 WHERE state = "new mexico" AND interview < 9.533
SELECT MAX("preliminary") FROM "table_name_35" WHERE "interview" < 9.533 AND "new mexico" = "state"
0.09668
CREATE TABLE table_name_62 (season VARCHAR2, third VARCHAR2)
What is Season, when Third is 'Glen Muirhead'?
SELECT season FROM table_name_62 WHERE third = "glen muirhead"
SELECT "season" FROM "table_name_62" WHERE "glen muirhead" = "third"
0.066406
CREATE TABLE table_27303975_3 (studio VARCHAR2, title VARCHAR2)
How many times is the title am/pm callanetics?
SELECT COUNT(studio) FROM table_27303975_3 WHERE title = "AM/PM Callanetics"
SELECT COUNT("studio") FROM "table_27303975_3" WHERE "AM/PM Callanetics" = "title"
0.080078
CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE 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 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 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 outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value 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 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 cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
calculate the number of times that furosemide was prescribed to patient 27038 since 81 months ago.
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27038) AND prescriptions.drug = 'furosemide' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-81 month')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 27038 GROUP BY "hadm_id") SELECT COUNT(*) FROM "prescriptions" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE "prescriptions"."drug" = 'furosemide' AND DATETIME("prescriptions"."startdate") >= DATETIME(CURRENT_TIME(), '-81 month') AND NOT "_u_0"."" IS NULL
0.369141
CREATE TABLE table_19780 ("Position" FLOAT, "Team" CLOB, "Played" FLOAT, "Wins" FLOAT, "Draws" FLOAT, "Losses" FLOAT, "Scored" FLOAT, "Conceded" FLOAT, "Points" FLOAT)
How many losses did 12 de Octubre have ?
SELECT MIN("Losses") FROM table_19780 WHERE "Team" = '12 de Octubre'
SELECT MIN("Losses") FROM "table_19780" WHERE "Team" = '12 de Octubre'
0.068359
CREATE TABLE table_name_40 (silver VARCHAR2, gold VARCHAR2, rank VARCHAR2)
How many silver medals are there with 3 gold medals at a rank above 1?
SELECT COUNT(silver) FROM table_name_40 WHERE gold = 3 AND rank > 1
SELECT COUNT("silver") FROM "table_name_40" WHERE "gold" = 3 AND "rank" > 1
0.073242
CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) 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 microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME)
what were the four most frequent drugs that were prescribed during the same month to patients of age 40s after being diagnosed with protein-calorie malnutrition until 2104?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'protein-calorie malnutrition' AND STRFTIME('%y', diagnosis.diagnosistime) <= '2104') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.age BETWEEN 40 AND 49 AND STRFTIME('%y', medication.drugstarttime) <= '2104') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.drugstarttime, 'start of month') GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 4
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."age" <= 49 AND "patient"."age" >= 40 WHERE STRFTIME('%y', "medication"."drugstarttime") <= '2104'), "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"."uniquepid" = "t2"."uniquepid" AND DATETIME("diagnosis"."diagnosistime", 'start of month') = DATETIME("t2"."drugstarttime", 'start of month') WHERE "diagnosis"."diagnosisname" = 'protein-calorie malnutrition' AND STRFTIME('%y', "diagnosis"."diagnosistime") <= '2104' GROUP BY "t2"."drugname") SELECT "t3"."drugname" FROM "t3" "t3" WHERE "t3"."c1" <= 4
0.90918
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)
tell me the average sao2 in patient 5866?
SELECT AVG(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 = 5866)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2' AND d_items.linksto = 'chartevents')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 5866 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" = 'sao2' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT AVG("chartevents"."valuenum") FROM "chartevents" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
0.65918