schema
stringlengths
28
5.65k
question
stringlengths
0
990
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
9.17k
weight
float64
0
8.95
CREATE TABLE table_name_87 (home_team VARCHAR, away_team VARCHAR)
What is the Home team with an Away team that is oxford united?
SELECT home_team FROM table_name_87 WHERE away_team = "oxford united"
SELECT "home_team" FROM "table_name_87" WHERE "away_team" = "oxford united"
0.073242
CREATE TABLE table_16779068_5 (total VARCHAR, snatch VARCHAR, one_hand_clean_ VARCHAR, _jerk VARCHAR)
Name the total with one hand clean and jerk is 87.5 and snatch is 87.5
SELECT total FROM table_16779068_5 WHERE one_hand_clean_ & _jerk = "87.5" AND snatch = "87.5"
SELECT "total" FROM "table_16779068_5" WHERE "87.5" = "snatch" AND "87.5" = "one_hand_clean_" & "_jerk"
0.100586
CREATE TABLE table_name_25 (played VARCHAR, bp VARCHAR, pts_agst VARCHAR)
B.P. of 0, and a Pts Agst smaller than 247 has how many total number of played?
SELECT COUNT(played) FROM table_name_25 WHERE bp = 0 AND pts_agst < 247
SELECT COUNT("played") FROM "table_name_25" WHERE "bp" = 0 AND "pts_agst" < 247
0.077148
CREATE TABLE table_dev_37 ("id" INT, "gender" TEXT, "hemoglobin_a1c_hba1c" FLOAT, "diabetes_mellitus" BOOLEAN, "dysglycemia" BOOLEAN, "creatinine_clearance_cl" FLOAT, "estimated_glomerular_filtration_rate_egfr" INT, "fasting_plasma_glucose" INT, "serum_creatinine" FLOAT, "fasting_glucose" INT, "NOUSE" FLOAT)
screening serum creatinine >= 1.5 mg / dl for male and >= 1.4 mg / dl for female, or creatinine clearance ( crcl ) < 50 ml / min for both male and female
SELECT * FROM table_dev_37 WHERE (serum_creatinine >= 1.5 AND gender = 'male') OR (serum_creatinine >= 1.4 AND gender = 'female') OR creatinine_clearance_cl < 50
SELECT * FROM "table_dev_37" WHERE ("creatinine_clearance_cl" < 50 OR "gender" = 'female' OR "gender" = 'male') AND ("creatinine_clearance_cl" < 50 OR "gender" = 'female' OR "serum_creatinine" >= 1.5) AND ("creatinine_clearance_cl" < 50 OR "serum_creatinine" >= 1.4)
0.259766
CREATE TABLE table_name_1 (points VARCHAR, year INT)
What is the Focus that has a Year bigger than 1977?
SELECT points FROM table_name_1 WHERE year > 1977
SELECT "points" FROM "table_name_1" WHERE "year" > 1977
0.053711
CREATE TABLE Customers (customer_id INT, customer_first_name VARCHAR, customer_middle_initial VARCHAR, customer_last_name VARCHAR, gender VARCHAR, email_address VARCHAR, login_name VARCHAR, login_password VARCHAR, phone_number VARCHAR, town_city VARCHAR, state_county_province VARCHAR, country VARCHAR) CREATE TABLE Invoices (invoice_number INT, order_id INT, invoice_date DATETIME) CREATE TABLE Accounts (account_id INT, customer_id INT, date_account_opened DATETIME, account_name VARCHAR, other_account_details VARCHAR) CREATE TABLE Financial_Transactions (transaction_id INT, account_id INT, invoice_number INT, transaction_type VARCHAR, transaction_date DATETIME, transaction_amount DECIMAL, transaction_comment VARCHAR, other_transaction_details VARCHAR) CREATE TABLE Products (product_id INT, parent_product_id INT, production_type_code VARCHAR, unit_price DECIMAL, product_name VARCHAR, product_color VARCHAR, product_size VARCHAR) CREATE TABLE Product_Categories (production_type_code VARCHAR, product_type_description VARCHAR, vat_rating DECIMAL) CREATE TABLE Invoice_Line_Items (order_item_id INT, invoice_number INT, product_id INT, product_title VARCHAR, product_quantity VARCHAR, product_price DECIMAL, derived_product_cost DECIMAL, derived_vat_payable DECIMAL, derived_total_cost DECIMAL) CREATE TABLE Orders (order_id INT, customer_id INT, date_order_placed DATETIME, order_details VARCHAR) CREATE TABLE Order_Items (order_item_id INT, order_id INT, product_id INT, product_quantity VARCHAR, other_order_item_details VARCHAR)
Show all product names and the total quantity ordered for each product name.
SELECT product_name, SUM(T1.product_quantity) FROM Order_Items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name
SELECT "product_name", SUM("T1"."product_quantity") FROM "Order_Items" AS "T1" JOIN "Products" AS "T2" ON "T1"."product_id" = "T2"."product_id" GROUP BY "T2"."product_name"
0.167969
CREATE TABLE table_54663 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
Where did away team st kilda play with a crowd larger than 22,764?
SELECT "Venue" FROM table_54663 WHERE "Crowd" > '22,764' AND "Away team" = 'st kilda'
SELECT "Venue" FROM "table_54663" WHERE "Away team" = 'st kilda' AND "Crowd" > '22,764'
0.084961
CREATE TABLE table_204_577 (id DECIMAL, "name" TEXT, "first operational" TEXT, "numeral system" TEXT, "computing mechanism" TEXT, "programming" TEXT, "turing complete" TEXT)
what operational date is next to zuse z3 ?
SELECT "first operational" FROM table_204_577 WHERE "name" = 'zuse z3'
SELECT "first operational" FROM "table_204_577" WHERE "name" = 'zuse z3'
0.070313
CREATE TABLE WINE (Winery VARCHAR, SCORE VARCHAR)
Which winery is the wine that has the highest score from?
SELECT Winery FROM WINE ORDER BY SCORE LIMIT 1
SELECT "Winery" FROM "WINE" ORDER BY "SCORE" NULLS FIRST LIMIT 1
0.0625
CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR)
Do you know how long they offered ENGLISH 403 ?
SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ENGLISH' AND course.number = 403 AND semester.semester_id = course_offering.semester ORDER BY semester.year LIMIT 1
SELECT DISTINCT "semester"."year" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" WHERE "course"."department" = 'ENGLISH' AND "course"."number" = 403 ORDER BY "semester"."year" NULLS FIRST LIMIT 1
0.308594
CREATE TABLE table_48325 ("Name" TEXT, "Party" TEXT, "Tenure" TEXT, "Head ( s ) of Government" TEXT, "Ministerial title" TEXT)
What is the head of government for Don Stephen Senanayake?
SELECT "Head(s) of Government" FROM table_48325 WHERE "Name" = 'don stephen senanayake'
SELECT "Head(s) of Government" FROM "table_48325" WHERE "Name" = 'don stephen senanayake'
0.086914
CREATE TABLE table_203_276 (id DECIMAL, "album#" TEXT, "english title" TEXT, "chinese ( traditional ) " TEXT, "chinese ( simplified ) " TEXT, "release date" TEXT, "label" TEXT)
was the album beautiful released before the album love in heart ?
SELECT (SELECT "release date" FROM table_203_276 WHERE "english title" = 'beautiful') < (SELECT "release date" FROM table_203_276 WHERE "english title" = 'love in heart')
SELECT (SELECT "release date" FROM "table_203_276" WHERE "english title" = 'beautiful') < (SELECT "release date" FROM "table_203_276" WHERE "english title" = 'love in heart')
0.169922
CREATE TABLE Accounts (account_id INT, customer_id INT, date_account_opened DATETIME, account_name VARCHAR, other_account_details VARCHAR) CREATE TABLE Order_Items (order_item_id INT, order_id INT, product_id INT, product_quantity VARCHAR, other_order_item_details VARCHAR) CREATE TABLE Financial_Transactions (transaction_id INT, account_id INT, invoice_number INT, transaction_type VARCHAR, transaction_date DATETIME, transaction_amount DECIMAL, transaction_comment VARCHAR, other_transaction_details VARCHAR) CREATE TABLE Orders (order_id INT, customer_id INT, date_order_placed DATETIME, order_details VARCHAR) CREATE TABLE Product_Categories (production_type_code VARCHAR, product_type_description VARCHAR, vat_rating DECIMAL) CREATE TABLE Invoices (invoice_number INT, order_id INT, invoice_date DATETIME) CREATE TABLE Products (product_id INT, parent_product_id INT, production_type_code VARCHAR, unit_price DECIMAL, product_name VARCHAR, product_color VARCHAR, product_size VARCHAR) CREATE TABLE Invoice_Line_Items (order_item_id INT, invoice_number INT, product_id INT, product_title VARCHAR, product_quantity VARCHAR, product_price DECIMAL, derived_product_cost DECIMAL, derived_vat_payable DECIMAL, derived_total_cost DECIMAL) CREATE TABLE Customers (customer_id INT, customer_first_name VARCHAR, customer_middle_initial VARCHAR, customer_last_name VARCHAR, gender VARCHAR, email_address VARCHAR, login_name VARCHAR, login_password VARCHAR, phone_number VARCHAR, town_city VARCHAR, state_county_province VARCHAR, country VARCHAR)
Give me a pie to show how many other account details from different other account details.
SELECT other_account_details, COUNT(other_account_details) FROM Accounts GROUP BY other_account_details
SELECT "other_account_details", COUNT("other_account_details") FROM "Accounts" GROUP BY "other_account_details"
0.108398
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
what is the total amount of input since 12/26/2105 patient 006-2586 had received?
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586')) AND intakeoutput.cellpath LIKE '%intake%' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2105-12-26'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-2586' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT SUM("intakeoutput"."cellvaluenumeric") FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."cellpath" LIKE '%intake%' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m-%d', "intakeoutput"."intakeoutputtime") >= '2105-12-26'
0.633789
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
what was the last time that patient 70516 had a maximum value of anion gap in 11/last year?
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70516) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion gap') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', labevents.charttime) = '11' ORDER BY labevents.valuenum DESC, labevents.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 70516 GROUP BY "hadm_id"), "_u_1" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'anion gap' GROUP BY "itemid") SELECT "labevents"."charttime" FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."hadm_id" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "labevents"."itemid" WHERE DATETIME("labevents"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_0"."" IS NULL AND NOT "_u_1"."" IS NULL AND STRFTIME('%m', "labevents"."charttime") = '11' ORDER BY "labevents"."valuenum" DESC NULLS LAST, "labevents"."charttime" DESC NULLS LAST LIMIT 1
0.711914
CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT) CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT)
Show me about the distribution of Team_Name and ACC_Percent in a bar chart, list X in asc order please.
SELECT Team_Name, ACC_Percent FROM basketball_match ORDER BY Team_Name
SELECT "Team_Name", "ACC_Percent" FROM "basketball_match" ORDER BY "Team_Name" NULLS FIRST
0.087891
CREATE TABLE table_33893 ("Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT)
What was the Score on September 29, 2003?
SELECT "Score" FROM table_33893 WHERE "Date" = 'september 29, 2003'
SELECT "Score" FROM "table_33893" WHERE "Date" = 'september 29, 2003'
0.067383
CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR)
what flights are available from DALLAS to ATLANTA with one way economy fares
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, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND fare_basis.economy = 'YES' AND fare.fare_basis_code = fare_basis.fare_basis_code AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'DALLAS' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" AS "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" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'ATLANTA' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" AND "fare"."round_trip_required" = 'NO' JOIN "fare_basis" ON "fare"."fare_basis_code" = "fare_basis"."fare_basis_code" AND "fare_basis"."economy" = 'YES'
0.769531
CREATE TABLE table_60217 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT, "Money ( \\u00a3 ) " TEXT)
How much money does the player with a 69-70-72-64=275 score have?
SELECT "Money ( \u00a3 )" FROM table_60217 WHERE "Score" = '69-70-72-64=275'
SELECT "Money ( \u00a3 )" FROM "table_60217" WHERE "Score" = '69-70-72-64=275'
0.076172
CREATE TABLE Transactions_Lots (transaction_id INT, lot_id INT) CREATE TABLE Transactions (transaction_id INT, investor_id INT, transaction_type_code VARCHAR, date_of_transaction DATETIME, amount_of_transaction DECIMAL, share_count VARCHAR, other_details VARCHAR) CREATE TABLE Lots (lot_id INT, investor_id INT, lot_details VARCHAR) CREATE TABLE Sales (sales_transaction_id INT, sales_details VARCHAR) CREATE TABLE Investors (investor_id INT, Investor_details VARCHAR) CREATE TABLE Ref_Transaction_Types (transaction_type_code VARCHAR, transaction_type_description VARCHAR) CREATE TABLE Purchases (purchase_transaction_id INT, purchase_details VARCHAR)
What are the purchase details of transactions with amount bigger than 10000, and count them by a bar chart, list by the the number of purchase details from low to high.
SELECT purchase_details, COUNT(purchase_details) FROM Purchases AS T1 JOIN Transactions AS T2 ON T1.purchase_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction > 10000 GROUP BY purchase_details ORDER BY COUNT(purchase_details)
SELECT "purchase_details", COUNT("purchase_details") FROM "Purchases" AS "T1" JOIN "Transactions" AS "T2" ON "T1"."purchase_transaction_id" = "T2"."transaction_id" AND "T2"."amount_of_transaction" > 10000 GROUP BY "purchase_details" ORDER BY COUNT("purchase_details") NULLS FIRST
0.272461
CREATE TABLE table_60692 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To Par" FLOAT)
What was Frank Moore's score?
SELECT "Score" FROM table_60692 WHERE "Player" = 'frank moore'
SELECT "Score" FROM "table_60692" WHERE "Player" = 'frank moore'
0.0625
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
Python gold badgers ordered by date.
SELECT ROW_NUMBER() OVER (ORDER BY b.Date DESC), b.UserId AS "user_link", b.Date AS got_gold_python, u.Reputation AS rep FROM Users AS u, Badges AS b WHERE b.Name = 'python' AND b.Class = 1 AND u.Id = b.UserId GROUP BY b.Date, b.UserId, u.Reputation
SELECT ROW_NUMBER() OVER (ORDER BY "b"."Date" DESC NULLS LAST), "b"."UserId" AS "user_link", "b"."Date" AS "got_gold_python", "u"."Reputation" AS "rep" FROM "Users" AS "u" JOIN "Badges" AS "b" ON "b"."Class" = 1 AND "b"."Name" = 'python' AND "b"."UserId" = "u"."Id" GROUP BY "b"."Date", "b"."UserId", "u"."Reputation"
0.30957
CREATE TABLE table_25017530_5 (position VARCHAR, player VARCHAR)
Name the position for christopher smith
SELECT position FROM table_25017530_5 WHERE player = "Christopher Smith"
SELECT "position" FROM "table_25017530_5" WHERE "Christopher Smith" = "player"
0.076172
CREATE TABLE table_name_1 (wins INT, year VARCHAR, team VARCHAR, points VARCHAR, class VARCHAR)
What is the largest amount of wins when there are less than 5 points, the class is 500cc, the team is norton, and the year is more recent than 1955?
SELECT MAX(wins) FROM table_name_1 WHERE points < 5 AND class = "500cc" AND team = "norton" AND year > 1955
SELECT MAX("wins") FROM "table_name_1" WHERE "500cc" = "class" AND "norton" = "team" AND "points" < 5 AND "year" > 1955
0.116211
CREATE TABLE table_dev_24 ("id" INT, "active_ocular_disease" BOOLEAN, "systolic_blood_pressure_sbp" INT, "active_infection" BOOLEAN, "hemoglobin_a1c_hba1c" FLOAT, "body_weight" FLOAT, "diabetic" TEXT, "seasonal_allergy" BOOLEAN, "retinal_nerve_disease" BOOLEAN, "diastolic_blood_pressure_dbp" INT, "diabetes" BOOLEAN, "glycohemoglobin" FLOAT, "fasting_insulin" INT, "glaucoma" BOOLEAN, "optic_nerve_disease" BOOLEAN, "body_mass_index_bmi" FLOAT, "dry_eye_symptoms" BOOLEAN, "NOUSE" FLOAT)
diagnosed with type ii diabetes defined as a glycohemoglobin between 7.5 % and 10.5 % , and fasting insulin level < 40 ( iu / ml ) .
SELECT * FROM table_dev_24 WHERE diabetic = 'ii' OR (glycohemoglobin >= 7.5 AND glycohemoglobin <= 10.5 AND fasting_insulin < 40)
SELECT * FROM "table_dev_24" WHERE ("diabetic" = 'ii' OR "fasting_insulin" < 40) AND ("diabetic" = 'ii' OR "glycohemoglobin" <= 10.5) AND ("diabetic" = 'ii' OR "glycohemoglobin" >= 7.5)
0.180664
CREATE TABLE table_37919 ("Date" TEXT, "Score" TEXT, "Set 1" TEXT, "Set 2" TEXT, "Set 3" TEXT, "Total" TEXT)
Which Set 1 has a Date of 24 may, and a Total of 57 75?
SELECT "Set 1" FROM table_37919 WHERE "Date" = '24 may' AND "Total" = '57–75'
SELECT "Set 1" FROM "table_37919" WHERE "Date" = '24 may' AND "Total" = '57–75'
0.077148
CREATE TABLE table_78559 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" FLOAT, "To par" TEXT)
What was the To par of the golfer that placed t5?
SELECT "To par" FROM table_78559 WHERE "Place" = 't5'
SELECT "To par" FROM "table_78559" WHERE "Place" = 't5'
0.053711
CREATE TABLE table_21930 ("Episode #" TEXT, "Season #" FLOAT, "Title" TEXT, "Writer ( s ) " TEXT, "Director" TEXT, "Originalairdate" TEXT)
on what date did the episode titled 'A Bright and Shiny Future' originally air?
SELECT "Originalairdate" FROM table_21930 WHERE "Title" = 'A Bright and Shiny Future'
SELECT "Originalairdate" FROM "table_21930" WHERE "Title" = 'A Bright and Shiny Future'
0.084961
CREATE TABLE table_57102 ("Rd #" FLOAT, "Pick #" FLOAT, "Player" TEXT, "Team ( League ) " TEXT, "Reg GP" FLOAT, "Pl GP" FLOAT)
What is the total reg gp of Ilya Krikunov, who has a round of 7 and a pick number larger than 223?
SELECT COUNT("Reg GP") FROM table_57102 WHERE "Rd #" = '7' AND "Player" = 'ilya krikunov' AND "Pick #" > '223'
SELECT COUNT("Reg GP") FROM "table_57102" WHERE "Pick #" > '223' AND "Player" = 'ilya krikunov' AND "Rd #" = '7'
0.109375
CREATE TABLE table_50749 ("2010 ARWU Rankings" TEXT, "2010 QS World Rankings" TEXT, "2010 QS Asian Rankings" TEXT, "2010 eduniversal Rankings" TEXT, "2009 QS Asian Rankings: Intpars_m_singlel faculty review" TEXT, "2009 QS Asian Rankings: Intpars_m_singlel student review" FLOAT, "2000 Singapore \\u201cAsiaweek\\u201d Rankings" TEXT, "University" TEXT, "Local" TEXT, "Median ranks" FLOAT)
What's the ARWU ranking that has the int' student review of 144, a median rank of less than 10, and 2000 Singapore Asiaweek of none?
SELECT "2010 ARWU Rankings" FROM table_50749 WHERE "2000 Singapore \u201cAsiaweek\u201d Rankings" = 'none' AND "Median ranks" < '10' AND "2009 QS Asian Rankings: Int\u2019l student review" = '144'
SELECT "2010 ARWU Rankings" FROM "table_50749" WHERE "2000 Singapore \u201cAsiaweek\u201d Rankings" = 'none' AND "2009 QS Asian Rankings: Int\u2019l student review" = '144' AND "Median ranks" < '10'
0.193359
CREATE TABLE table_19907 ("Series Ep." TEXT, "Episode" FLOAT, "Netflix" TEXT, "Segment A" TEXT, "Segment B" TEXT, "Segment C" TEXT, "Segment D" TEXT)
What is Segment A where Segment D is luxury sports cars?
SELECT "Segment A" FROM table_19907 WHERE "Segment D" = 'Luxury Sports Cars'
SELECT "Segment A" FROM "table_19907" WHERE "Segment D" = 'Luxury Sports Cars'
0.076172
CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT) CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT)
For those records from the products and each product's manufacturer, show me about the distribution of headquarter and the sum of revenue , and group by attribute headquarter in a bar chart, and rank total number from low to high order.
SELECT Headquarter, SUM(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY SUM(Revenue)
SELECT "Headquarter", SUM("Revenue") FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Headquarter" ORDER BY SUM("Revenue") NULLS FIRST
0.180664
CREATE TABLE table_65783 ("Mother Tongue" TEXT, "Population ( 2006 ) " FLOAT, "Percentage ( 2006 ) " TEXT, "Population ( 2011 ) " FLOAT, "Percentage ( 2011 ) " TEXT)
What is the mother tongue language shared by 300 people in 2006?
SELECT "Mother Tongue" FROM table_65783 WHERE "Population (2006)" = '300'
SELECT "Mother Tongue" FROM "table_65783" WHERE "Population (2006)" = '300'
0.073242
CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT)
flights from SAN FRANCISCO 8 1
SELECT DISTINCT flight.flight_id FROM airport_service, city, date_day, days, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'SAN FRANCISCO' AND date_day.day_number = 1 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.from_airport = airport_service.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" JOIN "date_day" ON "date_day"."day_number" = 1 AND "date_day"."month_number" = 8 AND "date_day"."year" = 1991 JOIN "city" ON "airport_service"."city_code" = "city"."city_code" AND "city"."city_name" = 'SAN FRANCISCO' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "airport_service"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days"
0.446289
CREATE TABLE table_77890 ("Vehicle Numbers" TEXT, "Vehicle Types" TEXT, "Livery" TEXT, "Location" TEXT, "Status" TEXT)
what livery has a status of in service as coaching stock?
SELECT "Livery" FROM table_77890 WHERE "Status" = 'in service as coaching stock'
SELECT "Livery" FROM "table_77890" WHERE "Status" = 'in service as coaching stock'
0.080078
CREATE TABLE table_34760 ("Operation" TEXT, "Binary" TEXT, "Binomial" TEXT, "Fibonacci" TEXT, "Pairing" TEXT, "Brodal ***" TEXT, "Strict Fibonacci Heap" TEXT)
Operation of find-min has what Fibonacci?
SELECT "Fibonacci" FROM table_34760 WHERE "Operation" = 'find-min'
SELECT "Fibonacci" FROM "table_34760" WHERE "Operation" = 'find-min'
0.066406
CREATE TABLE table_name_76 (engine_code VARCHAR, model VARCHAR)
What is the engine code for the Xdrive25i?
SELECT engine_code FROM table_name_76 WHERE model = "xdrive25i"
SELECT "engine_code" FROM "table_name_76" WHERE "model" = "xdrive25i"
0.067383
CREATE TABLE table_name_65 (week_5 VARCHAR, week_2 VARCHAR)
Who was the girl of the week 3 weeks after brianne bailey in the same month?
SELECT week_5 FROM table_name_65 WHERE week_2 = "brianne bailey"
SELECT "week_5" FROM "table_name_65" WHERE "brianne bailey" = "week_2"
0.068359
CREATE TABLE table_73202 ("No." FLOAT, "#" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" FLOAT, "Television order" TEXT)
what is the original air date of the episode directed by Ben Jones and written by Steven Melching?
SELECT "Original air date" FROM table_73202 WHERE "Directed by" = 'Ben Jones' AND "Written by" = 'Steven Melching'
SELECT "Original air date" FROM "table_73202" WHERE "Directed by" = 'Ben Jones' AND "Written by" = 'Steven Melching'
0.113281
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
provide the number of patients whose admission location is phys referral/normal deli and procedure icd9 code is 3897?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND procedures.icd9_code = "3897"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "3897" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "PHYS REFERRAL/NORMAL DELI" = "demographic"."admission_location"
0.241211
CREATE TABLE table_17981 ("Member countries" TEXT, "Population" FLOAT, "Area ( km\\u00b2 ) " FLOAT, "GDP ( billion US$ ) " TEXT, "GDP per capita ( US$ ) " FLOAT)
What was the gdp of the country with a gdp per capita of $18048?
SELECT "GDP (billion US$)" FROM table_17981 WHERE "GDP per capita (US$)" = '18048'
SELECT "GDP (billion US$)" FROM "table_17981" WHERE "GDP per capita (US$)" = '18048'
0.082031
CREATE TABLE table_38281 ("Round" FLOAT, "Pick #" FLOAT, "Overall" FLOAT, "Name" TEXT, "Position" TEXT, "College" TEXT)
What is Tommy Nobis' position that has fewer than 16 picks?
SELECT "Position" FROM table_38281 WHERE "Pick #" < '16' AND "Name" = 'tommy nobis'
SELECT "Position" FROM "table_38281" WHERE "Name" = 'tommy nobis' AND "Pick #" < '16'
0.083008
CREATE TABLE table_10049 ("Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT)
Which Venue has a Date of 1 march 2006?
SELECT "Venue" FROM table_10049 WHERE "Date" = '1 march 2006'
SELECT "Venue" FROM "table_10049" WHERE "Date" = '1 march 2006'
0.061523
CREATE TABLE table_name_16 (series VARCHAR, date VARCHAR)
What was the series on may 27?
SELECT series FROM table_name_16 WHERE date = "may 27"
SELECT "series" FROM "table_name_16" WHERE "date" = "may 27"
0.058594
CREATE TABLE table_1341472_15 (result VARCHAR, district VARCHAR)
what's the result with district illinois 15
SELECT result FROM table_1341472_15 WHERE district = "Illinois 15"
SELECT "result" FROM "table_1341472_15" WHERE "Illinois 15" = "district"
0.070313
CREATE TABLE table_27553627_2 (episodes INT, viewers__in_millions_ VARCHAR)
What episode number had 14.41 million viewers?
SELECT MAX(episodes) FROM table_27553627_2 WHERE viewers__in_millions_ = "14.41"
SELECT MAX("episodes") FROM "table_27553627_2" WHERE "14.41" = "viewers__in_millions_"
0.083984
CREATE TABLE table_name_76 (colliery VARCHAR, death_toll VARCHAR)
Which Colliery has a Death toll of 7?
SELECT colliery FROM table_name_76 WHERE death_toll = 7
SELECT "colliery" FROM "table_name_76" WHERE "death_toll" = 7
0.05957
CREATE TABLE table_name_22 (pinyin VARCHAR, simplified VARCHAR)
What is the pinyin when the simplified shows ?
SELECT pinyin FROM table_name_22 WHERE simplified = "南山区"
SELECT "pinyin" FROM "table_name_22" WHERE "simplified" = "南山区"
0.061523
CREATE TABLE table_203_34 (id DECIMAL, "season" TEXT, "appearance" DECIMAL, "interchange" DECIMAL, "tries" DECIMAL, "goals" DECIMAL, "f/g" DECIMAL, "points" DECIMAL)
in 2001 and what other year did he have 55 points ?
SELECT "season" FROM table_203_34 WHERE "points" = 55 AND "season" <> 2001
SELECT "season" FROM "table_203_34" WHERE "points" = 55 AND "season" <> 2001
0.074219
CREATE TABLE table_name_66 (silver VARCHAR, total VARCHAR)
Who has a total number of 76 silver medals?
SELECT COUNT(silver) FROM table_name_66 WHERE total = 76
SELECT COUNT("silver") FROM "table_name_66" WHERE "total" = 76
0.060547
CREATE TABLE table_name_81 (years_for_grizzlies VARCHAR, school_club_team VARCHAR)
What year did the Grizzlies play for the UNLV team?
SELECT years_for_grizzlies FROM table_name_81 WHERE school_club_team = "unlv"
SELECT "years_for_grizzlies" FROM "table_name_81" WHERE "school_club_team" = "unlv"
0.081055
CREATE TABLE table_name_27 (fleet_number_s_ VARCHAR, serial_numbers VARCHAR)
What is the fleet number for the model with Serial number 68056?
SELECT fleet_number_s_ FROM table_name_27 WHERE serial_numbers = "68056"
SELECT "fleet_number_s_" FROM "table_name_27" WHERE "68056" = "serial_numbers"
0.076172
CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT) CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT)
For those records from the products and each product's manufacturer, find name and the sum of manufacturer , and group by attribute name, and visualize them by a bar chart, sort y-axis from high to low order.
SELECT T2.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Manufacturer DESC
SELECT "T2"."Name", "T1"."Manufacturer" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T2"."Name" ORDER BY "T1"."Manufacturer" DESC NULLS LAST
0.19043
CREATE TABLE table_name_86 (college VARCHAR, pick VARCHAR)
Which college's pick was 14?
SELECT college FROM table_name_86 WHERE pick = "14"
SELECT "college" FROM "table_name_86" WHERE "14" = "pick"
0.055664
CREATE TABLE table_name_98 (position VARCHAR, event VARCHAR, year VARCHAR)
What is the position for Discus in 2013?
SELECT position FROM table_name_98 WHERE event = "discus" AND year = 2013
SELECT "position" FROM "table_name_98" WHERE "discus" = "event" AND "year" = 2013
0.079102
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
is any organism found until 3 years ago in patient 12718's last blood (ebv) microbiology test?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12718) AND microbiologyevents.spec_type_desc = 'blood (ebv)' AND NOT microbiologyevents.org_name IS NULL AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY microbiologyevents.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 12718 GROUP BY "hadm_id") SELECT COUNT(*) > 0 FROM "microbiologyevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "microbiologyevents"."hadm_id" WHERE "microbiologyevents"."spec_type_desc" = 'blood (ebv)' AND DATETIME("microbiologyevents"."charttime") <= DATETIME(CURRENT_TIME(), '-3 year') AND NOT "_u_0"."" IS NULL AND NOT "microbiologyevents"."org_name" IS NULL ORDER BY "microbiologyevents"."charttime" DESC NULLS LAST LIMIT 1
0.515625
CREATE TABLE enzyme (id INT, name TEXT, Location TEXT, Product TEXT, Chromosome TEXT, OMIM INT, Porphyria TEXT) CREATE TABLE medicine_enzyme_interaction (enzyme_id INT, medicine_id INT, interaction_type TEXT) CREATE TABLE medicine (id INT, name TEXT, Trade_Name TEXT, FDA_approved TEXT)
Show me a bar chart for what are the ids and trade names of the medicine that can interact with at least 3 enzymes?, and I want to order from low to high by the x axis.
SELECT Trade_Name, id FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id ORDER BY Trade_Name
SELECT "Trade_Name", "id" FROM "medicine" AS "T1" JOIN "medicine_enzyme_interaction" AS "T2" ON "T1"."id" = "T2"."medicine_id" ORDER BY "Trade_Name" NULLS FIRST
0.15625
CREATE TABLE table_name_27 (winner VARCHAR, circuit VARCHAR)
Who was the winner of the Adelaide International Raceway circuit?
SELECT winner FROM table_name_27 WHERE circuit = "adelaide international raceway"
SELECT "winner" FROM "table_name_27" WHERE "adelaide international raceway" = "circuit"
0.084961
CREATE TABLE table_50498 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" FLOAT, "Money ( $ ) " TEXT)
What country has a 72-70-75-72=289 score?
SELECT "Country" FROM table_50498 WHERE "Score" = '72-70-75-72=289'
SELECT "Country" FROM "table_50498" WHERE "Score" = '72-70-75-72=289'
0.067383
CREATE TABLE artist (Artist_ID INT, Artist TEXT, Age INT, Famous_Title TEXT, Famous_Release_date TEXT) CREATE TABLE volume (Volume_ID INT, Volume_Issue TEXT, Issue_Date TEXT, Weeks_on_Top FLOAT, Song TEXT, Artist_ID INT) CREATE TABLE music_festival (ID INT, Music_Festival TEXT, Date_of_ceremony TEXT, Category TEXT, Volume INT, Result TEXT)
A bar chart for what are the number of the category of music festivals with result 'Awarded'?, and I want to order by the X-axis from high to low.
SELECT Category, COUNT(Category) FROM music_festival WHERE Result = "Awarded" GROUP BY Category ORDER BY Category DESC
SELECT "Category", COUNT("Category") FROM "music_festival" WHERE "Awarded" = "Result" GROUP BY "Category" ORDER BY "Category" DESC NULLS LAST
0.137695
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
give me the number of patients whose insurance is medicaid and diagnoses icd9 code is 1532?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicaid" AND diagnoses.icd9_code = "1532"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "1532" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "Medicaid" = "demographic"."insurance"
0.212891
CREATE TABLE table_name_42 (wins INT, played INT)
What is the sum of Wins, when Played is less than 5?
SELECT SUM(wins) FROM table_name_42 WHERE played < 5
SELECT SUM("wins") FROM "table_name_42" WHERE "played" < 5
0.056641
CREATE TABLE table_73919 ("Outcome" TEXT, "No." TEXT, "Date" TEXT, "Championship" TEXT, "Surface" TEXT, "Opponent in the final" TEXT, "Score in the final" TEXT)
Where is the championship where 6 1, 3 6, 3 6 is the score in the final?
SELECT "Championship" FROM table_73919 WHERE "Score in the final" = '6–1, 3–6, 3–6'
SELECT "Championship" FROM "table_73919" WHERE "Score in the final" = '6–1, 3–6, 3–6'
0.083008
CREATE TABLE table_name_29 (home_team VARCHAR, venue VARCHAR)
What Home team plays at the princes park Venue?
SELECT home_team FROM table_name_29 WHERE venue = "princes park"
SELECT "home_team" FROM "table_name_29" WHERE "princes park" = "venue"
0.068359
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
Which patients have 2144-12-08 03:27:00 as the lab test chart time?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.charttime = "2144-12-08 03:27:00"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "2144-12-08 03:27:00" = "lab"."charttime" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.166016
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
when was patient 15821 prescribed for the last time a drug in 01/this year?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15821) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '01' ORDER BY prescriptions.startdate DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 15821 GROUP BY "hadm_id") SELECT "prescriptions"."startdate" FROM "prescriptions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE DATETIME("prescriptions"."startdate", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_0"."" IS NULL AND STRFTIME('%m', "prescriptions"."startdate") = '01' ORDER BY "prescriptions"."startdate" DESC NULLS LAST LIMIT 1
0.493164
CREATE TABLE table_17103 ("Player" TEXT, "Position" TEXT, "School" TEXT, "Hometown" TEXT, "College" TEXT)
Which school has the player Thomas Tyner?
SELECT "School" FROM table_17103 WHERE "Player" = 'Thomas Tyner'
SELECT "School" FROM "table_17103" WHERE "Player" = 'Thomas Tyner'
0.064453
CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT)
what is the first flight that goes from ATLANTA to BALTIMORE that serves BREAKFAST
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, food_service WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND food_service.meal_code = flight.meal_code AND food_service.meal_description = 'BREAKFAST') 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) AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, flight AS FLIGHTalias1, food_service AS FOOD_SERVICEalias1 WHERE (CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'BALTIMORE' AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code AND FOOD_SERVICEalias1.meal_code = FLIGHTalias1.meal_code AND FOOD_SERVICEalias1.meal_description = 'BREAKFAST') AND CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'ATLANTA' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code)
WITH "_u_0" AS (SELECT MIN("FLIGHTalias1"."departure_time") FROM "airport_service" AS "AIRPORT_SERVICEalias2" JOIN "city" AS "CITYalias2" ON "AIRPORT_SERVICEalias2"."city_code" = "CITYalias2"."city_code" AND "CITYalias2"."city_name" = 'ATLANTA' JOIN "flight" AS "FLIGHTalias1" ON "AIRPORT_SERVICEalias2"."airport_code" = "FLIGHTalias1"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICEalias3" ON "AIRPORT_SERVICEalias3"."airport_code" = "FLIGHTalias1"."to_airport" JOIN "food_service" AS "FOOD_SERVICEalias1" ON "FLIGHTalias1"."meal_code" = "FOOD_SERVICEalias1"."meal_code" AND "FOOD_SERVICEalias1"."meal_description" = 'BREAKFAST' JOIN "city" AS "CITYalias3" ON "AIRPORT_SERVICEalias3"."city_code" = "CITYalias3"."city_code" AND "CITYalias3"."city_name" = 'BALTIMORE') SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'ATLANTA' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "flight"."departure_time" JOIN "food_service" ON "flight"."meal_code" = "food_service"."meal_code" AND "food_service"."meal_description" = 'BREAKFAST' JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'BALTIMORE'
1.439453
CREATE TABLE paperkeyphrase (paperid INT, keyphraseid INT) CREATE TABLE paperfield (fieldid INT, paperid INT) CREATE TABLE venue (venueid INT, venuename VARCHAR) CREATE TABLE journal (journalid INT, journalname VARCHAR) CREATE TABLE cite (citingpaperid INT, citedpaperid INT) CREATE TABLE field (fieldid INT) CREATE TABLE author (authorid INT, authorname VARCHAR) CREATE TABLE paperdataset (paperid INT, datasetid INT) CREATE TABLE keyphrase (keyphraseid INT, keyphrasename VARCHAR) CREATE TABLE paper (paperid INT, title VARCHAR, venueid INT, year INT, numciting INT, numcitedby INT, journalid INT) CREATE TABLE writes (paperid INT, authorid INT) CREATE TABLE dataset (datasetid INT, datasetname VARCHAR)
which topics were most popular at ACL 2014
SELECT DISTINCT COUNT(paper.paperid), keyphrase.keyphraseid FROM keyphrase, paper, paperkeyphrase, venue WHERE paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year = 2014 AND venue.venueid = paper.venueid AND venue.venuename = 'ACL' GROUP BY keyphrase.keyphraseid ORDER BY COUNT(paper.paperid) DESC
SELECT DISTINCT COUNT("paper"."paperid"), "keyphrase"."keyphraseid" FROM "keyphrase" JOIN "paperkeyphrase" ON "keyphrase"."keyphraseid" = "paperkeyphrase"."keyphraseid" JOIN "paper" ON "paper"."paperid" = "paperkeyphrase"."paperid" AND "paper"."year" = 2014 JOIN "venue" ON "paper"."venueid" = "venue"."venueid" AND "venue"."venuename" = 'ACL' GROUP BY "keyphrase"."keyphraseid" ORDER BY COUNT("paper"."paperid") DESC NULLS LAST
0.417969
CREATE TABLE table_name_36 (bodyweight INT, snatch VARCHAR, clean_ VARCHAR, _jerk VARCHAR)
What is the least Bodyweight for the Clean & jerk of 145.0, and a Snatch smaller than 122.5?
SELECT MIN(bodyweight) FROM table_name_36 WHERE clean_ & _jerk = "145.0" AND snatch < 122.5
SELECT MIN("bodyweight") FROM "table_name_36" WHERE "145.0" = "clean_" & "_jerk" AND "snatch" < 122.5
0.098633
CREATE TABLE table_29413 ("Athlete" TEXT, "Event" TEXT, "Round of 32" TEXT, "Round of 16" TEXT, "Quarterfinals" TEXT, "Semifinals" TEXT)
When yakup ener is the athlete what is the round of 32?
SELECT "Round of 32" FROM table_29413 WHERE "Athlete" = 'Yakup Şener'
SELECT "Round of 32" FROM "table_29413" WHERE "Athlete" = 'Yakup Şener'
0.069336
CREATE TABLE table_name_66 (result VARCHAR, opponent VARCHAR)
What was the final of the New England Patriots game?
SELECT result FROM table_name_66 WHERE opponent = "new england patriots"
SELECT "result" FROM "table_name_66" WHERE "new england patriots" = "opponent"
0.076172
CREATE TABLE table_37869 ("orbit" TEXT, "center-to-center distance" TEXT, "altitude above the Earth's surface" TEXT, "Orbital period" TEXT, "specific orbital energy" TEXT)
center-to-center distance of 6,900 to 46,300 km involves which orbital period?
SELECT "Orbital period" FROM table_37869 WHERE "center-to-center distance" = '6,900 to 46,300 km'
SELECT "Orbital period" FROM "table_37869" WHERE "center-to-center distance" = '6,900 to 46,300 km'
0.09668
CREATE TABLE table_name_5 (freestyle_leg VARCHAR, country VARCHAR)
What is the freestyle leg for the Netherlands?
SELECT freestyle_leg FROM table_name_5 WHERE country = "netherlands"
SELECT "freestyle_leg" FROM "table_name_5" WHERE "country" = "netherlands"
0.072266
CREATE TABLE table_2618152_1 (title VARCHAR, original_air_date VARCHAR)
What is the title of the episode with the original air date October 21, 1998?
SELECT title FROM table_2618152_1 WHERE original_air_date = "October 21, 1998"
SELECT "title" FROM "table_2618152_1" WHERE "October 21, 1998" = "original_air_date"
0.082031
CREATE TABLE table_26131 ("Election Year" FLOAT, "Assembly" TEXT, "Winning Party/Coalition" TEXT, "Chief Minister" TEXT, "Speaker" TEXT)
What is the name of the speaker if the chief minister is M.G. Ramachandran?
SELECT "Speaker" FROM table_26131 WHERE "Chief Minister" = 'M.G. Ramachandran'
SELECT "Speaker" FROM "table_26131" WHERE "Chief Minister" = 'M.G. Ramachandran'
0.078125
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
how many patients whose year of death is less than or equal to 2168 and item id is 51000?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2168.0" AND lab.itemid = "51000"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "51000" = "lab"."itemid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2168.0" >= "demographic"."dod_year"
0.191406
CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR)
What is the name of PHRMACOL 616 ?
SELECT DISTINCT name FROM course WHERE department = 'PHRMACOL' AND number = 616
SELECT DISTINCT "name" FROM "course" WHERE "department" = 'PHRMACOL' AND "number" = 616
0.084961
CREATE TABLE table_41223 ("Party" TEXT, "Medium Gallup , March 2008" FLOAT, "Strategic Marketing , March 2008" FLOAT, "CeSID , May 2008" FLOAT, "Medium Gallup , May 2008" FLOAT)
What is the sum of Medium Gallup, March 2008 values where the Medium Gallup, May 2008 values are under 10?
SELECT SUM("Medium Gallup, March 2008") FROM table_41223 WHERE "Medium Gallup, May 2008" < '10'
SELECT SUM("Medium Gallup, March 2008") FROM "table_41223" WHERE "Medium Gallup, May 2008" < '10'
0.094727
CREATE TABLE table_204_506 (id DECIMAL, "seasons" DECIMAL, "team" TEXT, "ch.wins" DECIMAL, "promotions" DECIMAL, "relegations" DECIMAL)
how many teams had the most seasons ?
SELECT COUNT("team") FROM table_204_506 WHERE "seasons" = (SELECT MAX("seasons") FROM table_204_506)
SELECT COUNT("team") FROM "table_204_506" WHERE "seasons" = (SELECT MAX("seasons") FROM "table_204_506")
0.101563
CREATE TABLE table_48957 ("Round" FLOAT, "Pick" FLOAT, "Overall" FLOAT, "Name" TEXT, "Position" TEXT, "College" TEXT)
Which Pick has a Name of ed hickerson, and a Round smaller than 10?
SELECT SUM("Pick") FROM table_48957 WHERE "Name" = 'ed hickerson' AND "Round" < '10'
SELECT SUM("Pick") FROM "table_48957" WHERE "Name" = 'ed hickerson' AND "Round" < '10'
0.083984
CREATE TABLE table_name_12 (date VARCHAR, circumstances VARCHAR)
What was the date of natural cause situation?
SELECT date FROM table_name_12 WHERE circumstances = "natural cause"
SELECT "date" FROM "table_name_12" WHERE "circumstances" = "natural cause"
0.072266
CREATE TABLE player (Player_ID INT, name TEXT, Position TEXT, Club_ID INT, Apps FLOAT, Tries FLOAT, Goals TEXT, Points FLOAT) CREATE TABLE club (Club_ID INT, name TEXT, Region TEXT, Start_year TEXT) CREATE TABLE club_rank (Rank FLOAT, Club_ID INT, Gold FLOAT, Silver FLOAT, Bronze FLOAT, Total FLOAT) CREATE TABLE competition_result (Competition_ID INT, Club_ID_1 INT, Club_ID_2 INT, Score TEXT) CREATE TABLE competition (Competition_ID INT, Year FLOAT, Competition_type TEXT, Country TEXT)
Compare the total number of competitions for each country, show Y from high to low order.
SELECT Country, COUNT(Country) FROM competition GROUP BY Country ORDER BY COUNT(Country) DESC
SELECT "Country", COUNT("Country") FROM "competition" GROUP BY "Country" ORDER BY COUNT("Country") DESC NULLS LAST
0.111328
CREATE TABLE table_34441 ("Date" TEXT, "Label" TEXT, "Region" TEXT, "Format" TEXT, "Catalog" TEXT)
What Label is dated April 1986 in 7' single Format in France?
SELECT "Label" FROM table_34441 WHERE "Region" = 'france' AND "Format" = '7" single' AND "Date" = 'april 1986'
SELECT "Label" FROM "table_34441" WHERE "Date" = 'april 1986' AND "Format" = '7" single' AND "Region" = 'france'
0.109375
CREATE TABLE table_2490289_1 (pc_demo VARCHAR, c64_demo VARCHAR)
What won best pc demo when tower power (camelot) won best c64 demo?
SELECT pc_demo FROM table_2490289_1 WHERE c64_demo = "Tower Power (Camelot)"
SELECT "pc_demo" FROM "table_2490289_1" WHERE "Tower Power (Camelot)" = "c64_demo"
0.080078
CREATE TABLE table_69150 ("Rank" FLOAT, "Lane" FLOAT, "Name" TEXT, "Nationality" TEXT, "Time" FLOAT)
for the rank more than 1 and nationality of netherlands, what is the lane?
SELECT AVG("Lane") FROM table_69150 WHERE "Nationality" = 'netherlands' AND "Rank" > '1'
SELECT AVG("Lane") FROM "table_69150" WHERE "Nationality" = 'netherlands' AND "Rank" > '1'
0.087891
CREATE TABLE table_name_95 (theme VARCHAR, issue_price VARCHAR)
What is the Theme of the coin with an Issue Price of $89.95?
SELECT theme FROM table_name_95 WHERE issue_price = "$89.95"
SELECT "theme" FROM "table_name_95" WHERE "$89.95" = "issue_price"
0.064453
CREATE TABLE table_name_21 (tournament VARCHAR)
Which Tournament has a 2010 of 2r, and a 2011 of 1r?
SELECT tournament FROM table_name_21 WHERE 2010 = "2r" AND 2011 = "1r"
SELECT "tournament" FROM "table_name_21" WHERE "1r" = 2011 AND "2r" = 2010
0.072266
CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT)
tell me all the airports in the NEW YORK area
SELECT DISTINCT airport.airport_code FROM airport, airport_service, city WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'NEW YORK'
SELECT DISTINCT "airport"."airport_code" FROM "airport" JOIN "airport_service" ON "airport"."airport_code" = "airport_service"."airport_code" JOIN "city" ON "airport_service"."city_code" = "city"."city_code" AND "city"."city_name" = 'NEW YORK'
0.237305
CREATE TABLE table_67826 ("Year" TEXT, "Start" TEXT, "Qual" TEXT, "Rank" TEXT, "Finish" TEXT, "Laps" FLOAT)
Name the laps for rank of 14 and start of 16
SELECT "Laps" FROM table_67826 WHERE "Rank" = '14' AND "Start" = '16'
SELECT "Laps" FROM "table_67826" WHERE "Rank" = '14' AND "Start" = '16'
0.069336
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
calculate the average age of emergency hospital admission patients who have sepsis primary disease.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.diagnosis = "SEPSIS"
SELECT AVG("demographic"."age") FROM "demographic" WHERE "EMERGENCY" = "demographic"."admission_type" AND "SEPSIS" = "demographic"."diagnosis"
0.138672
CREATE TABLE table_38508 ("Name" TEXT, "Type" TEXT, "Date" TEXT, "Condition" TEXT, "Ownership" TEXT)
What is the Name of the Historic House of the 18th Century?
SELECT "Name" FROM table_38508 WHERE "Type" = 'historic house' AND "Date" = '18th century'
SELECT "Name" FROM "table_38508" WHERE "Date" = '18th century' AND "Type" = 'historic house'
0.089844
CREATE TABLE table_name_35 (score VARCHAR, opponent VARCHAR)
What is the score of the game that was played against Maria Kondratieva?
SELECT score FROM table_name_35 WHERE opponent = "maria kondratieva"
SELECT "score" FROM "table_name_35" WHERE "maria kondratieva" = "opponent"
0.072266
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
count the number of patients whose days of hospital stay is greater than 17 and drug name is potassium phosphate?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "17" AND prescriptions.drug = "Potassium Phosphate"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Potassium Phosphate" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "17" < "demographic"."days_stay"
0.228516
CREATE TABLE table_191105_4 (first_aired VARCHAR, performed_by VARCHAR)
What is the date for the episode performed by Sue Manchester?
SELECT first_aired FROM table_191105_4 WHERE performed_by = "Sue Manchester"
SELECT "first_aired" FROM "table_191105_4" WHERE "Sue Manchester" = "performed_by"
0.080078
CREATE TABLE table_name_18 (team VARCHAR, run_3 VARCHAR)
Which team has run 3 of 1:20.77?
SELECT team FROM table_name_18 WHERE run_3 = "1:20.77"
SELECT "team" FROM "table_name_18" WHERE "1:20.77" = "run_3"
0.058594
CREATE TABLE table_41301 ("Date" TEXT, "Tournament" TEXT, "Surface" TEXT, "Partnering" TEXT, "Opponent in the final" TEXT, "Score" TEXT)
Which tournament was played on 12 February 2001?
SELECT "Tournament" FROM table_41301 WHERE "Date" = '12 february 2001'
SELECT "Tournament" FROM "table_41301" WHERE "Date" = '12 february 2001'
0.070313
CREATE TABLE domain_conference (cid INT, did INT) CREATE TABLE publication (abstract VARCHAR, cid INT, citation_num INT, jid INT, pid INT, reference_num INT, title VARCHAR, year INT) CREATE TABLE domain (did INT, name VARCHAR) CREATE TABLE publication_keyword (kid INT, pid INT) CREATE TABLE domain_journal (did INT, jid INT) CREATE TABLE conference (cid INT, homepage VARCHAR, name VARCHAR) CREATE TABLE domain_keyword (did INT, kid INT) CREATE TABLE author (aid INT, homepage VARCHAR, name VARCHAR, oid INT) CREATE TABLE cite (cited INT, citing INT) CREATE TABLE writes (aid INT, pid INT) CREATE TABLE journal (homepage VARCHAR, jid INT, name VARCHAR) CREATE TABLE domain_author (aid INT, did INT) CREATE TABLE keyword (keyword VARCHAR, kid INT) CREATE TABLE organization (continent VARCHAR, homepage VARCHAR, name VARCHAR, oid INT) CREATE TABLE domain_publication (did INT, pid INT)
return me the author who has the most number of papers containing keyword ' Relational Database ' .
SELECT author.name FROM author, keyword, publication, publication_keyword, writes WHERE keyword.keyword = 'Relational Database' AND publication_keyword.kid = keyword.kid AND publication.pid = publication_keyword.pid AND writes.aid = author.aid AND writes.pid = publication.pid GROUP BY author.name ORDER BY COUNT(DISTINCT (publication.title)) DESC LIMIT 1
SELECT "author"."name" FROM "author" JOIN "writes" ON "author"."aid" = "writes"."aid" JOIN "publication" ON "publication"."pid" = "writes"."pid" JOIN "publication_keyword" ON "publication"."pid" = "publication_keyword"."pid" JOIN "keyword" ON "keyword"."keyword" = 'Relational Database' AND "keyword"."kid" = "publication_keyword"."kid" GROUP BY "author"."name" ORDER BY COUNT(DISTINCT "publication"."title") DESC NULLS LAST LIMIT 1
0.421875
CREATE TABLE table_name_84 (celebrity VARCHAR, famous_for VARCHAR)
What celebrity is famous for being an actor?
SELECT celebrity FROM table_name_84 WHERE famous_for = "actor"
SELECT "celebrity" FROM "table_name_84" WHERE "actor" = "famous_for"
0.066406
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many patients whose admission location is emergency room admit and diagnoses long title is acute diastolic heart failure?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND diagnoses.long_title = "Acute diastolic heart failure"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Acute diastolic heart failure" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "EMERGENCY ROOM ADMIT" = "demographic"."admission_location"
0.258789