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_27003223_4 (registered_voters VARCHAR2, d_r_spread VARCHAR2)
What is the percentage of registered voters in which the d-r spread is +10.4%?
SELECT registered_voters FROM table_27003223_4 WHERE d_r_spread = "+10.4%"
SELECT "registered_voters" FROM "table_27003223_4" WHERE "+10.4%" = "d_r_spread"
0.078125
CREATE TABLE Catalogs (catalog_id NUMBER, catalog_name VARCHAR2, catalog_publisher VARCHAR2, date_of_publication DATETIME, date_of_latest_revision DATETIME) CREATE TABLE Attribute_Definitions (attribute_id NUMBER, attribute_name VARCHAR2, attribute_data_type VARCHAR2) CREATE TABLE Catalog_Contents (catalog_entry_id NUMBER, catalog_level_number NUMBER, parent_entry_id NUMBER, previous_entry_id NUMBER, next_entry_id NUMBER, catalog_entry_name VARCHAR2, product_stock_number VARCHAR2, price_in_dollars DOUBLE PRECISION, price_in_euros DOUBLE PRECISION, price_in_pounds DOUBLE PRECISION, capacity VARCHAR2, length VARCHAR2, height VARCHAR2, width VARCHAR2) CREATE TABLE Catalog_Structure (catalog_level_number NUMBER, catalog_id NUMBER, catalog_level_name VARCHAR2) CREATE TABLE Catalog_Contents_Additional_Attributes (catalog_entry_id NUMBER, catalog_level_number NUMBER, attribute_id NUMBER, attribute_value VARCHAR2)
A bar chart for what are the number of the names of catalog entries with level number 8?, and rank from high to low by the X-axis.
SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY catalog_entry_name DESC
SELECT "catalog_entry_name", COUNT("catalog_entry_name") FROM "Catalog_Contents" "t1" JOIN "Catalog_Contents_Additional_Attributes" "t2" ON "8" = "t2"."catalog_level_number" AND "t1"."catalog_entry_id" = "t2"."catalog_entry_id" GROUP BY "catalog_entry_name" ORDER BY "catalog_entry_name" DESC
0.285156
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 allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime 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 medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME)
what were the top three most common procedures that were ordered since 2103?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE STRFTIME('%y', treatment.treatmenttime) >= '2103' GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 3
WITH "t1" AS (SELECT "treatment"."treatmentname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "treatment" WHERE STRFTIME('%y', "treatment"."treatmenttime") >= '2103' GROUP BY "treatment"."treatmentname") SELECT "t1"."treatmentname" FROM "t1" "t1" WHERE "t1"."c1" <= 3
0.272461
CREATE TABLE table_78234 ("State" CLOB, "Interview" FLOAT, "Swimsuit" FLOAT, "Evening Gown" FLOAT, "Average" FLOAT)
What is the lowest evening score of the contestant with an evening gown less than 8.938, from Texas, and with an average less than 8.846 has?
SELECT MIN("Interview") FROM table_78234 WHERE "Evening Gown" < '8.938' AND "State" = 'texas' AND "Average" < '8.846'
SELECT MIN("Interview") FROM "table_78234" WHERE "Average" < '8.846' AND "Evening Gown" < '8.938' AND "State" = 'texas'
0.116211
CREATE TABLE table_204_596 (id NUMBER, "year" NUMBER, "winners" CLOB, "score" CLOB, "runners up" CLOB, "notes" CLOB)
which team was the winner of the first final ?
SELECT "winners" FROM table_204_596 ORDER BY "year" LIMIT 1
SELECT "winners" FROM "table_204_596" ORDER BY "year" FETCH FIRST 1 ROWS ONLY
0.075195
CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_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 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 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 outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE procedures_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 d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
tell me the maximum total hospital cost that involves ld, body fluid since 5 years ago?
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ld, body fluid')) AND DATETIME(cost.chargetime) >= DATETIME(CURRENT_TIME(), '-5 year') GROUP BY cost.hadm_id) AS t1
WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'ld, body fluid' GROUP BY "itemid"), "_u_1" AS (SELECT "labevents"."hadm_id" FROM "labevents" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "labevents"."itemid" WHERE NOT "_u_0"."" IS NULL GROUP BY "hadm_id"), "t1" AS (SELECT SUM("cost"."cost") AS "c1" FROM "cost" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "cost"."hadm_id" WHERE DATETIME("cost"."chargetime") >= DATETIME(CURRENT_TIME(), '-5 year') AND NOT "_u_1"."" IS NULL GROUP BY "cost"."hadm_id") SELECT MAX("t1"."c1") FROM "t1" "t1"
0.556641
CREATE TABLE table_14219 ("Rank" FLOAT, "Heat" FLOAT, "Athlete" CLOB, "Country" CLOB, "Time" FLOAT)
What is a highest time for the heat smaller than 1?
SELECT MAX("Time") FROM table_14219 WHERE "Heat" < '1'
SELECT MAX("Time") FROM "table_14219" WHERE "Heat" < '1'
0.054688
CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) 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 intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB)
what is the number of patients that sodium chloride 0.9% is prescribed to?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'sodium chloride 0.9%')
WITH "_u_0" AS (SELECT "medication"."patientunitstayid" FROM "medication" WHERE "medication"."drugname" = 'sodium chloride 0.9%' GROUP BY "patientunitstayid") SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL
0.307617
CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE compartment_class (compartment VARCHAR2, class_type 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 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 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 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 ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB) CREATE TABLE flight_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 city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE days (days_code VARCHAR2, day_name 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_fare (flight_id NUMBER, fare_id NUMBER) 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)
show me all the flights from INDIANAPOLIS to SAN DIEGO on US
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN DIEGO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'INDIANAPOLIS' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'US'
SELECT DISTINCT "flight"."flight_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" = 'SAN DIEGO' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."to_airport" AND "flight"."airline_code" = 'US' JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."from_airport" JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'INDIANAPOLIS'
0.523438
CREATE TABLE table_name_55 (birth VARCHAR2, spouse VARCHAR2, became_consort VARCHAR2)
Name the birth of the person that has a spouse of frederick iv and became consort of 4 april 1721
SELECT birth FROM table_name_55 WHERE spouse = "frederick iv" AND became_consort = "4 april 1721"
SELECT "birth" FROM "table_name_55" WHERE "4 april 1721" = "became_consort" AND "frederick iv" = "spouse"
0.102539
CREATE TABLE table_28108 ("Series #" FLOAT, "Season #" FLOAT, "Title" CLOB, "Director" CLOB, "Writer ( s ) " CLOB, "Airdate" CLOB)
Who wrote the episode with series number 56?
SELECT "Writer(s)" FROM table_28108 WHERE "Series #" = '56'
SELECT "Writer(s)" FROM "table_28108" WHERE "Series #" = '56'
0.05957
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 procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title 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 diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
how many patients whose primary disease is liver transplant and admission year is less than 2170?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "LIVER TRANSPLANT" AND demographic.admityear < "2170"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2170" > "demographic"."admityear" AND "LIVER TRANSPLANT" = "demographic"."diagnosis"
0.15625
CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom 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 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 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 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) 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 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 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 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 patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB)
until 03/20/2104 had patient 8098 had any intake of .9% normal saline?
SELECT COUNT(*) > 0 FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8098)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = '.9% normal saline' AND d_items.linksto = 'inputevents_cv') AND STRFTIME('%y-%m-%d', inputevents_cv.charttime) <= '2104-03-20'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 8098 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" = '.9% normal saline' AND "d_items"."linksto" = 'inputevents_cv' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "inputevents_cv" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" LEFT JOIN "_u_2" "_u_2" ON "_u_2"."" = "inputevents_cv"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m-%d', "inputevents_cv"."charttime") <= '2104-03-20'
0.736328
CREATE TABLE table_name_48 (commercial_operation VARCHAR2, gross_capacity VARCHAR2, electricity_grid VARCHAR2)
Which Commercial Operation has both a Gross Capacity of 417 mw and an Electricity Grid 27.12.1971?
SELECT commercial_operation FROM table_name_48 WHERE gross_capacity = "417 mw" AND electricity_grid = "27.12.1971"
SELECT "commercial_operation" FROM "table_name_48" WHERE "27.12.1971" = "electricity_grid" AND "417 mw" = "gross_capacity"
0.119141
CREATE TABLE Ref_Document_Types (document_type_description VARCHAR2, document_type_code VARCHAR2)
What is the description of document type 'Paper'?
SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = "Paper"
SELECT "document_type_description" FROM "Ref_Document_Types" WHERE "Paper" = "document_type_code"
0.094727
CREATE TABLE table_4123 ("Pick" CLOB, "Player" CLOB, "Position" CLOB, "Nationality" CLOB, "NHL team" CLOB, "College/junior/club team" CLOB)
How many countries had players named Marc Savard get picked?
SELECT COUNT("Nationality") FROM table_4123 WHERE "Player" = 'Marc Savard'
SELECT COUNT("Nationality") FROM "table_4123" WHERE "Player" = 'Marc Savard'
0.074219
CREATE TABLE table_52690 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
What is the sum of the crowd when the away team score was 12.11 (83)?
SELECT SUM("Crowd") FROM table_52690 WHERE "Away team score" = '12.11 (83)'
SELECT SUM("Crowd") FROM "table_52690" WHERE "Away team score" = '12.11 (83)'
0.075195
CREATE TABLE table_60884 ("Player" CLOB, "Country" CLOB, "Year ( s ) won" CLOB, "Total" FLOAT, "To par" CLOB, "Finish" CLOB)
What is the To par when there was a total of 291?
SELECT "To par" FROM table_60884 WHERE "Total" = '291'
SELECT "To par" FROM "table_60884" WHERE "Total" = '291'
0.054688
CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE CloseReasonTypes (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 ReviewTaskStates (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 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 ReviewTaskTypes (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 Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) 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 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 PostTags (PostId NUMBER, TagId 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 PostTypes (Id NUMBER, Name CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount 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 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 TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange 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 ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE FlagTypes (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 Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER)
Average score of all answers (depending on month of questions' creationdate).
WITH ascore_cte AS (SELECT q.Id AS qid, q.CreationDate AS cre, SUM(a.Score) AS ascore FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 GROUP BY q.Id, q.CreationDate) SELECT LAST_DATE_OF_MONTH(cre), AVG(CAST(ascore AS FLOAT)) AS "Average sum of answer-scores" FROM ascore_cte GROUP BY LAST_DATE_OF_MONTH(cre) ORDER BY LAST_DATE_OF_MONTH(cre)
WITH "ascore_cte" AS (SELECT MAX(1) AS "_" FROM "Posts" "q" JOIN "Posts" "a" ON "a"."ParentId" = "q"."Id" WHERE "q"."PostTypeId" = 1 GROUP BY "q"."Id", "q"."CreationDate") SELECT LAST_DATE_OF_MONTH("cre"), AVG(CAST("ascore" AS FLOAT)) AS "Average sum of answer-scores" FROM "ascore_cte" GROUP BY LAST_DATE_OF_MONTH("cre") ORDER BY LAST_DATE_OF_MONTH("cre")
0.347656
CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 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 d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod 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 diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime 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 chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB)
how many hours have passed since patient 52898 stayed in the careunit csru for the last time in their current hospital visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 52898 AND admissions.dischtime IS NULL) AND transfers.careunit = 'csru' ORDER BY transfers.intime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."dischtime" IS NULL AND "admissions"."subject_id" = 52898 GROUP BY "hadm_id") SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "transfers"."intime")) FROM "transfers" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "transfers"."hadm_id" WHERE "transfers"."careunit" = 'csru' AND NOT "_u_0"."" IS NULL ORDER BY "transfers"."intime" DESC FETCH FIRST 1 ROWS ONLY
0.43457
CREATE TABLE table_11545282_7 (school_club_team VARCHAR2, no VARCHAR2)
What school or club did number 35 play for?
SELECT school_club_team FROM table_11545282_7 WHERE no = 35
SELECT "school_club_team" FROM "table_11545282_7" WHERE "no" = 35
0.063477
CREATE TABLE table_20894 ("Player" CLOB, "Team" CLOB, "Matches" FLOAT, "Wickets" FLOAT, "Average" CLOB, "Best Bowling" CLOB)
What number of wickets were there when the average was 22.66?
SELECT MAX("Wickets") FROM table_20894 WHERE "Average" = '22.66'
SELECT MAX("Wickets") FROM "table_20894" WHERE "Average" = '22.66'
0.064453
CREATE TABLE table_name_71 (nationality VARCHAR2, rank VARCHAR2, name VARCHAR2)
Which Nationality has a Rank larger than 3, and a Name of tom hilde?
SELECT nationality FROM table_name_71 WHERE rank > 3 AND name = "tom hilde"
SELECT "nationality" FROM "table_name_71" WHERE "name" = "tom hilde" AND "rank" > 3
0.081055
CREATE TABLE table_29957 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
Name the total number of high assists for fedexforum 11,283
SELECT COUNT("High assists") FROM table_29957 WHERE "Location Attendance" = 'FedExForum 11,283'
SELECT COUNT("High assists") FROM "table_29957" WHERE "Location Attendance" = 'FedExForum 11,283'
0.094727
CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_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 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 state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time 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 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 month (month_number NUMBER, month_name CLOB) 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 airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE code_description (code VARCHAR2, description CLOB)
i need a flight from PHILADELPHIA to DENVER
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
SELECT DISTINCT "flight"."flight_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" = 'PHILADELPHIA' 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 "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'DENVER'
0.486328
CREATE TABLE table_name_4 (opponent VARCHAR2, date VARCHAR2)
Who was the opponent on November 11, 2001?
SELECT opponent FROM table_name_4 WHERE date = "november 11, 2001"
SELECT "opponent" FROM "table_name_4" WHERE "date" = "november 11, 2001"
0.070313
CREATE TABLE InvoiceLine (InvoiceLineId NUMBER, InvoiceId NUMBER, TrackId NUMBER, UnitPrice NUMBER, Quantity NUMBER) CREATE TABLE Playlist (PlaylistId NUMBER, Name VARCHAR2) CREATE TABLE Album (AlbumId NUMBER, Title VARCHAR2, ArtistId NUMBER) CREATE TABLE MediaType (MediaTypeId NUMBER, Name VARCHAR2) CREATE TABLE Invoice (InvoiceId NUMBER, CustomerId NUMBER, InvoiceDate DATETIME, BillingAddress VARCHAR2, BillingCity VARCHAR2, BillingState VARCHAR2, BillingCountry VARCHAR2, BillingPostalCode VARCHAR2, Total NUMBER) CREATE TABLE PlaylistTrack (PlaylistId NUMBER, TrackId NUMBER) CREATE TABLE Genre (GenreId NUMBER, Name VARCHAR2) CREATE TABLE Artist (ArtistId NUMBER, Name VARCHAR2) CREATE TABLE Customer (CustomerId NUMBER, FirstName VARCHAR2, LastName VARCHAR2, Company VARCHAR2, Address VARCHAR2, City VARCHAR2, State VARCHAR2, Country VARCHAR2, PostalCode VARCHAR2, Phone VARCHAR2, Fax VARCHAR2, Email VARCHAR2, SupportRepId NUMBER) CREATE TABLE Employee (EmployeeId NUMBER, LastName VARCHAR2, FirstName VARCHAR2, Title VARCHAR2, ReportsTo NUMBER, BirthDate DATETIME, HireDate DATETIME, Address VARCHAR2, City VARCHAR2, State VARCHAR2, Country VARCHAR2, PostalCode VARCHAR2, Phone VARCHAR2, Fax VARCHAR2, Email VARCHAR2) CREATE TABLE Track (TrackId NUMBER, Name VARCHAR2, AlbumId NUMBER, MediaTypeId NUMBER, GenreId NUMBER, Composer VARCHAR2, Milliseconds NUMBER, Bytes NUMBER, UnitPrice NUMBER)
Show me a bar chart for what are the titles and ids for albums containing tracks with unit price greater than 1?, and show y axis from low to high order.
SELECT T1.Title, T1.AlbumId FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 ORDER BY T1.AlbumId
SELECT "T1"."Title", "T1"."AlbumId" FROM "Album" "T1" JOIN "Track" "T2" ON "T1"."AlbumId" = "T2"."AlbumId" AND "T2"."UnitPrice" > 1 ORDER BY "T1"."AlbumId"
0.151367
CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) 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 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 food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare 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 flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight 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 class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) 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 state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant 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 dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt 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 airline (airline_code VARCHAR2, airline_name CLOB, note 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 flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2)
show me the prices of FIRST class tickets on US round trip from CLEVELAND to MIAMI
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, fare_basis, flight, flight_fare WHERE (((flight.airline_code = 'US') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MIAMI' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CLEVELAND' 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 fare_basis.class_type = 'FIRST' AND fare.fare_basis_code = fare_basis.fare_basis_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" = 'CLEVELAND' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."airline_code" = 'US' 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" = 'MIAMI' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" AND NOT "fare"."round_trip_cost" IS NULL JOIN "fare_basis" ON "fare"."fare_basis_code" = "fare_basis"."fare_basis_code" AND "fare_basis"."class_type" = 'FIRST'
0.794922
CREATE TABLE table_13005 ("Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Against" FLOAT, "% Won" FLOAT)
What is the Lost with Against smaller than 25, and Played smaller than 1?
SELECT AVG("Lost") FROM table_13005 WHERE "Against" < '25' AND "Played" < '1'
SELECT AVG("Lost") FROM "table_13005" WHERE "Against" < '25' AND "Played" < '1'
0.077148
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 treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime 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 cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
since 3 years ago, what are the top five most frequent specimen tests ordered for patients during the same month after the diagnosis of cerebral subdural hematoma.
SELECT t3.culturesite FROM (SELECT t2.culturesite, 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 = 'cerebral subdural hematoma' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-3 year')) AS t1 JOIN (SELECT patient.uniquepid, microlab.culturesite, microlab.culturetakentime FROM microlab JOIN patient ON microlab.patientunitstayid = patient.patientunitstayid WHERE DATETIME(microlab.culturetakentime) >= DATETIME(CURRENT_TIME(), '-3 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.culturetakentime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.culturetakentime, 'start of month') GROUP BY t2.culturesite) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "patient"."uniquepid", "microlab"."culturesite", "microlab"."culturetakentime" FROM "microlab" JOIN "patient" ON "microlab"."patientunitstayid" = "patient"."patientunitstayid" WHERE DATETIME("microlab"."culturetakentime") >= DATETIME(CURRENT_TIME(), '-3 year')), "t3" AS (SELECT "t2"."culturesite", 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"."culturetakentime" AND "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("diagnosis"."diagnosistime", 'start of month') = DATETIME("t2"."culturetakentime", 'start of month') WHERE "diagnosis"."diagnosisname" = 'cerebral subdural hematoma' AND DATETIME("diagnosis"."diagnosistime") >= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY "t2"."culturesite") SELECT "t3"."culturesite" FROM "t3" "t3" WHERE "t3"."c1" <= 5
0.915039
CREATE TABLE table_75757 ("Information" CLOB, "Altade\\u00f1a" CLOB, "Aprende" CLOB, "Centennial" CLOB, "Kyrene MS" CLOB, "del Pueblo" CLOB)
WHich kind of Aprende has a Centennial of 1988?
SELECT "Aprende" FROM table_75757 WHERE "Centennial" = '1988'
SELECT "Aprende" FROM "table_75757" WHERE "Centennial" = '1988'
0.061523
CREATE TABLE csu_fees (campus NUMBER, year NUMBER, campusfee NUMBER) CREATE TABLE discipline_enrollments (campus NUMBER, discipline NUMBER, year NUMBER, undergraduate NUMBER, graduate NUMBER) CREATE TABLE enrollments (campus NUMBER, year NUMBER, totalenrollment_ay NUMBER, fte_ay NUMBER) CREATE TABLE campuses (id NUMBER, campus CLOB, location CLOB, county CLOB, year NUMBER) CREATE TABLE faculty (campus NUMBER, year NUMBER, faculty NUMBER) CREATE TABLE degrees (year NUMBER, campus NUMBER, degrees NUMBER)
How many faculty is there in total in the year of 2002?
SELECT SUM(faculty) FROM faculty WHERE year = 2002
SELECT SUM("faculty") FROM "faculty" WHERE "year" = 2002
0.054688
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 flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight 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 airline (airline_code VARCHAR2, airline_name CLOB, note 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 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 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 date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) 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 days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant 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 ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE flight_stop (flight_id NUMBER, stop_number NUMBER, stop_days CLOB, stop_airport CLOB, arrival_time NUMBER, arrival_airline CLOB, arrival_flight_number NUMBER, departure_time NUMBER, departure_airline CLOB, departure_flight_number NUMBER, stop_time NUMBER) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER)
what 's the cost of a FIRST class fare from PHILADELPHIA to SAN FRANCISCO
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, fare_basis, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND fare_basis.class_type = 'FIRST' AND fare.fare_basis_code = fare_basis.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 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" = 'PHILADELPHIA' 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" = 'SAN FRANCISCO' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" JOIN "fare_basis" ON "fare"."fare_basis_code" = "fare_basis"."fare_basis_code" AND "fare_basis"."class_type" = 'FIRST'
0.731445
CREATE TABLE table_name_78 (round NUMBER, opponent VARCHAR2)
How many rounds did the match last with Sam Sotello as the opponent?
SELECT AVG(round) FROM table_name_78 WHERE opponent = "sam sotello"
SELECT AVG("round") FROM "table_name_78" WHERE "opponent" = "sam sotello"
0.071289
CREATE TABLE table_21534 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
What dates did Chris Bosh (18) score the high points?
SELECT "Date" FROM table_21534 WHERE "High points" = 'Chris Bosh (18)'
SELECT "Date" FROM "table_21534" WHERE "High points" = 'Chris Bosh (18)'
0.070313
CREATE TABLE Parts (part_id VARCHAR2, part_name VARCHAR2) CREATE TABLE Part_Faults (part_id VARCHAR2, part_fault_id VARCHAR2) CREATE TABLE Skills_Required_To_Fix (part_fault_id VARCHAR2)
Which part fault requires the most number of skills to fix? List part id and name.
SELECT T1.part_id, T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id JOIN Skills_Required_To_Fix AS T3 ON T2.part_fault_id = T3.part_fault_id GROUP BY T1.part_id ORDER BY COUNT(*) DESC LIMIT 1
SELECT "T1"."part_id", "T1"."part_name" FROM "Parts" "T1" JOIN "Part_Faults" "T2" ON "T1"."part_id" = "T2"."part_id" JOIN "Skills_Required_To_Fix" "T3" ON "T2"."part_fault_id" = "T3"."part_fault_id" GROUP BY "T1"."part_id" ORDER BY COUNT(*) DESC FETCH FIRST 1 ROWS ONLY
0.262695
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE 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 diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
what is drug type of drug name pantoprazole sodium?
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Pantoprazole Sodium"
SELECT "prescriptions"."drug_type" FROM "prescriptions" WHERE "Pantoprazole Sodium" = "prescriptions"."drug"
0.105469
CREATE TABLE table_name_35 (yonguk VARCHAR2, halang VARCHAR2)
Which Yonguk has a Halang of ran ?
SELECT yonguk FROM table_name_35 WHERE halang = "ran¹"
SELECT "yonguk" FROM "table_name_35" WHERE "halang" = "ran¹"
0.058594
CREATE TABLE table_15771 ("Year" CLOB, "Men's singles" CLOB, "Women's singles" CLOB, "Men's doubles" CLOB, "Women's doubles" CLOB, "Mixed doubles" CLOB)
Who won the Women's singles in 2013?
SELECT "Women's singles" FROM table_15771 WHERE "Year" = '2013'
SELECT "Women's singles" FROM "table_15771" WHERE "Year" = '2013'
0.063477
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid 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 procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title 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 diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
how many patients whose ethnicity is black/cape verdean and year of birth is less than 2078?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.dob_year < "2078"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2078" > "demographic"."dob_year" AND "BLACK/CAPE VERDEAN" = "demographic"."ethnicity"
0.157227
CREATE TABLE table_27026 ("Eliminated" FLOAT, "Wrestler" CLOB, "Entered" FLOAT, "Eliminated by" CLOB, "Method of elimination" CLOB, "Time" CLOB)
What was the method of elimination in the chamber with a time of 24:02?
SELECT "Method of elimination" FROM table_27026 WHERE "Time" = '24:02'
SELECT "Method of elimination" FROM "table_27026" WHERE "Time" = '24:02'
0.070313
CREATE TABLE table_name_82 (average NUMBER, matches VARCHAR2, catches VARCHAR2)
What is the smallest average for the player with 13 matches and fewer than 7 catches?
SELECT MIN(average) FROM table_name_82 WHERE matches = 13 AND catches < 7
SELECT MIN("average") FROM "table_name_82" WHERE "catches" < 7 AND "matches" = 13
0.079102
CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare 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 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 class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name 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 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 time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE 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 time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) 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 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 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 flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB)
show me flights from PHILADELPHIA to DENVER on a MONDAY
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND days.day_name = 'MONDAY' AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
SELECT DISTINCT "flight"."flight_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" = 'PHILADELPHIA' 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 "days" ON "days"."day_name" = 'MONDAY' AND "days"."days_code" = "flight"."flight_days" JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'DENVER'
0.576172
CREATE TABLE table_name_63 (opponents_in_the_final VARCHAR2, partner VARCHAR2, championship VARCHAR2)
Which opponent in the final had a partner of Katarina Srebotnik and a championship of wimbledon (4)?
SELECT opponents_in_the_final FROM table_name_63 WHERE partner = "katarina srebotnik" AND championship = "wimbledon (4)"
SELECT "opponents_in_the_final" FROM "table_name_63" WHERE "championship" = "wimbledon (4)" AND "katarina srebotnik" = "partner"
0.125
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 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) 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 diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE 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 microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name 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 d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) 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 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB)
whats patient 9297 first ward id this year?
SELECT transfers.wardid FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9297) AND NOT transfers.wardid IS NULL AND DATETIME(transfers.intime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY transfers.intime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 9297 GROUP BY "hadm_id") SELECT "transfers"."wardid" FROM "transfers" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "transfers"."hadm_id" WHERE DATETIME("transfers"."intime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_0"."" IS NULL AND NOT "transfers"."wardid" IS NULL ORDER BY "transfers"."intime" FETCH FIRST 1 ROWS ONLY
0.443359
CREATE TABLE table_35521 ("Position" FLOAT, "Team" CLOB, "Played" FLOAT, "Wins" FLOAT, "Draws" FLOAT, "Losses" FLOAT, "Scored" FLOAT, "Conceded" FLOAT, "Points" FLOAT)
What is the average number conceded for hte team that had less than 19 points, played more than 18 games and had a position less than 10?
SELECT AVG("Conceded") FROM table_35521 WHERE "Points" < '19' AND "Position" < '10' AND "Played" > '18'
SELECT AVG("Conceded") FROM "table_35521" WHERE "Played" > '18' AND "Points" < '19' AND "Position" < '10'
0.102539
CREATE TABLE table_204_543 (id NUMBER, "national team" CLOB, "title ( s ) \ represented" CLOB, "first\ worn" NUMBER, "number\ of stars" NUMBER, "notes" CLOB)
germany first wore them in 1996 . who was next ?
SELECT "national team" FROM table_204_543 WHERE "first\nworn" > (SELECT "first\nworn" FROM table_204_543 WHERE "national team" = 'germany') ORDER BY "first\nworn" LIMIT 1
SELECT "national team" FROM "table_204_543" WHERE "first\nworn" > (SELECT "first\nworn" FROM "table_204_543" WHERE "national team" = 'germany') ORDER BY "first\nworn" FETCH FIRST 1 ROWS ONLY
0.185547
CREATE TABLE table_58354 ("Position" CLOB, "Game 1" CLOB, "Game 2" CLOB, "Game 3" CLOB, "Game 4" CLOB)
For which Game 4, did David Boyle play in Game 3?
SELECT "Game 4" FROM table_58354 WHERE "Game 3" = 'david boyle'
SELECT "Game 4" FROM "table_58354" WHERE "Game 3" = 'david boyle'
0.063477
CREATE TABLE pilot_record (Record_ID NUMBER, Pilot_ID NUMBER, Aircraft_ID NUMBER, Date CLOB) CREATE TABLE aircraft (Aircraft_ID NUMBER, Order_Year NUMBER, Manufacturer CLOB, Model CLOB, Fleet_Series CLOB, Powertrain CLOB, Fuel_Propulsion CLOB) CREATE TABLE pilot (Pilot_ID NUMBER, Pilot_name CLOB, Rank NUMBER, Age NUMBER, Nationality CLOB, Position CLOB, Join_Year NUMBER, Team CLOB)
Draw a bar chart for what are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality, and could you display total number from low to high order?
SELECT Nationality, COUNT(*) FROM pilot GROUP BY Nationality ORDER BY COUNT(*)
SELECT "Nationality", COUNT(*) FROM "pilot" GROUP BY "Nationality" ORDER BY COUNT(*)
0.082031
CREATE TABLE person (name VARCHAR2) CREATE TABLE PersonFriend (name VARCHAR2)
Who is the person that has no friend?
SELECT name FROM person EXCEPT SELECT name FROM PersonFriend
SELECT "name" FROM "person" EXCEPT SELECT "name" FROM "PersonFriend"
0.066406
CREATE TABLE table_61535 ("Official Name" CLOB, "Status" CLOB, "Area km 2" FLOAT, "Population" FLOAT, "Census Ranking" CLOB)
What is the population of the parish that has an area of 304.06?
SELECT SUM("Population") FROM table_61535 WHERE "Area km 2" = '304.06'
SELECT SUM("Population") FROM "table_61535" WHERE "Area km 2" = '304.06'
0.070313
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 procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title 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 diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB)
tell me the short title of diagnoses and days for which patient with patient id 74463 was hospitalized.
SELECT demographic.days_stay, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "74463"
SELECT "demographic"."days_stay", "diagnoses"."short_title" FROM "demographic" JOIN "diagnoses" ON "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "74463" = "demographic"."subject_id"
0.18457
CREATE TABLE table_67877 ("7:00" CLOB, "7:30" CLOB, "8:00" CLOB, "8:30" CLOB, "9:00" CLOB, "9:30" CLOB, "10:00" CLOB)
What is on tv at 10:00 on the same channel that had Infoman on at 7:30?
SELECT "10:00" FROM table_67877 WHERE "7:30" = 'infoman'
SELECT "10:00" FROM "table_67877" WHERE "7:30" = 'infoman'
0.056641
CREATE TABLE table_202_7 (id NUMBER, "year" CLOB, "title" CLOB, "role" CLOB, "notes" CLOB)
how many more roles did jon stewart have in 1997 compared to 2007 ?
SELECT (SELECT COUNT("role") FROM table_202_7 WHERE "year" = 1997) - (SELECT COUNT("role") FROM table_202_7 WHERE "year" = 2007)
SELECT (SELECT COUNT("role") FROM "table_202_7" WHERE "year" = 1997) - (SELECT COUNT("role") FROM "table_202_7" WHERE "year" = 2007)
0.128906
CREATE TABLE table_name_49 (noaa VARCHAR2, darwin VARCHAR2)
What is the NOAA of the higher harmonics that have a Darwin of mn 4?
SELECT noaa FROM table_name_49 WHERE darwin = "mn 4"
SELECT "noaa" FROM "table_name_49" WHERE "darwin" = "mn 4"
0.056641
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, return a bar chart about the distribution of founder and the average of code , and group by attribute founder, order in desc by the total number please.
SELECT T2.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T1.Code DESC
SELECT "T2"."Founder", "T1"."Code" FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T2"."Founder" ORDER BY "T1"."Code" DESC
0.164063
CREATE TABLE region (region_name VARCHAR2, region_id VARCHAR2) CREATE TABLE affected_region (region_id VARCHAR2)
Show the name for regions and the number of storms for each region.
SELECT T1.region_name, COUNT(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id
SELECT "T1"."region_name", COUNT(*) FROM "region" "T1" JOIN "affected_region" "T2" ON "T1"."region_id" = "T2"."region_id" GROUP BY "T1"."region_id"
0.143555
CREATE TABLE table_11328 ("Round" FLOAT, "Pick" FLOAT, "Name" CLOB, "Position" CLOB, "School" CLOB)
What position is Kentucky State sitting in?
SELECT "Position" FROM table_11328 WHERE "School" = 'kentucky state'
SELECT "Position" FROM "table_11328" WHERE "School" = 'kentucky state'
0.068359
CREATE TABLE table_57580 ("Tie no" CLOB, "Home team" CLOB, "Score" CLOB, "Away team" CLOB, "Attendance" CLOB)
What is the score of the game with tie number 65?
SELECT "Score" FROM table_57580 WHERE "Tie no" = '65'
SELECT "Score" FROM "table_57580" WHERE "Tie no" = '65'
0.053711
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 treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime 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 intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE 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 microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME)
was patient 015-56556 prescribed medication in 11/last year?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-56556')) AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', medication.drugstarttime) = '11'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '015-56556' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "medication" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "medication"."patientunitstayid" WHERE DATETIME("medication"."drugstarttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL AND STRFTIME('%m', "medication"."drugstarttime") = '11'
0.647461
CREATE TABLE table_name_19 (country VARCHAR2, player VARCHAR2)
What country is Adam Scott from?
SELECT country FROM table_name_19 WHERE player = "adam scott"
SELECT "country" FROM "table_name_19" WHERE "adam scott" = "player"
0.06543
CREATE TABLE table_name_32 (top_10 NUMBER, tournament VARCHAR2, wins VARCHAR2)
What is the minimum Top-10 when the Open Championship was the tournament and the wins greater than 0?
SELECT MIN(top_10) FROM table_name_32 WHERE tournament = "the open championship" AND wins > 0
SELECT MIN("top_10") FROM "table_name_32" WHERE "the open championship" = "tournament" AND "wins" > 0
0.098633
CREATE TABLE table_name_7 (population__2006_ VARCHAR2, vehicle_registration_code VARCHAR2, population_density VARCHAR2)
What is the 2006 population of the area with vehicle registration code of G and population density of 1,432.0?
SELECT population__2006_ FROM table_name_7 WHERE vehicle_registration_code = "g" AND population_density = "1,432.0"
SELECT "population__2006_" FROM "table_name_7" WHERE "1,432.0" = "population_density" AND "g" = "vehicle_registration_code"
0.120117
CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note 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 ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) 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 flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE 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 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 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 compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description 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 days (days_code VARCHAR2, day_name VARCHAR2)
i would like to fly from ATLANTA to DENVER on 9 15
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND date_day.day_number = 15 AND date_day.month_number = 9 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 15 AND "date_day"."month_number" = 9 AND "date_day"."year" = 1991 JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'ATLANTA' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days" JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'DENVER'
0.692383
CREATE TABLE table_62848 ("Rank" FLOAT, "Athlete" CLOB, "Country" CLOB, "Time" CLOB, "Notes" CLOB)
Who was the athlete from Lithuania?
SELECT "Athlete" FROM table_62848 WHERE "Country" = 'lithuania'
SELECT "Athlete" FROM "table_62848" WHERE "Country" = 'lithuania'
0.063477
CREATE TABLE table_1547951_3 (year VARCHAR2, outcome VARCHAR2, championship VARCHAR2)
Name the total number of years where runner-up and championship is us open
SELECT COUNT(year) FROM table_1547951_3 WHERE outcome = "Runner-up" AND championship = "US Open"
SELECT COUNT("year") FROM "table_1547951_3" WHERE "Runner-up" = "outcome" AND "US Open" = "championship"
0.101563
CREATE TABLE table_train_256 ("id" NUMBER, "mini_mental_state_examination_mmse" NUMBER, "language" CLOB, "mild_cognitive_impairment" BOOLEAN, "moca_score" NUMBER, "dementia" BOOLEAN, "body_mass_index_bmi" FLOAT, "age" FLOAT, "NOUSE" FLOAT)
bmi 20 _ 30 kg / m2
SELECT * FROM table_train_256 WHERE body_mass_index_bmi >= 20 AND body_mass_index_bmi <= 30
SELECT * FROM "table_train_256" WHERE "body_mass_index_bmi" <= 30 AND "body_mass_index_bmi" >= 20
0.094727
CREATE TABLE table_31980 ("Rider" CLOB, "Bike" CLOB, "Laps" FLOAT, "Time" CLOB, "Grid" FLOAT)
Tell me the highest Laps for grid less than 22 and riderS of ruben xaus
SELECT MAX("Laps") FROM table_31980 WHERE "Grid" < '22' AND "Rider" = 'ruben xaus'
SELECT MAX("Laps") FROM "table_31980" WHERE "Grid" < '22' AND "Rider" = 'ruben xaus'
0.082031
CREATE TABLE table_15013825_8 (recopa_sudamericana_1992 VARCHAR2, team VARCHAR2, copa_libertadores_1992 VARCHAR2, copa_conmebol_1992 VARCHAR2)
Name the recopa sudamericana 1992 for did not qualify for libertadores 1992 and round of 16 for bragantino
SELECT recopa_sudamericana_1992 FROM table_15013825_8 WHERE copa_libertadores_1992 = "Did not qualify" AND copa_conmebol_1992 = "Round of 16" AND team = "Bragantino"
SELECT "recopa_sudamericana_1992" FROM "table_15013825_8" WHERE "Bragantino" = "team" AND "Did not qualify" = "copa_libertadores_1992" AND "Round of 16" = "copa_conmebol_1992"
0.170898
CREATE TABLE table_203_835 (id NUMBER, "season" CLOB, "club" CLOB, "country" CLOB, "competition" CLOB, "apps." NUMBER, "goals" NUMBER)
in how many seasons were there at least 20 goals scored ?
SELECT COUNT("season") FROM table_203_835 WHERE "goals" >= 20
SELECT COUNT("season") FROM "table_203_835" WHERE "goals" >= 20
0.061523
CREATE TABLE table_name_29 (attendance VARCHAR2, date VARCHAR2, away VARCHAR2)
When Platense was the away team on 16 August 2008 how many people attended the game?
SELECT attendance FROM table_name_29 WHERE date = "16 august 2008" AND away = "platense"
SELECT "attendance" FROM "table_name_29" WHERE "16 august 2008" = "date" AND "away" = "platense"
0.09375
CREATE TABLE table_11803648_17 (overall NUMBER, club_team VARCHAR2)
NAME THE OVERALL FOR THE OMAHA (USHL) CLUB TEAM
SELECT MIN(overall) FROM table_11803648_17 WHERE club_team = "Omaha (USHL)"
SELECT MIN("overall") FROM "table_11803648_17" WHERE "Omaha (USHL)" = "club_team"
0.079102
CREATE TABLE table_14220 ("Rank" FLOAT, "Heat" FLOAT, "Athlete" CLOB, "Country" CLOB, "Time" FLOAT)
What is the highest time for athlete torri edwards, and a rank larger than 6?
SELECT MAX("Time") FROM table_14220 WHERE "Athlete" = 'torri edwards' AND "Rank" > '6'
SELECT MAX("Time") FROM "table_14220" WHERE "Athlete" = 'torri edwards' AND "Rank" > '6'
0.085938
CREATE TABLE table_27914606_1 (season__number VARCHAR2, us_viewers__millions_ VARCHAR2)
what is the number of the episode in the season that had 7.19 millions of north american viewers?
SELECT season__number FROM table_27914606_1 WHERE us_viewers__millions_ = "7.19"
SELECT "season__number" FROM "table_27914606_1" WHERE "7.19" = "us_viewers__millions_"
0.083984
CREATE TABLE table_60122 ("Player" CLOB, "Country" CLOB, "Year ( s ) won" CLOB, "Total" FLOAT, "To par" FLOAT)
What country is Paul Lawrie from?
SELECT "Country" FROM table_60122 WHERE "Player" = 'paul lawrie'
SELECT "Country" FROM "table_60122" WHERE "Player" = 'paul lawrie'
0.064453
CREATE TABLE table_name_18 (official_website VARCHAR2, dish VARCHAR2, callsign VARCHAR2)
Name the official website which has dish of and callsign of kvtv
SELECT official_website FROM table_name_18 WHERE dish = "•" AND callsign = "kvtv"
SELECT "official_website" FROM "table_name_18" WHERE "callsign" = "kvtv" AND "dish" = "•"
0.086914
CREATE TABLE table_name_47 (assembled VARCHAR2, elected VARCHAR2)
What is the assembled date of the parliament elected in 1620/21?
SELECT assembled FROM table_name_47 WHERE elected = "1620/21"
SELECT "assembled" FROM "table_name_47" WHERE "1620/21" = "elected"
0.06543
CREATE TABLE table_name_94 (result VARCHAR2, week VARCHAR2, opponent VARCHAR2)
What is the result for week 12 against the Green Bay Packers?
SELECT result FROM table_name_94 WHERE week > 12 AND opponent = "green bay packers"
SELECT "result" FROM "table_name_94" WHERE "green bay packers" = "opponent" AND "week" > 12
0.088867
CREATE TABLE table_name_92 (goals VARCHAR2, assists VARCHAR2)
What are the goals of the assists of 5?
SELECT goals FROM table_name_92 WHERE assists = "5"
SELECT "goals" FROM "table_name_92" WHERE "5" = "assists"
0.055664
CREATE TABLE table_name_5 (player VARCHAR2, goals VARCHAR2, tries VARCHAR2)
Which player has more than 0 goals and less than 12 tries?
SELECT player FROM table_name_5 WHERE goals > 0 AND tries < 12
SELECT "player" FROM "table_name_5" WHERE "goals" > 0 AND "tries" < 12
0.068359
CREATE TABLE table_19396259_1 (original_air_date VARCHAR2, production_code VARCHAR2)
Name the original air date for production code of 3t7501
SELECT COUNT(original_air_date) FROM table_19396259_1 WHERE production_code = "3T7501"
SELECT COUNT("original_air_date") FROM "table_19396259_1" WHERE "3T7501" = "production_code"
0.089844
CREATE TABLE table_67902 ("Tournament" CLOB, "2006" CLOB, "2007" CLOB, "2008" CLOB, "2009" CLOB, "2010" CLOB, "2011" CLOB, "2012" CLOB)
What is the 2012 result of a tournament that is 2R in 2007, 1R in 2008 and 1R in 2009?
SELECT "2012" FROM table_67902 WHERE "2009" = '1r' AND "2008" = '1r' AND "2007" = '2r'
SELECT "2012" FROM "table_67902" WHERE "2007" = '2r' AND "2008" = '1r' AND "2009" = '1r'
0.085938
CREATE TABLE table_name_71 (ram___mib__ VARCHAR2, model VARCHAR2)
What is the RAM (MiB) value for the X30 Mid-Range model?
SELECT ram___mib__ FROM table_name_71 WHERE model = "x30 mid-range"
SELECT "ram___mib__" FROM "table_name_71" WHERE "model" = "x30 mid-range"
0.071289
CREATE TABLE table_name_32 (crowd NUMBER, venue VARCHAR2)
What is the size of the smallest crowd that watched a game at Arden Street Oval?
SELECT MIN(crowd) FROM table_name_32 WHERE venue = "arden street oval"
SELECT MIN("crowd") FROM "table_name_32" WHERE "arden street oval" = "venue"
0.074219
CREATE TABLE table_29337 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" CLOB, "Directed by" CLOB, "Written by" CLOB, "Original air date" CLOB, "Production code" CLOB, "U.S. viewers ( million ) " CLOB)
What is the total number of production code listings of episodes written by Matthew Lau?
SELECT COUNT("Production code") FROM table_29337 WHERE "Written by" = 'Matthew Lau'
SELECT COUNT("Production code") FROM "table_29337" WHERE "Written by" = 'Matthew Lau'
0.083008
CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) 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 ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId 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 ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) 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 SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE 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 VoteTypes (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) 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 PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE CloseReasonTypes (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 PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN)
Time Series of R highest rated questions.
SELECT Id, Title, Score, creation_year, creation_month FROM (SELECT p.Id, p.Title, p.Score, YEAR(p.CreationDate) AS creation_year, MONTH(p.CreationDate) AS creation_month, RANK() OVER (PARTITION BY YEAR(p.CreationDate), MONTH(p.CreationDate) ORDER BY p.Score DESC) AS rnk FROM Posts AS p JOIN PostTags AS pt ON pt.PostId = p.Id JOIN Tags AS t ON t.Id = pt.TagId WHERE t.TagName = 'r') AS x WHERE rnk = 1 ORDER BY creation_year, creation_month
SELECT "Id", "Title", "Score", "creation_year", "creation_month" FROM "Posts" "p" JOIN "PostTags" "pt" ON "p"."Id" = "pt"."PostId" JOIN "Tags" "t" ON "pt"."TagId" = "t"."Id" AND "t"."TagName" = 'r' WHERE "rnk" = 1 ORDER BY "creation_year", "creation_month"
0.25
CREATE TABLE table_name_48 (date VARCHAR2, away_team VARCHAR2)
On which date did Footscray play an away game?
SELECT date FROM table_name_48 WHERE away_team = "footscray"
SELECT "date" FROM "table_name_48" WHERE "away_team" = "footscray"
0.064453
CREATE TABLE table_3484 ("Episode #" FLOAT, "Series #" FLOAT, "Title" CLOB, "Director" CLOB, "Writer" CLOB, "Original airdate" CLOB, "Viewers ( in millions ) " CLOB)
What number in the series episode was titled 'Puppy Love'?
SELECT "Series #" FROM table_3484 WHERE "Title" = 'Puppy Love'
SELECT "Series #" FROM "table_3484" WHERE "Title" = 'Puppy Love'
0.0625
CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER) CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER) CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER) 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 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 whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the sum of manager_id over the job_id , and group by attribute job_id by a bar chart.
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID
SELECT "JOB_ID", SUM("MANAGER_ID") FROM "employees" WHERE ("COMMISSION_PCT" <> "null" OR "DEPARTMENT_ID" <> 40) AND ("DEPARTMENT_ID" <> 40 OR "SALARY" <= 12000) AND ("DEPARTMENT_ID" <> 40 OR "SALARY" >= 8000) GROUP BY "JOB_ID"
0.220703
CREATE TABLE table_train_268 ("id" NUMBER, "basal_rate" FLOAT, "systolic_blood_pressure_sbp" NUMBER, "renal_disease" BOOLEAN, "major_illness" BOOLEAN, "creatinine_clearance_cl" FLOAT, "injury_to_body" BOOLEAN, "diastolic_blood_pressure_dbp" NUMBER, "injury_to_limb" BOOLEAN, "hypertension" BOOLEAN, "age" FLOAT, "NOUSE" FLOAT)
uncontrolled arterial hypertension ( resting diastolic blood pressure > 90 mmhg and / or systolic blood pressure > 160 mmhg )
SELECT * FROM table_train_268 WHERE hypertension = 1 OR (diastolic_blood_pressure_dbp > 90 OR systolic_blood_pressure_sbp > 160)
SELECT * FROM "table_train_268" WHERE "diastolic_blood_pressure_dbp" > 90 OR "hypertension" = 1 OR "systolic_blood_pressure_sbp" > 160
0.130859
CREATE TABLE table_201_48 (id NUMBER, "title" CLOB, "year" NUMBER, "peak chart positions\ us" NUMBER, "peak chart positions\ us\ alt." NUMBER, "peak chart positions\ us\ main. rock" NUMBER, "peak chart positions\ aus" NUMBER, "peak chart positions\ aut" NUMBER, "peak chart positions\ fin" NUMBER, "peak chart positions\ ger" NUMBER, "peak chart positions\ nld" NUMBER, "peak chart positions\ swi" NUMBER, "peak chart positions\ uk" NUMBER, "album" CLOB)
by how many chart positions higher did revolving door peak in the uk compared to the peak position of drowning in the uk ?
SELECT ABS((SELECT "peak chart positions\nuk" FROM table_201_48 WHERE "title" = '"revolving door"') - (SELECT "peak chart positions\nuk" FROM table_201_48 WHERE "title" = '"drowning"'))
SELECT ABS((SELECT "peak chart positions\nuk" FROM "table_201_48" WHERE "title" = '"revolving door"') - (SELECT "peak chart positions\nuk" FROM "table_201_48" WHERE "title" = '"drowning"'))
0.18457
CREATE TABLE Allergy_Type (Allergy VARCHAR2, AllergyType VARCHAR2) CREATE TABLE Has_Allergy (StuID NUMBER, Allergy VARCHAR2) CREATE TABLE Student (StuID NUMBER, LName VARCHAR2, Fname VARCHAR2, Age NUMBER, Sex VARCHAR2, Major NUMBER, Advisor NUMBER, city_code VARCHAR2)
A bar chart about how many students live in each city?, and sort by the bar in desc.
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY city_code DESC
SELECT "city_code", COUNT(*) FROM "Student" GROUP BY "city_code" ORDER BY "city_code" DESC
0.087891
CREATE TABLE table_22014431_3 (rank NUMBER, tosses_pyramids VARCHAR2)
What is the rank when 64.5 is tosses/pyramids?
SELECT MAX(rank) FROM table_22014431_3 WHERE tosses_pyramids = "64.5"
SELECT MAX("rank") FROM "table_22014431_3" WHERE "64.5" = "tosses_pyramids"
0.073242
CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE 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 lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME)
how many patients were diagnosed with spinal cord injury - bowel/bladder dysfunction since 2105.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'spinal cord injury - bowel/bladder dysfunction' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2105')
WITH "_u_0" AS (SELECT "diagnosis"."patientunitstayid" FROM "diagnosis" WHERE "diagnosis"."diagnosisname" = 'spinal cord injury - bowel/bladder dysfunction' AND STRFTIME('%y', "diagnosis"."diagnosistime") >= '2105' GROUP BY "patientunitstayid") SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL
0.391602
CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE 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 vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME)
what are the top five most common surgeries of patients of age 30s in 2101?
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 30 AND 39) AND STRFTIME('%y', treatment.treatmenttime) = '2101' GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 5
WITH "_u_0" AS (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."age" <= 39 AND "patient"."age" >= 30 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 NOT "_u_0"."" IS NULL AND STRFTIME('%y', "treatment"."treatmenttime") = '2101' GROUP BY "treatment"."treatmentname") SELECT "t1"."treatmentname" FROM "t1" "t1" WHERE "t1"."c1" <= 5
0.510742
CREATE TABLE table_56522 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
Which away team has an away team score of 11.16 (82)?
SELECT "Away team" FROM table_56522 WHERE "Away team score" = '11.16 (82)'
SELECT "Away team" FROM "table_56522" WHERE "Away team score" = '11.16 (82)'
0.074219
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid 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)
tell me the ethnicity and name of the patient who has patient id 29961.
SELECT demographic.name, demographic.ethnicity FROM demographic WHERE demographic.subject_id = "29961"
SELECT "demographic"."name", "demographic"."ethnicity" FROM "demographic" WHERE "29961" = "demographic"."subject_id"
0.113281
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 allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME)
was the respiration value of patient 027-120551 last measured on the last icu visit greater than the value second to last measured on the last icu visit?
SELECT (SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-120551') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND NOT vitalperiodic.respiration IS NULL ORDER BY vitalperiodic.observationtime DESC LIMIT 1) > (SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-120551') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND NOT vitalperiodic.respiration IS NULL ORDER BY vitalperiodic.observationtime DESC LIMIT 1 OFFSET 1)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '027-120551' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL GROUP BY "patientunitstayid" ORDER BY "patient"."unitadmittime" DESC FETCH FIRST 1 ROWS ONLY), "_u_4" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_3" ON "_u_3"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_3"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL GROUP BY "patientunitstayid" ORDER BY "patient"."unitadmittime" DESC FETCH FIRST 1 ROWS ONLY) SELECT (SELECT "vitalperiodic"."respiration" FROM "vitalperiodic" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."respiration" IS NULL ORDER BY "vitalperiodic"."observationtime" DESC FETCH FIRST 1 ROWS ONLY) > (SELECT "vitalperiodic"."respiration" FROM "vitalperiodic" LEFT JOIN "_u_4" "_u_4" ON "_u_4"."" = "vitalperiodic"."patientunitstayid" WHERE NOT "_u_4"."" IS NULL AND NOT "vitalperiodic"."respiration" IS NULL ORDER BY "vitalperiodic"."observationtime" DESC OFFSET 1 ROWS FETCH FIRST 1 ROWS ONLY)
1.327148
CREATE TABLE table_name_58 (stations VARCHAR2, platforms VARCHAR2, managed_by VARCHAR2, zone VARCHAR2)
Name the stations for zone 5 and 1 platform by tramlink
SELECT stations FROM table_name_58 WHERE managed_by = "tramlink" AND zone = 5 AND platforms = 1
SELECT "stations" FROM "table_name_58" WHERE "managed_by" = "tramlink" AND "platforms" = 1 AND "zone" = 5
0.102539
CREATE TABLE table_56858 ("Name" CLOB, "City" CLOB, "Height ( m ) " FLOAT, "Height ( ft ) " FLOAT, "Floors" FLOAT, "Years as tallest" CLOB)
How high was the highest building in feet in the city of cologne?
SELECT MAX("Height (ft)") FROM table_56858 WHERE "City" = 'cologne'
SELECT MAX("Height (ft)") FROM "table_56858" WHERE "City" = 'cologne'
0.067383