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 lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) 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)
how many patients whose lab test name is renal epithelial cells?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Renal Epithelial Cells"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Renal Epithelial Cells" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.165039
CREATE TABLE table_43205 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT, "Money ( $ ) " TEXT)
What T9 Player had a Score of 70-74-69-70=283?
SELECT "Player" FROM table_43205 WHERE "Place" = 't9' AND "Score" = '70-74-69-70=283'
SELECT "Player" FROM "table_43205" WHERE "Place" = 't9' AND "Score" = '70-74-69-70=283'
0.084961
CREATE TABLE Customers (Customer_ID INT, Customer_Details VARCHAR) CREATE TABLE Claims (Claim_ID INT, Policy_ID INT, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INT, Amount_Settled INT) CREATE TABLE Settlements (Settlement_ID INT, Claim_ID INT, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INT, Amount_Settled INT, Customer_Policy_ID INT) CREATE TABLE Payments (Payment_ID INT, Settlement_ID INT, Payment_Method_Code VARCHAR, Date_Payment_Made DATE, Amount_Payment INT) CREATE TABLE Customer_Policies (Policy_ID INT, Customer_ID INT, Policy_Type_Code CHAR, Start_Date DATE, End_Date DATE)
Find the the customer details and id for the customers who had more than one policy. Show the proportion.
SELECT T1.Customer_Details, T1.Customer_ID FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID
SELECT "T1"."Customer_Details", "T1"."Customer_ID" FROM "Customers" AS "T1" JOIN "Customer_Policies" AS "T2" ON "T1"."Customer_ID" = "T2"."Customer_ID"
0.147461
CREATE TABLE table_23224 ("Institution" TEXT, "Location" TEXT, "Nickname" TEXT, "Founded" FLOAT, "Type" TEXT, "Enrollment" FLOAT, "Joined" FLOAT, "Left" FLOAT, "Current Conference" TEXT)
In what year did the school with enrollment of 650 leave?
SELECT "Left" FROM table_23224 WHERE "Enrollment" = '650'
SELECT "Left" FROM "table_23224" WHERE "Enrollment" = '650'
0.057617
CREATE TABLE table_name_20 (album VARCHAR, remixed_by VARCHAR, version VARCHAR)
Which album is the royal g's club mix version, which is remixed by royal garden sound, from?
SELECT album FROM table_name_20 WHERE remixed_by = "royal garden sound" AND version = "royal g's club mix"
SELECT "album" FROM "table_name_20" WHERE "remixed_by" = "royal garden sound" AND "royal g's club mix" = "version"
0.111328
CREATE TABLE table_name_73 (location VARCHAR, district VARCHAR)
What is the location of the tiruchirappalli district?
SELECT location FROM table_name_73 WHERE district = "tiruchirappalli district"
SELECT "location" FROM "table_name_73" WHERE "district" = "tiruchirappalli district"
0.082031
CREATE TABLE problem_log (problem_log_id DECIMAL, assigned_to_staff_id DECIMAL, problem_id DECIMAL, problem_category_code TEXT, problem_status_code TEXT, log_entry_date TIME, log_entry_description TEXT, log_entry_fix TEXT, other_log_details TEXT) CREATE TABLE problem_status_codes (problem_status_code TEXT, problem_status_description TEXT) CREATE TABLE problem_category_codes (problem_category_code TEXT, problem_category_description TEXT) CREATE TABLE product (product_id DECIMAL, product_name TEXT, product_details TEXT) CREATE TABLE staff (staff_id DECIMAL, staff_first_name TEXT, staff_last_name TEXT, other_staff_details TEXT) CREATE TABLE problems (problem_id DECIMAL, product_id DECIMAL, closure_authorised_by_staff_id DECIMAL, reported_by_staff_id DECIMAL, date_problem_reported TIME, date_problem_closed TIME, problem_description TEXT, other_problem_details TEXT)
For the problem with id 10, return the ids and dates of its problem logs.
SELECT problem_log_id, log_entry_date FROM problem_log WHERE problem_id = 10
SELECT "problem_log_id", "log_entry_date" FROM "problem_log" WHERE "problem_id" = 10
0.082031
CREATE TABLE journal_committee (Editor_ID INT, Journal_ID INT, Work_Type TEXT) CREATE TABLE editor (Editor_ID INT, Name TEXT, Age FLOAT) CREATE TABLE journal (Journal_ID INT, Date TEXT, Theme TEXT, Sales INT)
Just compare the number of journal committees of each editor using a histogram, show bar in ascending order.
SELECT Name, COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Editor_ID ORDER BY Name
SELECT "Name", COUNT(*) FROM "editor" AS "T1" JOIN "journal_committee" AS "T2" ON "T1"."Editor_ID" = "T2"."Editor_ID" GROUP BY "T1"."Editor_ID" ORDER BY "Name" NULLS FIRST
0.166992
CREATE TABLE table_51877 ("D 41" TEXT, "D 42" TEXT, "D 43" TEXT, "D 44" TEXT, "D 45" TEXT, "D 46" TEXT, "R 54" TEXT, "R 53" TEXT, "R 52" TEXT, "R 51" TEXT)
Name the D 41 which has a D 43 of r 18
SELECT "D 41" FROM table_51877 WHERE "D 43" = 'r 18'
SELECT "D 41" FROM "table_51877" WHERE "D 43" = 'r 18'
0.052734
CREATE TABLE table_name_27 (noaa VARCHAR, darwin VARCHAR)
What is the NOAA of the higher harmonics that have a Darwin of m sf?
SELECT noaa FROM table_name_27 WHERE darwin = "m sf"
SELECT "noaa" FROM "table_name_27" WHERE "darwin" = "m sf"
0.056641
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 demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
get me the number of patients diagnosed with hemochromatosis due to repeated red blood cell tranfusions.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Hemochromatos-rbc trans"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Hemochromatos-rbc trans" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id"
0.189453
CREATE TABLE table_54595 ("Player" TEXT, "Position" TEXT, "School" TEXT, "Hometown" TEXT, "College" TEXT)
What is the hometown for tre madden?
SELECT "Hometown" FROM table_54595 WHERE "Player" = 'tre madden'
SELECT "Hometown" FROM "table_54595" WHERE "Player" = 'tre madden'
0.064453
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 diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
give the number of patients whose drug route is sc.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.route = "SC"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "SC" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.174805
CREATE TABLE table_name_82 (wins INT, against VARCHAR, draws VARCHAR)
What are the amount of wins when the draws are less than 0 and the against is 1348?
SELECT MIN(wins) FROM table_name_82 WHERE against = 1348 AND draws < 0
SELECT MIN("wins") FROM "table_name_82" WHERE "against" = 1348 AND "draws" < 0
0.076172
CREATE TABLE table_name_42 (artist VARCHAR, points VARCHAR)
Which artist has 13 points?
SELECT artist FROM table_name_42 WHERE points = 13
SELECT "artist" FROM "table_name_42" WHERE "points" = 13
0.054688
CREATE TABLE table_name_48 (college_junior_club_team__league_ VARCHAR, position VARCHAR, round VARCHAR)
Which College/Junior/Club Team (League) has a Position of right wing, and a Round smaller than 3?
SELECT college_junior_club_team__league_ FROM table_name_48 WHERE position = "right wing" AND round < 3
SELECT "college_junior_club_team__league_" FROM "table_name_48" WHERE "position" = "right wing" AND "round" < 3
0.108398
CREATE TABLE table_name_55 (qual VARCHAR, year VARCHAR)
What is 1966's Qual rating?
SELECT qual FROM table_name_55 WHERE year = "1966"
SELECT "qual" FROM "table_name_55" WHERE "1966" = "year"
0.054688
CREATE TABLE table_name_98 (game_site VARCHAR, attendance VARCHAR)
Where did the Jet's play with an attendance of 11,309?
SELECT game_site FROM table_name_98 WHERE attendance = "11,309"
SELECT "game_site" FROM "table_name_98" WHERE "11,309" = "attendance"
0.067383
CREATE TABLE code_description (code VARCHAR, description 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 days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id 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 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 month (month_number INT, month_name TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) 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 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 airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant 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_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name 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 time_interval (period TEXT, begin_time INT, end_time INT)
please show me round trip tickets from DENVER to OAKLAND
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, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' 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.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' 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" = 'DENVER' 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" = 'OAKLAND' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" AND NOT "fare"."round_trip_cost" IS NULL
0.65918
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)
Visualize a bar chart about the distribution of All_Games and All_Games_Percent , display Y-axis in ascending order.
SELECT All_Games, All_Games_Percent FROM basketball_match ORDER BY All_Games_Percent
SELECT "All_Games", "All_Games_Percent" FROM "basketball_match" ORDER BY "All_Games_Percent" NULLS FIRST
0.101563
CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE 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_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 area (course_id INT, area VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text 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 course_prerequisite (pre_course_id INT, course_id INT)
Can you tell me if there is a 11 -credit ASIAN 400 -level course ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE program_course.category LIKE '%ULCS%' AND semester.semester = 'FA' AND semester.year = 2016
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%ULCS%' JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'FA' AND "semester"."year" = 2016
0.416016
CREATE TABLE table_204_414 (id DECIMAL, "name" TEXT, "armenian" TEXT, "location" TEXT, "# of prisoners designed for" DECIMAL, "notes" TEXT)
what is the number of prisoners that hrazdan is designed to hold ?
SELECT "# of prisoners designed for" FROM table_204_414 WHERE "name" = 'hrazdan'
SELECT "# of prisoners designed for" FROM "table_204_414" WHERE "name" = 'hrazdan'
0.080078
CREATE TABLE table_72630 ("Scientific Linux Release" TEXT, "Architectures" TEXT, "RHEL base" TEXT, "Scientific Linux release date" TEXT, "RHEL release date" TEXT, "Delay" TEXT)
When is the rhel release date when scientific linux release is 3.0.4
SELECT "RHEL release date" FROM table_72630 WHERE "Scientific Linux Release" = '3.0.4'
SELECT "RHEL release date" FROM "table_72630" WHERE "Scientific Linux Release" = '3.0.4'
0.085938
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime 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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
what was the name of the drug that was prescribed to patient 005-73237 during the same day after having had a enteral feeds - nutritional supplement procedure in a month before?
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-73237') AND treatment.treatmentname = 'enteral feeds - nutritional supplement' AND DATETIME(treatment.treatmenttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-73237') AND DATETIME(medication.drugstarttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.drugstarttime AND DATETIME(t1.treatmenttime, 'start of day') = DATETIME(t2.drugstarttime, 'start of day')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '005-73237' GROUP BY "patienthealthsystemstayid"), "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_1" ON "_u_1"."" = "patient"."patienthealthsystemstayid" WHERE DATETIME("medication"."drugstarttime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND NOT "_u_1"."" IS NULL) SELECT "t2"."drugname" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" JOIN "t2" AS "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND "t2"."drugstarttime" > "treatment"."treatmenttime" AND DATETIME("t2"."drugstarttime", 'start of day') = DATETIME("treatment"."treatmenttime", 'start of day') WHERE "treatment"."treatmentname" = 'enteral feeds - nutritional supplement' AND DATETIME("treatment"."treatmenttime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND NOT "_u_0"."" IS NULL
1.194336
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
tell me the time of admission and dosage of drug for patient with patient id 74032.
SELECT demographic.admittime, prescriptions.drug_dose FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "74032"
SELECT "demographic"."admittime", "prescriptions"."drug_dose" FROM "demographic" JOIN "prescriptions" ON "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "74032" = "demographic"."subject_id"
0.194336
CREATE TABLE county (county_id DECIMAL, county_name TEXT, population DECIMAL, zip_code TEXT) CREATE TABLE election (election_id DECIMAL, counties_represented TEXT, district DECIMAL, delegate TEXT, party DECIMAL, first_elected DECIMAL, committee TEXT) CREATE TABLE party (party_id DECIMAL, year DECIMAL, party TEXT, governor TEXT, lieutenant_governor TEXT, comptroller TEXT, attorney_general TEXT, us_senate TEXT)
Show the name of the county with the biggest population.
SELECT county_name FROM county ORDER BY population DESC LIMIT 1
SELECT "county_name" FROM "county" ORDER BY "population" DESC NULLS LAST LIMIT 1
0.078125
CREATE TABLE table_1353096_1 (station VARCHAR, primary_affiliation VARCHAR, owned_since VARCHAR)
How many stations have fox as the primary affiliation and have been owned since 1986?
SELECT COUNT(station) FROM table_1353096_1 WHERE primary_affiliation = "Fox" AND owned_since = "1986"
SELECT COUNT("station") FROM "table_1353096_1" WHERE "1986" = "owned_since" AND "Fox" = "primary_affiliation"
0.106445
CREATE TABLE table_name_61 (winner VARCHAR, circuit VARCHAR)
Which driver won the Phillip Island Grand Prix Circuit?
SELECT winner FROM table_name_61 WHERE circuit = "phillip island grand prix circuit"
SELECT "winner" FROM "table_name_61" WHERE "circuit" = "phillip island grand prix circuit"
0.087891
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) 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 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 TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE 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 VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE 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 CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
SO - Total Posts by Database Server Per Month - MySQL.
SELECT CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, 'MySQL' AS TagName, COUNT(*) AS PostCount FROM Posts AS P INNER JOIN PostTags AS PT ON (P.Id = PT.PostId) INNER JOIN Tags AS T ON (PT.TagId = T.Id) WHERE T.TagName LIKE 'mysql%' GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY YEAR(P.CreationDate) DESC, MONTH(P.CreationDate) DESC
SELECT CONCAT(YEAR("P"."CreationDate"), '-', MONTH("P"."CreationDate")) AS "YearMonth", 'MySQL' AS "TagName", COUNT(*) AS "PostCount" FROM "Posts" AS "P" JOIN "PostTags" AS "PT" ON "P"."Id" = "PT"."PostId" JOIN "Tags" AS "T" ON "PT"."TagId" = "T"."Id" AND "T"."TagName" LIKE 'mysql%' GROUP BY YEAR("P"."CreationDate"), MONTH("P"."CreationDate") ORDER BY YEAR("P"."CreationDate") DESC NULLS LAST, MONTH("P"."CreationDate") DESC NULLS LAST
0.426758
CREATE TABLE station (id INT, name TEXT, lat DECIMAL, long DECIMAL, dock_count INT, city TEXT, installation_date TEXT) CREATE TABLE trip (id INT, duration INT, start_date TEXT, start_station_name TEXT, start_station_id INT, end_date TEXT, end_station_name TEXT, end_station_id INT, bike_id INT, subscription_type TEXT, zip_code INT) CREATE TABLE status (station_id INT, bikes_available INT, docks_available INT, time TEXT) CREATE TABLE weather (date TEXT, max_temperature_f INT, mean_temperature_f INT, min_temperature_f INT, max_dew_point_f INT, mean_dew_point_f INT, min_dew_point_f INT, max_humidity INT, mean_humidity INT, min_humidity INT, max_sea_level_pressure_inches DECIMAL, mean_sea_level_pressure_inches DECIMAL, min_sea_level_pressure_inches DECIMAL, max_visibility_miles INT, mean_visibility_miles INT, min_visibility_miles INT, max_wind_Speed_mph INT, mean_wind_speed_mph INT, max_gust_speed_mph INT, precipitation_inches INT, cloud_cover INT, events TEXT, wind_dir_degrees INT, zip_code INT)
Give me the dates when the max temperature was higher than 85, and count them by a bar chart, and display in descending by the y-axis.
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f > 85 ORDER BY COUNT(date) DESC
SELECT "date", COUNT("date") FROM "weather" WHERE "max_temperature_f" > 85 ORDER BY COUNT("date") DESC NULLS LAST
0.110352
CREATE TABLE table_204_976 (id DECIMAL, "pos" TEXT, "driver" TEXT, "entrant" TEXT, "constructor" TEXT, "time/retired" TEXT, "grid" DECIMAL)
how many racers had cooper climax as their constructor ?
SELECT COUNT("driver") FROM table_204_976 WHERE "constructor" = 'cooper-climax'
SELECT COUNT("driver") FROM "table_204_976" WHERE "constructor" = 'cooper-climax'
0.079102
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE 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 lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
how many patients have received vte prophylaxis - conventional heparin therapy until 3 years ago within 2 months after being diagnosed with coagulopathy - severe?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'coagulopathy - severe' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-3 year')) AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'vte prophylaxis - conventional heparin therapy' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-3 year')) AS t2 WHERE t1.diagnosistime < t2.treatmenttime AND DATETIME(t2.treatmenttime) BETWEEN DATETIME(t1.diagnosistime) AND DATETIME(t1.diagnosistime, '+2 month')
SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "treatment" ON "diagnosis"."diagnosistime" < "treatment"."treatmenttime" AND "treatment"."treatmentname" = 'vte prophylaxis - conventional heparin therapy' AND DATETIME("diagnosis"."diagnosistime") <= DATETIME("treatment"."treatmenttime") AND DATETIME("diagnosis"."diagnosistime", '+2 month') >= DATETIME("treatment"."treatmenttime") AND DATETIME("treatment"."treatmenttime") <= DATETIME(CURRENT_TIME(), '-3 year') JOIN "patient" AS "patient_2" ON "patient_2"."patientunitstayid" = "treatment"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 'coagulopathy - severe' AND DATETIME("diagnosis"."diagnosistime") <= DATETIME(CURRENT_TIME(), '-3 year')
0.78418
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)
get the number of patients categorized under blood gas lab test who were diagnosed with septic shock.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Septic shock" AND lab."CATEGORY" = "Blood Gas"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Septic shock" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "Blood Gas" = "lab"."CATEGORY" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.267578
CREATE TABLE table_7523 ("Event" TEXT, "2006\\u201307" TEXT, "2007\\u201308" TEXT, "2008\\u201309" TEXT, "2010\\u201311" TEXT)
What kind of 2006 07 event has a 2010 11 of n/a and an Event of colonial square?
SELECT "2006\u201307" FROM table_7523 WHERE "2010\u201311" = 'n/a' AND "Event" = 'colonial square'
SELECT "2006\u201307" FROM "table_7523" WHERE "2010\u201311" = 'n/a' AND "Event" = 'colonial square'
0.097656
CREATE TABLE table_57805 ("Annual ridership ( 2012 ) " FLOAT, "Rider. per mile" FLOAT, "Opened" FLOAT, "Stations" FLOAT, "Lines" FLOAT)
Which station has 3,871 riders per mile, and an annual ridership in 2012 of larger than 15,399,400?
SELECT MAX("Stations") FROM table_57805 WHERE "Rider. per mile" = '3,871' AND "Annual ridership (2012)" > '15,399,400'
SELECT MAX("Stations") FROM "table_57805" WHERE "Annual ridership (2012)" > '15,399,400' AND "Rider. per mile" = '3,871'
0.117188
CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college 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 area (course_id INT, area 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 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_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) 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 comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_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)
In Spring and Summer how many 300 -level classes are being offered ?
SELECT COUNT(DISTINCT course.course_id, semester.semester) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 300 AND 300 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = course_offering.semester AND semester.year = 2016
SELECT COUNT(DISTINCT "course"."course_id", "semester"."semester") FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" IN ('SP', 'SS', 'SU') AND "semester"."year" = 2016 WHERE "course"."department" = 'department0' AND "course"."number" <= 400 AND "course"."number" >= 300
0.40332
CREATE TABLE table_36301 ("Distribution" TEXT, "x86-64" TEXT, "ia64" TEXT, "ppc64" TEXT, "sparc32" TEXT, "hppa" TEXT, "mips" TEXT, "s390" TEXT, "s390x" TEXT, "alpha" TEXT, "m68k" TEXT)
Which s390x contains a yes ia64 and a no for alpha?
SELECT "s390x" FROM table_36301 WHERE "ia64" = 'yes' AND "alpha" = 'no'
SELECT "s390x" FROM "table_36301" WHERE "alpha" = 'no' AND "ia64" = 'yes'
0.071289
CREATE TABLE table_name_47 (home_team VARCHAR)
Which Home team score has a Home team of geelong?
SELECT home_team AS score FROM table_name_47 WHERE home_team = "geelong"
SELECT "home_team" AS "score" FROM "table_name_47" WHERE "geelong" = "home_team"
0.078125
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
until 4 years ago, what was the first hospital admission time for patient 003-48563?
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '003-48563' AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY patient.hospitaladmittime LIMIT 1
SELECT "patient"."hospitaladmittime" FROM "patient" WHERE "patient"."uniquepid" = '003-48563' AND DATETIME("patient"."hospitaladmittime") <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY "patient"."hospitaladmittime" NULLS FIRST LIMIT 1
0.229492
CREATE TABLE table_58556 ("Rank" TEXT, "Nation" TEXT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
What was the bronze medal count of the team that finished with 47 total medals?
SELECT AVG("Bronze") FROM table_58556 WHERE "Total" = '47'
SELECT AVG("Bronze") FROM "table_58556" WHERE "Total" = '47'
0.058594
CREATE TABLE table_34294 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Location" TEXT, "Record" TEXT)
What is the Game held on february 9?
SELECT "Game" FROM table_34294 WHERE "Date" = 'february 9'
SELECT "Game" FROM "table_34294" WHERE "Date" = 'february 9'
0.058594
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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_procedures (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 prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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 d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
what is the name of the insurance in patient 57050 on this hospital encounter?
SELECT admissions.insurance FROM admissions WHERE admissions.subject_id = 57050 AND admissions.dischtime IS NULL
SELECT "admissions"."insurance" FROM "admissions" WHERE "admissions"."dischtime" IS NULL AND "admissions"."subject_id" = 57050
0.123047
CREATE TABLE table_name_72 (rank VARCHAR, qual VARCHAR)
For the car with a qual of 134.288, what was the rank?
SELECT rank FROM table_name_72 WHERE qual = "134.288"
SELECT "rank" FROM "table_name_72" WHERE "134.288" = "qual"
0.057617
CREATE TABLE table_name_33 (class VARCHAR, part_2 VARCHAR)
what is the class when part 2 is bond?
SELECT class FROM table_name_33 WHERE part_2 = "bond"
SELECT "class" FROM "table_name_33" WHERE "bond" = "part_2"
0.057617
CREATE TABLE table_43380 ("Name" TEXT, "Processor" TEXT, "Hard Drive" TEXT, "Ethernet Ports" TEXT, "Dimensions" TEXT)
What is the ethernet ports of the m1500 appliance?
SELECT "Ethernet Ports" FROM table_43380 WHERE "Name" = 'm1500'
SELECT "Ethernet Ports" FROM "table_43380" WHERE "Name" = 'm1500'
0.063477
CREATE TABLE table_203_57 (id DECIMAL, "year" DECIMAL, "round" TEXT, "against" TEXT, "score" TEXT, "scorers" TEXT)
the most goals scored in a game
SELECT MAX("score" + "score") FROM table_203_57
SELECT MAX("score" + "score") FROM "table_203_57"
0.047852
CREATE TABLE table_73729 ("Country" TEXT, "Annual CO2 emissions ( in thousands of metric tons ) " FLOAT, "GDP ( current , in billions of US dollars ) " TEXT, "GDP per Emissions ( in US dollars per ton ) " FLOAT, "GDP ( PPP , in billions of current international dollars ) " TEXT, "PPP GDP per Emissions ( in international dollars per ton ) " FLOAT)
When the gdp (ppp, in billions of current international dollars) is 7.93, what is the maximum ppp gdp per emissions (in international dollars per ton)?
SELECT MAX("PPP GDP per Emissions (in international dollars per ton)") FROM table_73729 WHERE "GDP (PPP, in billions of current international dollars)" = '7.93'
SELECT MAX("PPP GDP per Emissions (in international dollars per ton)") FROM "table_73729" WHERE "GDP (PPP, in billions of current international dollars)" = '7.93'
0.158203
CREATE TABLE table_name_43 (score VARCHAR, location VARCHAR, champion VARCHAR)
When John Mcenroe won at Montreal, what was the score?
SELECT score FROM table_name_43 WHERE location = "montreal" AND champion = "john mcenroe"
SELECT "score" FROM "table_name_43" WHERE "champion" = "john mcenroe" AND "location" = "montreal"
0.094727
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 procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
what is procedure icd9 code of subject id 3343?
SELECT procedures.icd9_code FROM procedures WHERE procedures.subject_id = "3343"
SELECT "procedures"."icd9_code" FROM "procedures" WHERE "3343" = "procedures"."subject_id"
0.087891
CREATE TABLE table_3372 ("Date ( YYYY-MM-DD ) " TEXT, "Time ( UTC ) " TEXT, "Latitude" TEXT, "Longitude" TEXT, "Depth" TEXT, "Magnitude" TEXT)
If the longitude is 158.091 e, what is the depth?
SELECT "Depth" FROM table_3372 WHERE "Longitude" = '158.091° E'
SELECT "Depth" FROM "table_3372" WHERE "Longitude" = '158.091° E'
0.063477
CREATE TABLE table_name_88 (evening_gown INT, swimsuit VARCHAR, average VARCHAR)
What is the sum of Evening Gown scores where the swimsuit score is higher than 9.4 and the average score is lower than 9.733?
SELECT SUM(evening_gown) FROM table_name_88 WHERE swimsuit > 9.4 AND average < 9.733
SELECT SUM("evening_gown") FROM "table_name_88" WHERE "average" < 9.733 AND "swimsuit" > 9.4
0.089844
CREATE TABLE Video_games (gtype VARCHAR)
Show all video game types and the number of video games in each type.
SELECT gtype, COUNT(*) FROM Video_games GROUP BY gtype
SELECT "gtype", COUNT(*) FROM "Video_games" GROUP BY "gtype"
0.058594
CREATE TABLE table_69065 ("Heat" FLOAT, "Lane" FLOAT, "Name" TEXT, "Nationality" TEXT, "Time" TEXT)
what lane was new zealand in?
SELECT "Lane" FROM table_69065 WHERE "Nationality" = 'new zealand'
SELECT "Lane" FROM "table_69065" WHERE "Nationality" = 'new zealand'
0.066406
CREATE TABLE table_10859 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" FLOAT)
What was the attendance on October 27, 1968?
SELECT MAX("Week") FROM table_10859 WHERE "Date" = 'october 27, 1968'
SELECT MAX("Week") FROM "table_10859" WHERE "Date" = 'october 27, 1968'
0.069336
CREATE TABLE table_67363 ("Name" TEXT, "Species Authority" TEXT, "Order" TEXT, "Family" TEXT, "Red List" FLOAT)
What is the name for the species Authority of sigmodon hispidus say & ord, 1825?
SELECT "Name" FROM table_67363 WHERE "Species Authority" = 'sigmodon hispidus say & ord, 1825'
SELECT "Name" FROM "table_67363" WHERE "Species Authority" = 'sigmodon hispidus say & ord, 1825'
0.09375
CREATE TABLE department (dept_address VARCHAR, school_code VARCHAR)
How many different locations does the school with code BUS has?
SELECT COUNT(DISTINCT dept_address) FROM department WHERE school_code = 'BUS'
SELECT COUNT(DISTINCT "dept_address") FROM "department" WHERE "school_code" = 'BUS'
0.081055
CREATE TABLE table_23722304_2 (bore__mm_ VARCHAR, vehicle_code VARCHAR)
what is the bore where the vehicle code is t214?
SELECT bore__mm_ FROM table_23722304_2 WHERE vehicle_code = "T214"
SELECT "bore__mm_" FROM "table_23722304_2" WHERE "T214" = "vehicle_code"
0.070313
CREATE TABLE View_Unit_Status (apt_id INT, apt_booking_id INT, status_date DATETIME, available_yn BIT) CREATE TABLE Apartment_Bookings (apt_booking_id INT, apt_id INT, guest_id INT, booking_status_code CHAR, booking_start_date DATETIME, booking_end_date DATETIME) CREATE TABLE Guests (guest_id INT, gender_code CHAR, guest_first_name VARCHAR, guest_last_name VARCHAR, date_of_birth DATETIME) CREATE TABLE Apartments (apt_id INT, building_id INT, apt_type_code CHAR, apt_number CHAR, bathroom_count INT, bedroom_count INT, room_count CHAR) CREATE TABLE Apartment_Facilities (apt_id INT, facility_code CHAR) CREATE TABLE Apartment_Buildings (building_id INT, building_short_name CHAR, building_full_name VARCHAR, building_description VARCHAR, building_address VARCHAR, building_manager VARCHAR, building_phone VARCHAR)
A bar chart for returning the number of the date of birth for all the guests with gender code 'Male'.
SELECT date_of_birth, COUNT(date_of_birth) FROM Guests WHERE gender_code = "Male"
SELECT "date_of_birth", COUNT("date_of_birth") FROM "Guests" WHERE "Male" = "gender_code"
0.086914
CREATE TABLE table_73501 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
How many people got high points in game 35?
SELECT COUNT("High points") FROM table_73501 WHERE "Game" = '35'
SELECT COUNT("High points") FROM "table_73501" WHERE "Game" = '35'
0.064453
CREATE TABLE table_16766 ("Race Name" TEXT, "Circuit" TEXT, "Date" TEXT, "Winning driver" TEXT, "Constructor" TEXT, "Report" TEXT)
Who constructed the Syracuse circuit?
SELECT "Constructor" FROM table_16766 WHERE "Circuit" = 'Syracuse'
SELECT "Constructor" FROM "table_16766" WHERE "Circuit" = 'Syracuse'
0.066406
CREATE TABLE table_name_85 (pos VARCHAR)
What is the 2012 club of the cf pos. player?
SELECT 2012 AS _club FROM table_name_85 WHERE pos = "cf"
SELECT 2012 AS "_club" FROM "table_name_85" WHERE "cf" = "pos"
0.060547
CREATE TABLE table_name_8 (owner VARCHAR, format VARCHAR)
Who is the owner of the radio station that plays adult hits?
SELECT owner FROM table_name_8 WHERE format = "adult hits"
SELECT "owner" FROM "table_name_8" WHERE "adult hits" = "format"
0.0625
CREATE TABLE table_19787093_1 (till_mathura INT, till_aligarh VARCHAR)
If the till aligarh is 150, what the mac till mathura?
SELECT MAX(till_mathura) FROM table_19787093_1 WHERE till_aligarh = 150
SELECT MAX("till_mathura") FROM "table_19787093_1" WHERE "till_aligarh" = 150
0.075195
CREATE TABLE table_name_95 (game INT, date VARCHAR)
What was the first game played on February 28?
SELECT MIN(game) FROM table_name_95 WHERE date = "february 28"
SELECT MIN("game") FROM "table_name_95" WHERE "date" = "february 28"
0.066406
CREATE TABLE table_204_29 (id DECIMAL, "rank" DECIMAL, "lane" DECIMAL, "name" TEXT, "nationality" TEXT, "time" TEXT, "notes" TEXT)
how many swimmers swam at least a 1:59.99 race ?
SELECT COUNT("name") FROM table_204_29 WHERE "time" = 1
SELECT COUNT("name") FROM "table_204_29" WHERE "time" = 1
0.055664
CREATE TABLE table_58463 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
When did the away team score 7.16 (58)?
SELECT "Date" FROM table_58463 WHERE "Away team score" = '7.16 (58)'
SELECT "Date" FROM "table_58463" WHERE "Away team score" = '7.16 (58)'
0.068359
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
what are the top four most frequent procedures that patients received within the same hospital visit after they were diagnosed with av block in 2105?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'av block' AND STRFTIME('%y', diagnosis.diagnosistime) = '2105') AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmentname, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', treatment.treatmenttime) = '2105') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.treatmenttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.treatmentname) AS t3 WHERE t3.c1 <= 4
WITH "t2" AS (SELECT "patient"."uniquepid", "treatment"."treatmentname", "treatment"."treatmenttime", "patient"."patienthealthsystemstayid" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" WHERE STRFTIME('%y', "treatment"."treatmenttime") = '2105'), "t3" AS (SELECT "t2"."treatmentname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."treatmenttime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "diagnosis"."diagnosisname" = 'av block' AND STRFTIME('%y', "diagnosis"."diagnosistime") = '2105' GROUP BY "t2"."treatmentname") SELECT "t3"."treatmentname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 4
0.873047
CREATE TABLE table_62341 ("Rank" TEXT, "Nation" TEXT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
What is Total, when Silver is less than 65, when Bronze is greater than 4, and when Rank is '4'?
SELECT "Total" FROM table_62341 WHERE "Silver" < '65' AND "Bronze" > '4' AND "Rank" = '4'
SELECT "Total" FROM "table_62341" WHERE "Bronze" > '4' AND "Rank" = '4' AND "Silver" < '65'
0.088867
CREATE TABLE table_7989 ("YEAR" FLOAT, "DATE" TEXT, "CHAMPION" TEXT, "BEAT" TEXT, "TIME" TEXT, "COURSE" TEXT)
WHAT CHAMPION HAD RICHMOND RIVER COURSE ON JUNE 13?
SELECT "CHAMPION" FROM table_7989 WHERE "COURSE" = 'richmond river' AND "DATE" = 'june 13'
SELECT "CHAMPION" FROM "table_7989" WHERE "COURSE" = 'richmond river' AND "DATE" = 'june 13'
0.089844
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
Bring me the number of patients diagnosed with benign neoplasm of pituitary gland who had a blood test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Benign neo pituitary" AND lab.fluid = "Blood"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Benign neo pituitary" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "Blood" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.268555
CREATE TABLE table_20938 ("Number" FLOAT, "Name" TEXT, "Kilometer" FLOAT, "Pavement" TEXT, "Length ( m ) " FLOAT, "Average climb ( % ) " FLOAT)
What is the average climb for Tenbosse?
SELECT MIN("Average climb (%)") FROM table_20938 WHERE "Name" = 'Tenbosse'
SELECT MIN("Average climb (%)") FROM "table_20938" WHERE "Name" = 'Tenbosse'
0.074219
CREATE TABLE table_75317 ("Date" TEXT, "Type" TEXT, "Record description" TEXT, "Achievement" TEXT, "Pilot" TEXT)
Record description of altitude with kg (lb) payload, and a Pilot of g.v. alfyorov had what type?
SELECT "Type" FROM table_75317 WHERE "Record description" = 'altitude with kg (lb) payload' AND "Pilot" = 'g.v. alfyorov'
SELECT "Type" FROM "table_75317" WHERE "Pilot" = 'g.v. alfyorov' AND "Record description" = 'altitude with kg (lb) payload'
0.120117
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 compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) 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 equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code 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 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 dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name 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 code_description (code VARCHAR, description TEXT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) 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_fare (flight_id INT, fare_id INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) 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 city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE days (days_code VARCHAR, day_name 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) 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)
show me the flights from PHILADELPHIA to BALTIMORE
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 = 'BALTIMORE' 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" AS "AIRPORT_SERVICE_0" JOIN "city" AS "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" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'BALTIMORE'
0.500977
CREATE TABLE table_26250145_1 (result VARCHAR, original_artist VARCHAR)
How many times is the original artist Alicia keys?
SELECT COUNT(result) FROM table_26250145_1 WHERE original_artist = "Alicia Keys"
SELECT COUNT("result") FROM "table_26250145_1" WHERE "Alicia Keys" = "original_artist"
0.083984
CREATE TABLE table_1924975_1 (pos VARCHAR, q1 VARCHAR, q2_time VARCHAR)
when the q1+q2 time was 2.34.736, what was the total pos number?
SELECT COUNT(pos) FROM table_1924975_1 WHERE q1 + q2_time = "2.34.736"
SELECT COUNT("pos") FROM "table_1924975_1" WHERE "2.34.736" = "q1" + "q2_time"
0.076172
CREATE TABLE table_10032 ("Tie no" TEXT, "Home team" TEXT, "Score" TEXT, "Away team" TEXT, "Date" TEXT)
What is the date with home team of Stockport County?
SELECT "Date" FROM table_10032 WHERE "Home team" = 'stockport county'
SELECT "Date" FROM "table_10032" WHERE "Home team" = 'stockport county'
0.069336
CREATE TABLE member_attendance (member_id DECIMAL, performance_id DECIMAL, num_of_pieces DECIMAL) CREATE TABLE performance (performance_id DECIMAL, date TEXT, host TEXT, location TEXT, attendance DECIMAL) CREATE TABLE member (member_id TEXT, name TEXT, nationality TEXT, role TEXT)
List the hosts of performances in ascending order of attendance.
SELECT host FROM performance ORDER BY attendance
SELECT "host" FROM "performance" ORDER BY "attendance" NULLS FIRST
0.064453
CREATE TABLE time_slot (time_slot_id TEXT, day TEXT, start_hr DECIMAL, start_min DECIMAL, end_hr DECIMAL, end_min DECIMAL) CREATE TABLE course (course_id TEXT, title TEXT, dept_name TEXT, credits DECIMAL) CREATE TABLE classroom (building TEXT, room_number TEXT, capacity DECIMAL) CREATE TABLE student (id TEXT, name TEXT, dept_name TEXT, tot_cred DECIMAL) CREATE TABLE teaches (id TEXT, course_id TEXT, sec_id TEXT, semester TEXT, year DECIMAL) CREATE TABLE prereq (course_id TEXT, prereq_id TEXT) CREATE TABLE advisor (s_id TEXT, i_id TEXT) CREATE TABLE section (course_id TEXT, sec_id TEXT, semester TEXT, year DECIMAL, building TEXT, room_number TEXT, time_slot_id TEXT) CREATE TABLE takes (id TEXT, course_id TEXT, sec_id TEXT, semester TEXT, year DECIMAL, grade TEXT) CREATE TABLE department (dept_name TEXT, building TEXT, budget DECIMAL) CREATE TABLE instructor (id TEXT, name TEXT, dept_name TEXT, salary DECIMAL)
What are the names of students and their respective departments, ordered by number of credits from least to greatest?
SELECT name, dept_name FROM student ORDER BY tot_cred
SELECT "name", "dept_name" FROM "student" ORDER BY "tot_cred" NULLS FIRST
0.071289
CREATE TABLE table_name_83 (driver VARCHAR, laps VARCHAR, grid VARCHAR)
Which driver had 3 Laps and grids less than 15?
SELECT driver FROM table_name_83 WHERE laps = 3 AND grid < 15
SELECT "driver" FROM "table_name_83" WHERE "grid" < 15 AND "laps" = 3
0.067383
CREATE TABLE table_name_90 (series VARCHAR, site VARCHAR, date VARCHAR)
Which Series has a Site of ames on september 10, 2005?
SELECT series FROM table_name_90 WHERE site = "ames" AND date = "september 10, 2005"
SELECT "series" FROM "table_name_90" WHERE "ames" = "site" AND "date" = "september 10, 2005"
0.089844
CREATE TABLE table_31365 ("Position" TEXT, "Singer" TEXT, "2nd Evening" TEXT, "3rd Evening" TEXT, "4th Evening" TEXT, "5th Evening" TEXT)
How many singers got 2nd place in the 4th evening?
SELECT COUNT("2nd Evening") FROM table_31365 WHERE "4th Evening" = '2nd place'
SELECT COUNT("2nd Evening") FROM "table_31365" WHERE "4th Evening" = '2nd place'
0.078125
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
what is a drug that patient 030-30152 was prescribed two or more times since 143 months ago?
SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-30152')) AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-143 month') GROUP BY medication.drugname) AS t1 WHERE t1.c1 >= 2
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '030-30152' 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"), "t1" AS (SELECT "medication"."drugname", COUNT("medication"."drugstarttime") AS "c1" FROM "medication" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "medication"."patientunitstayid" WHERE DATETIME("medication"."drugstarttime") >= DATETIME(CURRENT_TIME(), '-143 month') AND NOT "_u_1"."" IS NULL GROUP BY "medication"."drugname") SELECT "t1"."drugname" FROM "t1" AS "t1" WHERE "t1"."c1" >= 2
0.727539
CREATE TABLE table_48028 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT)
What is To Par, when Place is 'T1', and when Player is 'Joey Rassett'?
SELECT "To par" FROM table_48028 WHERE "Place" = 't1' AND "Player" = 'joey rassett'
SELECT "To par" FROM "table_48028" WHERE "Place" = 't1' AND "Player" = 'joey rassett'
0.083008
CREATE TABLE assignedto (scientist DECIMAL, project TEXT) CREATE TABLE scientists (ssn DECIMAL, name TEXT) CREATE TABLE projects (code TEXT, name TEXT, hours DECIMAL)
What is the name of the project that requires the fewest number of hours, and the names of the scientists assigned to it?
SELECT T2.name, T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.ssn WHERE T2.hours = (SELECT MIN(hours) FROM projects)
SELECT "T2"."name", "T3"."name" FROM "assignedto" AS "T1" JOIN "projects" AS "T2" ON "T1"."project" = "T2"."code" AND "T2"."hours" = (SELECT MIN("hours") FROM "projects") JOIN "scientists" AS "T3" ON "T1"."scientist" = "T3"."ssn"
0.223633
CREATE TABLE table_20029 ("Date" TEXT, "Tournament" TEXT, "Location" TEXT, "Purse ( $ ) " FLOAT, "Winner" TEXT, "Score" TEXT, "1st Prize ( $ ) " TEXT)
Where was Outback Steakhouse Pro-AM held?
SELECT "Location" FROM table_20029 WHERE "Tournament" = 'Outback Steakhouse Pro-Am'
SELECT "Location" FROM "table_20029" WHERE "Tournament" = 'Outback Steakhouse Pro-Am'
0.083008
CREATE TABLE Ship (Ship_ID INT, Name TEXT, Type TEXT, Built_Year FLOAT, Class TEXT, Flag TEXT) CREATE TABLE captain (Captain_ID INT, Name TEXT, Ship_ID INT, age TEXT, Class TEXT, Rank TEXT)
Bar graph to show the number of rank from different rank, and list how many rank in asc order please.
SELECT Rank, COUNT(Rank) FROM captain GROUP BY Rank ORDER BY COUNT(Rank)
SELECT "Rank", COUNT("Rank") FROM "captain" GROUP BY "Rank" ORDER BY COUNT("Rank") NULLS FIRST
0.091797
CREATE TABLE table_name_46 (event VARCHAR, opponent VARCHAR)
Which event was the opponent jose carlos oliveira?
SELECT event FROM table_name_46 WHERE opponent = "jose carlos oliveira"
SELECT "event" FROM "table_name_46" WHERE "jose carlos oliveira" = "opponent"
0.075195
CREATE TABLE table_67938 ("Tournament" TEXT, "2005" TEXT, "2006" TEXT, "2007" TEXT, "2008" TEXT, "2009" TEXT, "2010" TEXT, "2011" TEXT, "2012" TEXT)
In which tournament did Pauline Parmentier finish LQ in 2007?
SELECT "Tournament" FROM table_67938 WHERE "2007" = 'lq'
SELECT "Tournament" FROM "table_67938" WHERE "2007" = 'lq'
0.056641
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
get me the number of patients born before 2058 who had csf lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2058" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Cerebrospinal Fluid (CSF)" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2058" > "demographic"."dob_year"
0.207031
CREATE TABLE table_name_53 (year VARCHAR)
What was the 3rd place value in 2011?
SELECT 3 AS rd_place FROM table_name_53 WHERE year = "2011"
SELECT 3 AS "rd_place" FROM "table_name_53" WHERE "2011" = "year"
0.063477
CREATE TABLE table_202_224 (id DECIMAL, "party" TEXT, "candidate" TEXT, "votes" DECIMAL, "%" DECIMAL)
a candidate with the name of flash gordon approaching of what satirical political party came in last place in the 2001 general election in ochil ?
SELECT "party" FROM table_202_224 WHERE "candidate" = 'flash gordon approaching'
SELECT "party" FROM "table_202_224" WHERE "candidate" = 'flash gordon approaching'
0.080078
CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL)
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about employee_id over the job_id , and list in ascending by the Y-axis.
SELECT JOB_ID, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID
SELECT "JOB_ID", "EMPLOYEE_ID" FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100) ORDER BY "EMPLOYEE_ID" NULLS FIRST
0.200195
CREATE TABLE table_name_81 (name_designation VARCHAR, payload VARCHAR)
What is the name/designation for the 1200kg payload?
SELECT name_designation FROM table_name_81 WHERE payload = "1200kg"
SELECT "name_designation" FROM "table_name_81" WHERE "1200kg" = "payload"
0.071289
CREATE TABLE table_21956 ("Name" TEXT, "Map colour" TEXT, "First operated" FLOAT, "Type" TEXT, "Length" TEXT, "No. Sta" FLOAT, "Current Stock" TEXT, "Future Stock" TEXT, "Trips per annum ( \\u00d71000 ) " FLOAT, "Avg. trips per mile ( \\u00d71000 ) " FLOAT)
When 4744 is the avg. trips per mile (x1000) what is the current stock?
SELECT "Current Stock" FROM table_21956 WHERE "Avg. trips per mile (\u00d71000)" = '4744'
SELECT "Current Stock" FROM "table_21956" WHERE "Avg. trips per mile (\u00d71000)" = '4744'
0.088867
CREATE TABLE table_name_10 (location_attendance VARCHAR, high_assists VARCHAR, date VARCHAR)
Can you tell me the Location Attendance that has the High assists of luke ridnour (10), and the Date of december 3?
SELECT location_attendance FROM table_name_10 WHERE high_assists = "luke ridnour (10)" AND date = "december 3"
SELECT "location_attendance" FROM "table_name_10" WHERE "date" = "december 3" AND "high_assists" = "luke ridnour (10)"
0.115234
CREATE TABLE table_73637 ("Episode number Production number" TEXT, "Title" TEXT, "Original airdate" TEXT, "Rating/Share in Households" TEXT, "18\\u201349 Rating Live+SD / Live+7" TEXT, "Share" TEXT, "Live+SD Total viewers" TEXT, "Live+7 Day DVR Total viewers" TEXT)
What are the '18 49 Rating Live+SD' ratings and 'Live+7' ratings, respectively, for the episode that originally aired on October 14, 2009?
SELECT "18\u201349 Rating Live+SD / Live+7" FROM table_73637 WHERE "Original airdate" = 'October 14, 2009'
SELECT "18\u201349 Rating Live+SD / Live+7" FROM "table_73637" WHERE "Original airdate" = 'October 14, 2009'
0.105469
CREATE TABLE table_54873 ("Party" TEXT, "Results 2004" TEXT, "Ifop 11/12/08" TEXT, "Ifop 1/9/09" TEXT, "Ipsos 3/14/09" TEXT, "CSA 4/16/09" TEXT, "OpinionWay 4/17/09" TEXT, "Ifop 4/24/09" TEXT, "Ipsos 5/2/09" TEXT, "Ifop 5/11/09" TEXT, "OpinionWay 5/11/09" TEXT)
Name the lpsos 3/14/09 for opinionway of 4/17/09 of 5% and lfof 11/12/08 of 7%
SELECT "Ipsos 3/14/09" FROM table_54873 WHERE "Ifop 11/12/08" = '7%' AND "OpinionWay 4/17/09" = '5%'
SELECT "Ipsos 3/14/09" FROM "table_54873" WHERE "Ifop 11/12/08" = '7%' AND "OpinionWay 4/17/09" = '5%'
0.099609
CREATE TABLE Research_outcomes (outcome_description VARCHAR, outcome_code VARCHAR) CREATE TABLE Project_outcomes (outcome_code VARCHAR)
What are the descriptions of all the project outcomes?
SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code
SELECT "T1"."outcome_description" FROM "Research_outcomes" AS "T1" JOIN "Project_outcomes" AS "T2" ON "T1"."outcome_code" = "T2"."outcome_code"
0.139648
CREATE TABLE table_name_48 (to_par VARCHAR, total VARCHAR, year_won VARCHAR, player VARCHAR)
What is the total to par of player jeff sluman, who won before 1993 and has a total greater than 154?
SELECT COUNT(to_par) FROM table_name_48 WHERE year_won < 1993 AND player = "jeff sluman" AND total > 154
SELECT COUNT("to_par") FROM "table_name_48" WHERE "jeff sluman" = "player" AND "total" > 154 AND "year_won" < 1993
0.111328
CREATE TABLE architect (id VARCHAR, name VARCHAR, gender VARCHAR) CREATE TABLE bridge (architect_id VARCHAR) CREATE TABLE mill (architect_id VARCHAR)
What are the ids, names and genders of the architects who built two bridges or one mill?
SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) = 2 UNION SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) = 1
SELECT "T1"."id", "T1"."name", "T1"."gender" FROM "architect" AS "T1" JOIN "bridge" AS "T2" ON "T1"."id" = "T2"."architect_id" GROUP BY "T1"."id" HAVING COUNT(*) = 2 UNION SELECT "T1"."id", "T1"."name", "T1"."gender" FROM "architect" AS "T1" JOIN "mill" AS "T2" ON "T1"."id" = "T2"."architect_id" GROUP BY "T1"."id" HAVING COUNT(*) = 1
0.327148