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 stay (stayid DECIMAL, patient DECIMAL, room DECIMAL, staystart TIME, stayend TIME) CREATE TABLE prescribes (physician DECIMAL, patient DECIMAL, medication DECIMAL, date TIME, appointment DECIMAL, dose TEXT) CREATE TABLE department (departmentid DECIMAL, name TEXT, head DECIMAL) CREATE TABLE room (roomnumber DECIMAL, roomtype TEXT, blockfloor DECIMAL, blockcode DECIMAL, unavailable BOOLEAN) CREATE TABLE on_call (nurse DECIMAL, blockfloor DECIMAL, blockcode DECIMAL, oncallstart TIME, oncallend TIME) CREATE TABLE appointment (appointmentid DECIMAL, patient DECIMAL, prepnurse DECIMAL, physician DECIMAL, start TIME, end TIME, examinationroom TEXT) CREATE TABLE procedures (code DECIMAL, name TEXT, cost DECIMAL) CREATE TABLE patient (ssn DECIMAL, name TEXT, address TEXT, phone TEXT, insuranceid DECIMAL, pcp DECIMAL) CREATE TABLE affiliated_with (physician DECIMAL, department DECIMAL, primaryaffiliation BOOLEAN) CREATE TABLE physician (employeeid DECIMAL, name TEXT, position TEXT, ssn DECIMAL) CREATE TABLE nurse (employeeid DECIMAL, name TEXT, position TEXT, registered BOOLEAN, ssn DECIMAL) CREATE TABLE trained_in (physician DECIMAL, treatment DECIMAL, certificationdate TIME, certificationexpires TIME) CREATE TABLE medication (code DECIMAL, name TEXT, brand TEXT, description TEXT) CREATE TABLE block (blockfloor DECIMAL, blockcode DECIMAL) CREATE TABLE undergoes (patient DECIMAL, procedures DECIMAL, stay DECIMAL, dateundergoes TIME, physician DECIMAL, assistingnurse DECIMAL)
Find the name of physicians who are affiliated with both Surgery and Psychiatry departments.
SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.employeeid = T2.physician JOIN department AS T3 ON T2.department = T3.departmentid WHERE T3.name = 'Surgery' INTERSECT SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.employeeid = T2.physician JOIN department AS T3 ON T2.department = T3.departmentid WHERE T3.name = 'Psychiatry'
SELECT "T1"."name" FROM "physician" AS "T1" JOIN "affiliated_with" AS "T2" ON "T1"."employeeid" = "T2"."physician" JOIN "department" AS "T3" ON "T2"."department" = "T3"."departmentid" AND "T3"."name" = 'Surgery' INTERSECT SELECT "T1"."name" FROM "physician" AS "T1" JOIN "affiliated_with" AS "T2" ON "T1"."employeeid" = "T2"."physician" JOIN "department" AS "T3" ON "T2"."department" = "T3"."departmentid" AND "T3"."name" = 'Psychiatry'
0.425781
CREATE TABLE table_203_541 (id DECIMAL, "games" TEXT, "host city" TEXT, "dates" TEXT, "nations" DECIMAL, "participants" DECIMAL, "events" DECIMAL)
what games featured the fewest participating nations ?
SELECT "games" FROM table_203_541 ORDER BY "nations" LIMIT 1
SELECT "games" FROM "table_203_541" ORDER BY "nations" NULLS FIRST LIMIT 1
0.072266
CREATE TABLE table_34629 ("Spacecraft" TEXT, "Destination" TEXT, "Launched" TEXT, "Closest approach" TEXT, "Time elapsed" TEXT)
What Time elapsed has both the Launched of 15 October 1997 and the Closest approach of 24 June 1999?
SELECT "Time elapsed" FROM table_34629 WHERE "Launched" = '15 october 1997' AND "Closest approach" = '24 june 1999'
SELECT "Time elapsed" FROM "table_34629" WHERE "Closest approach" = '24 june 1999' AND "Launched" = '15 october 1997'
0.114258
CREATE TABLE table_name_52 (party VARCHAR, incumbent VARCHAR)
What is Party, when Incumbent is 'Rodney Alexander'?
SELECT party FROM table_name_52 WHERE incumbent = "rodney alexander"
SELECT "party" FROM "table_name_52" WHERE "incumbent" = "rodney alexander"
0.072266
CREATE TABLE table_7040 ("Year" FLOAT, "Dates" TEXT, "Champion" TEXT, "Country" TEXT, "Score" TEXT, "Margin of victory" TEXT, "Tournament Location" TEXT, "Purse ( US$ ) " FLOAT, "Winner's share" FLOAT)
How many winner's shares have ai miyazato as the champion?
SELECT SUM("Winner's share") FROM table_7040 WHERE "Champion" = 'ai miyazato'
SELECT SUM("Winner's share") FROM "table_7040" WHERE "Champion" = 'ai miyazato'
0.077148
CREATE TABLE table_79944 ("Date" TEXT, "City" TEXT, "Event" TEXT, "Winner" TEXT, "Prize" TEXT)
When was the event in the City of Baden?
SELECT "Date" FROM table_79944 WHERE "City" = 'baden'
SELECT "Date" FROM "table_79944" WHERE "City" = 'baden'
0.053711
CREATE TABLE table_19609 ("Series #" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production Code" FLOAT, "U.S. viewers ( millions ) " TEXT)
15.03 million u.s viewers seen what episode?
SELECT "Title" FROM table_19609 WHERE "U.S. viewers (millions)" = '15.03'
SELECT "Title" FROM "table_19609" WHERE "U.S. viewers (millions)" = '15.03'
0.073242
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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) 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 d_icd_procedures (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 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_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 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_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 d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title 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 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)
what was the insurance name of patient 3125 during their current hospital encounter?
SELECT admissions.insurance FROM admissions WHERE admissions.subject_id = 3125 AND admissions.dischtime IS NULL
SELECT "admissions"."insurance" FROM "admissions" WHERE "admissions"."dischtime" IS NULL AND "admissions"."subject_id" = 3125
0.12207
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 procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title 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)
what is admission type and diagnoses short title of subject name francis baseler?
SELECT demographic.admission_type, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Francis Baseler"
SELECT "demographic"."admission_type", "diagnoses"."short_title" FROM "demographic" JOIN "diagnoses" ON "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "Francis Baseler" = "demographic"."name"
0.193359
CREATE TABLE table_name_37 (rank INT, year VARCHAR, moving_from VARCHAR)
Moving from Nancy after 2005, what is listed as the lowest rank?
SELECT MIN(rank) FROM table_name_37 WHERE year > 2005 AND moving_from = "nancy"
SELECT MIN("rank") FROM "table_name_37" WHERE "moving_from" = "nancy" AND "year" > 2005
0.084961
CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college 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) 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 jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE area (course_id INT, area 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_course (program_id INT, course_id INT, workload INT, category 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 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 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 program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR)
Who has taught STATS 711 ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'STATS' AND course.number = 711 AND NOT (semester.semester = 'WN' AND semester.year = 2016)
SELECT DISTINCT "instructor"."name" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "offering_instructor" ON "course_offering"."offering_id" = "offering_instructor"."offering_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND ("semester"."semester" <> 'WN' OR "semester"."year" <> 2016) JOIN "instructor" ON "instructor"."instructor_id" = "offering_instructor"."instructor_id" WHERE "course"."department" = 'STATS' AND "course"."number" = 711
0.511719
CREATE TABLE table_29572583_19 (points INT, rank VARCHAR)
How many points are listed when the rank is 17?
SELECT MAX(points) FROM table_29572583_19 WHERE rank = 17
SELECT MAX("points") FROM "table_29572583_19" WHERE "rank" = 17
0.061523
CREATE TABLE table_59640 ("Team" TEXT, "Driver" TEXT, "Class" TEXT, "Chassis" TEXT, "Engine" TEXT, "Rounds" TEXT)
How many rounds did fr d ric vervisch go?
SELECT "Rounds" FROM table_59640 WHERE "Driver" = 'frédéric vervisch'
SELECT "Rounds" FROM "table_59640" WHERE "Driver" = 'frédéric vervisch'
0.069336
CREATE TABLE table_name_7 (name VARCHAR, construction VARCHAR, ref_number VARCHAR, built VARCHAR)
What is the name of the mill constructed of red brick in 1910 with a reference number lower than 55?
SELECT name FROM table_name_7 WHERE ref_number < 55 AND built = 1910 AND construction = "red brick"
SELECT "name" FROM "table_name_7" WHERE "built" = 1910 AND "construction" = "red brick" AND "ref_number" < 55
0.106445
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 d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title 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 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 d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title 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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name 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 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom 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 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)
had there been some organisms in patient 739's first tissue microbiology test in 12/this year?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 739) AND microbiologyevents.spec_type_desc = 'tissue' AND NOT microbiologyevents.org_name IS NULL AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', microbiologyevents.charttime) = '12' ORDER BY microbiologyevents.charttime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 739 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" = 'tissue' AND DATETIME("microbiologyevents"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_0"."" IS NULL AND NOT "microbiologyevents"."org_name" IS NULL AND STRFTIME('%m', "microbiologyevents"."charttime") = '12' ORDER BY "microbiologyevents"."charttime" NULLS FIRST LIMIT 1
0.595703
CREATE TABLE table_1949 ("Period" TEXT, "Kit manufacturer" TEXT, "Main sponsor" TEXT, "Secondary sponsor" TEXT, "Minor sponsors" TEXT)
When batavo is the main sponsor and olympikus is the kit manufacturer who are the minor sponsors?
SELECT "Minor sponsors" FROM table_1949 WHERE "Kit manufacturer" = 'Olympikus' AND "Main sponsor" = 'Batavo'
SELECT "Minor sponsors" FROM "table_1949" WHERE "Kit manufacturer" = 'Olympikus' AND "Main sponsor" = 'Batavo'
0.107422
CREATE TABLE table_47525 ("Name" TEXT, "Born-Died" TEXT, "Term start" TEXT, "Term end" TEXT, "Political Party" TEXT)
When did Ismail Qemali Bej's term start?
SELECT "Term start" FROM table_47525 WHERE "Name" = 'ismail qemali bej'
SELECT "Term start" FROM "table_47525" WHERE "Name" = 'ismail qemali bej'
0.071289
CREATE TABLE table_49052 ("Source Version" TEXT, "Target Version" TEXT, "Last Release" TEXT, "License" TEXT, "Website" TEXT)
What is Target Version, when License is LGPL or MPL?
SELECT "Target Version" FROM table_49052 WHERE "License" = 'lgpl or mpl'
SELECT "Target Version" FROM "table_49052" WHERE "License" = 'lgpl or mpl'
0.072266
CREATE TABLE track (Track_ID INT, Name TEXT, Location TEXT, Seating FLOAT, Year_Opened FLOAT) CREATE TABLE race (Race_ID INT, Name TEXT, Class TEXT, Date TEXT, Track_ID TEXT)
Visualize a bar chart for what are the names of different tracks, and how many races has each had?, and display y axis from high to low order.
SELECT T2.Name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.Track_ID = T2.Track_ID GROUP BY T1.Track_ID ORDER BY COUNT(*) DESC
SELECT "T2"."Name", COUNT(*) FROM "race" AS "T1" JOIN "track" AS "T2" ON "T1"."Track_ID" = "T2"."Track_ID" GROUP BY "T1"."Track_ID" ORDER BY COUNT(*) DESC NULLS LAST
0.161133
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 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)
count the number of patients whose age is less than 58 and procedure long title is hemodialysis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "58" AND procedures.long_title = "Hemodialysis"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Hemodialysis" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "58" > "demographic"."age"
0.212891
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)
find the minimum age of patients whose marital satus is single and ethnicity is white.
SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.ethnicity = "WHITE"
SELECT MIN("demographic"."age") FROM "demographic" WHERE "SINGLE" = "demographic"."marital_status" AND "WHITE" = "demographic"."ethnicity"
0.134766
CREATE TABLE table_43420 ("Background" TEXT, "Original Team" TEXT, "Hometown" TEXT, "Result" TEXT, "Raised" TEXT)
What is the Background of the contestant with a Result of 07 fired in task 6 (2009-04-05)?
SELECT "Background" FROM table_43420 WHERE "Result" = '07 fired in task 6 (2009-04-05)'
SELECT "Background" FROM "table_43420" WHERE "Result" = '07 fired in task 6 (2009-04-05)'
0.086914
CREATE TABLE table_11734041_18 (position VARCHAR, no_s_ VARCHAR)
How many positions had jersey number 32
SELECT COUNT(position) FROM table_11734041_18 WHERE no_s_ = "32"
SELECT COUNT("position") FROM "table_11734041_18" WHERE "32" = "no_s_"
0.068359
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 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 prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
Count the number of married patients who had a wbc pleural lab test done.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.label = "WBC, Pleural"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "WBC, Pleural" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "MARRIED" = "demographic"."marital_status"
0.203125
CREATE TABLE table_1184344_1 (cr_no VARCHAR, l INT, name VARCHAR)
What was the maximum l&cr number for archimedes?
SELECT MAX(l) & cr_no FROM table_1184344_1 WHERE name = "Archimedes"
SELECT MAX("l") & "cr_no" FROM "table_1184344_1" WHERE "Archimedes" = "name"
0.074219
CREATE TABLE table_73816 ("Settlement" TEXT, "Cyrillic Name Other Names" TEXT, "Type" TEXT, "Population ( 2011 ) " FLOAT, "Largest ethnic group ( 2002 ) " TEXT, "Dominant religion ( 2002 ) " TEXT)
What type of settlement is rabe?
SELECT "Type" FROM table_73816 WHERE "Settlement" = 'Rabe'
SELECT "Type" FROM "table_73816" WHERE "Settlement" = 'Rabe'
0.058594
CREATE TABLE table_9870 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT, "Money ( $ ) " TEXT)
What Country is Gene Littler from?
SELECT "Country" FROM table_9870 WHERE "Player" = 'gene littler'
SELECT "Country" FROM "table_9870" WHERE "Player" = 'gene littler'
0.064453
CREATE TABLE stock (Shop_ID INT, Device_ID INT, Quantity INT) CREATE TABLE shop (Shop_ID INT, Shop_Name TEXT, Location TEXT, Open_Date TEXT, Open_Year INT) CREATE TABLE device (Device_ID INT, Device TEXT, Carrier TEXT, Package_Version TEXT, Applications TEXT, Software_Platform TEXT)
What are the different software platforms for devices, and how many devices have each, I want to show bar in ascending order.
SELECT Software_Platform, COUNT(*) FROM device GROUP BY Software_Platform ORDER BY Software_Platform
SELECT "Software_Platform", COUNT(*) FROM "device" GROUP BY "Software_Platform" ORDER BY "Software_Platform" NULLS FIRST
0.117188
CREATE TABLE table_32926 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" FLOAT)
What team did the Brows play against on October 20, 1963 to a crowd larger than 55,096?
SELECT "Opponent" FROM table_32926 WHERE "Attendance" > '55,096' AND "Date" = 'october 20, 1963'
SELECT "Opponent" FROM "table_32926" WHERE "Attendance" > '55,096' AND "Date" = 'october 20, 1963'
0.095703
CREATE TABLE table_39106 ("Year" FLOAT, "Competition" TEXT, "Venue" TEXT, "Position" TEXT, "Event" TEXT)
What is the number of years that the event was foil team and took place in Los Angeles?
SELECT COUNT("Year") FROM table_39106 WHERE "Venue" = 'los angeles' AND "Event" = 'foil team'
SELECT COUNT("Year") FROM "table_39106" WHERE "Event" = 'foil team' AND "Venue" = 'los angeles'
0.092773
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 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 dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name 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 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 flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, 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 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 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 airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT)
please give me the flight times i would like to fly from BOSTON to BALTIMORE in the morning before 800
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.departure_time < 800 AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' 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" = 'BOSTON' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."departure_time" < 800 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.530273
CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT) CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT) CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT) CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT)
Give me the comparison about ID over the meter_500 .
SELECT meter_500, ID FROM swimmer
SELECT "meter_500", "ID" FROM "swimmer"
0.038086
CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT) 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)
Return a pie chart about the proportion of ACC_Regular_Season and ACC_Percent.
SELECT ACC_Regular_Season, ACC_Percent FROM basketball_match
SELECT "ACC_Regular_Season", "ACC_Percent" FROM "basketball_match"
0.064453
CREATE TABLE table_32963 ("City" TEXT, "Country" TEXT, "IATA" TEXT, "ICAO" TEXT, "Airport" TEXT)
Which airport has an ICAO of RCKH?
SELECT "Airport" FROM table_32963 WHERE "ICAO" = 'rckh'
SELECT "Airport" FROM "table_32963" WHERE "ICAO" = 'rckh'
0.055664
CREATE TABLE table_38807 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Record" TEXT)
Name the home for detroit visitor and date of february 29
SELECT "Home" FROM table_38807 WHERE "Visitor" = 'detroit' AND "Date" = 'february 29'
SELECT "Home" FROM "table_38807" WHERE "Date" = 'february 29' AND "Visitor" = 'detroit'
0.084961
CREATE TABLE table_name_67 (bob_dole VARCHAR, george_hw_bush VARCHAR, pat_robertson VARCHAR)
When George H.W. Bush had 81%, and Pat Robertson had 9%, what did Bob Dole have?
SELECT bob_dole FROM table_name_67 WHERE george_hw_bush = "81%" AND pat_robertson = "9%"
SELECT "bob_dole" FROM "table_name_67" WHERE "81%" = "george_hw_bush" AND "9%" = "pat_robertson"
0.09375
CREATE TABLE table_name_52 (date VARCHAR, comment VARCHAR, duration VARCHAR)
What is Date, when Comment is Tailcone On, Lakebed Landing, and when Duration is 5min 34 s?
SELECT date FROM table_name_52 WHERE comment = "tailcone on, lakebed landing" AND duration = "5min 34 s"
SELECT "date" FROM "table_name_52" WHERE "5min 34 s" = "duration" AND "comment" = "tailcone on, lakebed landing"
0.109375
CREATE TABLE table_75860 ("Date" TEXT, "Time" TEXT, "Home" TEXT, "Away" TEXT, "Score" TEXT, "Ground" TEXT)
What is the Time with a Ground that is humber college north?
SELECT "Time" FROM table_75860 WHERE "Ground" = 'humber college north'
SELECT "Time" FROM "table_75860" WHERE "Ground" = 'humber college north'
0.070313
CREATE TABLE table_203_683 (id DECIMAL, "season" TEXT, "league" TEXT, "gold" TEXT, "silver" TEXT, "bronze" TEXT, "winning manager" TEXT)
who won bronze before valeranga in 1960-61 ?
SELECT "bronze" FROM table_203_683 WHERE "season" < (SELECT "season" FROM table_203_683 WHERE "bronze" = 'valerenga' AND "season" = '1960-61') ORDER BY "season" DESC LIMIT 1
SELECT "bronze" FROM "table_203_683" WHERE "season" < (SELECT "season" FROM "table_203_683" WHERE "bronze" = 'valerenga' AND "season" = '1960-61') ORDER BY "season" DESC NULLS LAST LIMIT 1
0.183594
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 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)
how many patients whose procedure icd9 code is 17?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "17"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "17" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id"
0.169922
CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT) 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)
Find ACC_Regular_Season and ACC_Percent , and visualize them by a bar chart, and could you order by the y axis from high to low?
SELECT ACC_Regular_Season, ACC_Percent FROM basketball_match ORDER BY ACC_Percent DESC
SELECT "ACC_Regular_Season", "ACC_Percent" FROM "basketball_match" ORDER BY "ACC_Percent" DESC NULLS LAST
0.102539
CREATE TABLE table_203_758 (id DECIMAL, "no." DECIMAL, "dub no." DECIMAL, "english dubbed title / english subbed title\ original japanese title" TEXT, "original air date" TEXT, "english air date" TEXT)
what was the first sailor moon episode to have an english air date in october , 1995 ?
SELECT "english dubbed title / english subbed title\noriginal japanese title" FROM table_203_758 WHERE "english air date" = 10 AND "english air date" = 1995 ORDER BY "english air date" LIMIT 1
SELECT "english dubbed title / english subbed title\noriginal japanese title" FROM "table_203_758" WHERE "english air date" = 10 AND "english air date" = 1995 ORDER BY "english air date" NULLS FIRST LIMIT 1
0.201172
CREATE TABLE member (Member_ID INT, Name TEXT, Membership_card TEXT, Age INT, Time_of_purchase INT, Level_of_membership INT, Address TEXT) CREATE TABLE happy_hour_member (HH_ID INT, Member_ID INT, Total_amount FLOAT) CREATE TABLE shop (Shop_ID INT, Address TEXT, Num_of_staff TEXT, Score FLOAT, Open_Year TEXT) CREATE TABLE happy_hour (HH_ID INT, Shop_ID INT, Month TEXT, Num_of_shaff_in_charge INT)
Bar graph to show the total number from different address, and could you sort in ascending by the y axis?
SELECT Address, COUNT(*) FROM member GROUP BY Address ORDER BY COUNT(*)
SELECT "Address", COUNT(*) FROM "member" GROUP BY "Address" ORDER BY COUNT(*) NULLS FIRST
0.086914
CREATE TABLE table_14710 ("Name" TEXT, "Line" TEXT, "Location" TEXT, "Closed" TEXT, "Current Status" TEXT)
What is the line of the station in Toolamba that is currently demolished and closed in the late 1970s?
SELECT "Line" FROM table_14710 WHERE "Current Status" = 'demolished' AND "Closed" = 'late 1970s' AND "Location" = 'toolamba'
SELECT "Line" FROM "table_14710" WHERE "Closed" = 'late 1970s' AND "Current Status" = 'demolished' AND "Location" = 'toolamba'
0.123047
CREATE TABLE table_39640 ("Game" FLOAT, "October" FLOAT, "Opponent" TEXT, "Score" TEXT, "Record" TEXT)
Who is the opponent of Game 1 with a 3-2-0 record?
SELECT "Opponent" FROM table_39640 WHERE "Game" > '1' AND "Record" = '3-2-0'
SELECT "Opponent" FROM "table_39640" WHERE "Game" > '1' AND "Record" = '3-2-0'
0.076172
CREATE TABLE table_16388398_2 (home_team VARCHAR, ground VARCHAR)
What is the home team that played on M.C.G. grounds?
SELECT home_team FROM table_16388398_2 WHERE ground = "M.C.G."
SELECT "home_team" FROM "table_16388398_2" WHERE "M.C.G." = "ground"
0.066406
CREATE TABLE table_28606933_7 (teams VARCHAR, consecutive_starts VARCHAR)
What team(s) had 120 consecutive starts?
SELECT teams FROM table_28606933_7 WHERE consecutive_starts = 120
SELECT "teams" FROM "table_28606933_7" WHERE "consecutive_starts" = 120
0.069336
CREATE TABLE table_5621 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Record" TEXT)
what was the score in toronto
SELECT "Score" FROM table_5621 WHERE "Home" = 'toronto'
SELECT "Score" FROM "table_5621" WHERE "Home" = 'toronto'
0.055664
CREATE TABLE table_69899 ("Heat" FLOAT, "Lane" FLOAT, "Name" TEXT, "Nationality" TEXT, "Time" TEXT)
Jin Hao had what amount of heat?
SELECT "Heat" FROM table_69899 WHERE "Name" = 'jin hao'
SELECT "Heat" FROM "table_69899" WHERE "Name" = 'jin hao'
0.055664
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)
provide the number of patients whose admission type is urgent and drug name is tacrolimus?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "URGENT" AND prescriptions.drug = "Tacrolimus"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Tacrolimus" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "URGENT" = "demographic"."admission_type"
0.228516
CREATE TABLE table_26419 ("Outcome" TEXT, "Year" FLOAT, "Championship" TEXT, "Surface" TEXT, "Partner" TEXT, "Opponents" TEXT, "Score" TEXT)
Name the outcome for zurich
SELECT "Outcome" FROM table_26419 WHERE "Championship" = 'Zurich'
SELECT "Outcome" FROM "table_26419" WHERE "Championship" = 'Zurich'
0.06543
CREATE TABLE table_28697 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" TEXT, "U.S. viewers ( millions ) " TEXT)
What season number in the season has production code 210?
SELECT MIN("No. in season") FROM table_28697 WHERE "Production code" = '210'
SELECT MIN("No. in season") FROM "table_28697" WHERE "Production code" = '210'
0.076172
CREATE TABLE table_66446 ("Rank" FLOAT, "Athletes" TEXT, "Country" TEXT, "Time" TEXT, "Notes" TEXT)
Which athlete is ranked below 5 and is from China?
SELECT "Athletes" FROM table_66446 WHERE "Rank" < '5' AND "Country" = 'china'
SELECT "Athletes" FROM "table_66446" WHERE "Country" = 'china' AND "Rank" < '5'
0.077148
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 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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description 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 TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) 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 PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) 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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress 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 PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description 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)
Retrieve questions with particular xtics.
SELECT * FROM PostHistory WHERE PostId = 1001082
SELECT * FROM "PostHistory" WHERE "PostId" = 1001082
0.050781
CREATE TABLE table_19680 ("Year" FLOAT, "Mens singles" TEXT, "Womens singles" TEXT, "Mens doubles" TEXT, "Womens doubles" TEXT, "Mixed doubles" TEXT)
What was the last year rni r hallgr msson dr fa har ard ttir won mixed doubles
SELECT MAX("Year") FROM table_19680 WHERE "Mixed doubles" = 'Árni Þór Hallgrímsson Drífa Harðardóttir'
SELECT MAX("Year") FROM "table_19680" WHERE "Mixed doubles" = 'Árni Þór Hallgrímsson Drífa Harðardóttir'
0.101563
CREATE TABLE table_38223 ("Name" TEXT, "Height" TEXT, "Weight" TEXT, "Class" TEXT, "Position" TEXT, "Hometown" TEXT)
What is the class of the qb, Josh Riddell?
SELECT "Class" FROM table_38223 WHERE "Position" = 'qb' AND "Name" = 'josh riddell'
SELECT "Class" FROM "table_38223" WHERE "Name" = 'josh riddell' AND "Position" = 'qb'
0.083008
CREATE TABLE table_name_45 (goals INT, club VARCHAR, games VARCHAR)
What is the average Goals, when Club is Iserlohn Roosters, and when Games is less than 56?
SELECT AVG(goals) FROM table_name_45 WHERE club = "iserlohn roosters" AND games < 56
SELECT AVG("goals") FROM "table_name_45" WHERE "club" = "iserlohn roosters" AND "games" < 56
0.089844
CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight 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 compartment_class (compartment VARCHAR, class_type 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 equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) 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 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 month (month_number INT, month_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_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 city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code 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 days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_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 code_description (code VARCHAR, description TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) 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 flight_fare (flight_id INT, fare_id INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note 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)
show me the nonstop flights from DALLAS to HOUSTON
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 = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'HOUSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.stops = 0
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" AND "flight"."stops" = 0 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" = 'HOUSTON'
0.517578
CREATE TABLE table_name_86 (rank INT, name VARCHAR)
What is the lowest rank for El Paso Natural Gas Company Building?
SELECT MIN(rank) FROM table_name_86 WHERE name = "el paso natural gas company building"
SELECT MIN("rank") FROM "table_name_86" WHERE "el paso natural gas company building" = "name"
0.09082
CREATE TABLE table_50558 ("Administrating agencies by NIP funds ONLY" TEXT, "Management and support" FLOAT, "Data collection" TEXT, "Data processing and exploitation" TEXT, "Total" FLOAT)
What is the lowest total data processing and exploitation of 00 0,228, and a management and support larger than 1,7?
SELECT MIN("Total") FROM table_50558 WHERE "Data processing and exploitation" = '00 0,228' AND "Management and support" > '1,7'
SELECT MIN("Total") FROM "table_50558" WHERE "Data processing and exploitation" = '00 0,228' AND "Management and support" > '1,7'
0.125977
CREATE TABLE table_name_50 (school VARCHAR, round VARCHAR, position VARCHAR, pick VARCHAR)
From what school was the linebacker that had a pick less than 245 and was drafted in round 6?
SELECT school FROM table_name_50 WHERE position = "linebacker" AND pick < 245 AND round = 6
SELECT "school" FROM "table_name_50" WHERE "linebacker" = "position" AND "pick" < 245 AND "round" = 6
0.098633
CREATE TABLE table_134729_3 (format VARCHAR, call_sign VARCHAR)
What station has the call number K213cl
SELECT format FROM table_134729_3 WHERE call_sign = "K213CL"
SELECT "format" FROM "table_134729_3" WHERE "K213CL" = "call_sign"
0.064453
CREATE TABLE table_name_46 (second_runner_up VARCHAR, miss_universe_philippines VARCHAR)
When Bianca Manalo won Miss Universe Philippines who was the second runner-up?
SELECT second_runner_up FROM table_name_46 WHERE miss_universe_philippines = "bianca manalo"
SELECT "second_runner_up" FROM "table_name_46" WHERE "bianca manalo" = "miss_universe_philippines"
0.095703
CREATE TABLE table_name_3 (name VARCHAR, unit VARCHAR)
What is the name of the non mammal of the unit vyazniki assemblage?
SELECT name FROM table_name_3 WHERE unit = "vyazniki assemblage"
SELECT "name" FROM "table_name_3" WHERE "unit" = "vyazniki assemblage"
0.068359
CREATE TABLE table_7668 ("Region" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalog" TEXT)
What is the Format for the alfa records Label, and a Catalog of alca-9016?
SELECT "Format" FROM table_7668 WHERE "Label" = 'alfa records' AND "Catalog" = 'alca-9016'
SELECT "Format" FROM "table_7668" WHERE "Catalog" = 'alca-9016' AND "Label" = 'alfa records'
0.089844
CREATE TABLE table_65432 ("Date" TEXT, "Location" TEXT, "Lineup" TEXT, "Assist/pass" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT)
What's Albufeira's assist/pass?
SELECT "Assist/pass" FROM table_65432 WHERE "Location" = 'albufeira'
SELECT "Assist/pass" FROM "table_65432" WHERE "Location" = 'albufeira'
0.068359
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 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 procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what number of patients admitted before the year 2179 were below 76 years of age?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "76" AND demographic.admityear < "2179"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2179" > "demographic"."admityear" AND "76" > "demographic"."age"
0.136719
CREATE TABLE table_47593 ("Rider" TEXT, "Manufacturer" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT)
What is the lowest grid number that a race took place doing more than 21 laps?
SELECT MIN("Grid") FROM table_47593 WHERE "Laps" > '21'
SELECT MIN("Grid") FROM "table_47593" WHERE "Laps" > '21'
0.055664
CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) 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 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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) 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 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 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)
how many hematological effect of infection - leukocytosis patients since 2104 were diagnosed during the same hospital encounter after being diagnosed with s/p thoracotomy - lung reduction surgery?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hematological effect of infection - leukocytosis' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2104') AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 's/p thoracotomy - lung reduction surgery' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2104') AS t2 WHERE t1.diagnosistime < t2.diagnosistime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid
WITH "t2" AS (SELECT "diagnosis"."diagnosistime", "patient"."patienthealthsystemstayid" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 's/p thoracotomy - lung reduction surgery' AND STRFTIME('%y', "diagnosis"."diagnosistime") >= '2104') SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."diagnosistime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" WHERE "diagnosis"."diagnosisname" = 'hematological effect of infection - leukocytosis' AND STRFTIME('%y', "diagnosis"."diagnosistime") >= '2104'
0.744141
CREATE TABLE grapes (id DECIMAL, grape TEXT, color TEXT) CREATE TABLE wine (no DECIMAL, grape TEXT, winery TEXT, appelation TEXT, state TEXT, name TEXT, year DECIMAL, price DECIMAL, score DECIMAL, cases DECIMAL, drink TEXT) CREATE TABLE appellations (no DECIMAL, appelation TEXT, county TEXT, state TEXT, area TEXT, isava TEXT)
How many wines are there for each grape?
SELECT COUNT(*), grape FROM wine GROUP BY grape
SELECT COUNT(*), "grape" FROM "wine" GROUP BY "grape"
0.051758
CREATE TABLE table_29458735_5 (regiment VARCHAR, county VARCHAR)
which regimen was in the arkansas county
SELECT regiment FROM table_29458735_5 WHERE county = "Arkansas"
SELECT "regiment" FROM "table_29458735_5" WHERE "Arkansas" = "county"
0.067383
CREATE TABLE table_name_79 (home VARCHAR, leading_scorer VARCHAR, score VARCHAR)
Which Home has a Leading scorer of dajuan wagner (25) and a Score of 89 82? Question 3
SELECT home FROM table_name_79 WHERE leading_scorer = "dajuan wagner (25)" AND score = "89–82"
SELECT "home" FROM "table_name_79" WHERE "89–82" = "score" AND "dajuan wagner (25)" = "leading_scorer"
0.099609
CREATE TABLE Ref_Transaction_Types (transaction_type_code VARCHAR, transaction_type_description VARCHAR) CREATE TABLE Purchases (purchase_transaction_id INT, purchase_details VARCHAR) CREATE TABLE Investors (investor_id INT, Investor_details VARCHAR) 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 Transactions_Lots (transaction_id INT, lot_id INT) CREATE TABLE Sales (sales_transaction_id INT, sales_details VARCHAR)
Show the average transaction amount for different transaction types with a bar chart, and I want to display Y in descending order.
SELECT transaction_type_code, AVG(amount_of_transaction) FROM Transactions GROUP BY transaction_type_code ORDER BY AVG(amount_of_transaction) DESC
SELECT "transaction_type_code", AVG("amount_of_transaction") FROM "Transactions" GROUP BY "transaction_type_code" ORDER BY AVG("amount_of_transaction") DESC NULLS LAST
0.163086
CREATE TABLE Apartment_Facilities (apt_id INT, facility_code CHAR) 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 Guests (guest_id INT, gender_code CHAR, guest_first_name VARCHAR, guest_last_name VARCHAR, date_of_birth DATETIME) 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 View_Unit_Status (apt_id INT, apt_booking_id INT, status_date DATETIME, available_yn BIT) 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)
Return 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 Lives_in (stuid INT, dormid INT, room_number INT) CREATE TABLE Has_amenity (dormid INT, amenid INT) CREATE TABLE Student (StuID INT, LName VARCHAR, Fname VARCHAR, Age INT, Sex VARCHAR, Major INT, Advisor INT, city_code VARCHAR) CREATE TABLE Dorm_amenity (amenid INT, amenity_name VARCHAR) CREATE TABLE Dorm (dormid INT, dorm_name VARCHAR, student_capacity INT, gender VARCHAR)
Find the first name of students who are living in the Smith Hall, and count them by a bar chart, I want to display by the X in descending.
SELECT Fname, COUNT(Fname) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' GROUP BY Fname ORDER BY Fname DESC
SELECT "Fname", COUNT("Fname") FROM "Student" AS "T1" JOIN "Lives_in" AS "T2" ON "T1"."stuid" = "T2"."stuid" JOIN "Dorm" AS "T3" ON "T2"."dormid" = "T3"."dormid" AND "T3"."dorm_name" = 'Smith Hall' GROUP BY "Fname" ORDER BY "Fname" DESC NULLS LAST
0.241211
CREATE TABLE cinema (Cinema_ID INT, Name TEXT, Openning_year INT, Capacity INT, Location TEXT) CREATE TABLE schedule (Cinema_ID INT, Film_ID INT, Date TEXT, Show_times_per_day INT, Price FLOAT) CREATE TABLE film (Film_ID INT, Rank_in_series INT, Number_in_season INT, Title TEXT, Directed_by TEXT, Original_air_date TEXT, Production_code TEXT)
For each record in schedule, show average of the price for each day in a bar chart.
SELECT Date, AVG(Price) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Date
SELECT "Date", AVG("Price") FROM "schedule" AS "T1" JOIN "film" AS "T2" ON "T1"."Film_ID" = "T2"."Film_ID" JOIN "cinema" AS "T3" ON "T1"."Cinema_ID" = "T3"."Cinema_ID" GROUP BY "Date"
0.178711
CREATE TABLE table_name_82 (nationality VARCHAR, athlete VARCHAR, time VARCHAR)
What's the nationality of Henry Carr having a time of 20.3y?
SELECT nationality FROM table_name_82 WHERE athlete = "henry carr" AND time = "20.3y"
SELECT "nationality" FROM "table_name_82" WHERE "20.3y" = "time" AND "athlete" = "henry carr"
0.09082
CREATE TABLE table_53641 ("Driver" TEXT, "Constructor" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT)
What is the high lap total that has a grid of less than 4 and a Time/Retired of + 1 lap?
SELECT MAX("Laps") FROM table_53641 WHERE "Grid" < '4' AND "Time/Retired" = '+ 1 lap'
SELECT MAX("Laps") FROM "table_53641" WHERE "Grid" < '4' AND "Time/Retired" = '+ 1 lap'
0.084961
CREATE TABLE table_27279050_1 (poles VARCHAR, points VARCHAR, nation VARCHAR)
How many pole position achieved 0 points from Mexico?
SELECT COUNT(poles) FROM table_27279050_1 WHERE points = "0" AND nation = "Mexico"
SELECT COUNT("poles") FROM "table_27279050_1" WHERE "0" = "points" AND "Mexico" = "nation"
0.087891
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title 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) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) 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 transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
when patient 25733 had a first urine out foley output today?
SELECT outputevents.charttime FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25733)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out foley' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') ORDER BY outputevents.charttime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 25733 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'urine out foley' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT "outputevents"."charttime" FROM "outputevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE DATETIME("outputevents"."charttime", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL ORDER BY "outputevents"."charttime" NULLS FIRST LIMIT 1
0.842773
CREATE TABLE table_name_53 (january VARCHAR, april VARCHAR)
Name the january when april is courtney rachel culkin
SELECT january FROM table_name_53 WHERE april = "courtney rachel culkin"
SELECT "january" FROM "table_name_53" WHERE "april" = "courtney rachel culkin"
0.076172
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense 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 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) 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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) 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 PostTags (PostId DECIMAL, TagId 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 PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
No scored/accepted answer in given time period.
SELECT q.Id AS "post_link", q.CreationDate FROM Posts AS q WHERE q.PostTypeId = 1 AND q.AcceptedAnswerId IS NULL AND q.CreationDate > '##StartDate##' AND q.CreationDate < '##EndDate##' AND q.ClosedDate IS NULL AND COALESCE((SELECT MAX(a.Score) FROM Posts AS a WHERE a.ParentId = q.Id AND a.PostTypeId = 2), 0) <= 0 ORDER BY q.CreationDate
SELECT "q"."Id" AS "post_link", "q"."CreationDate" FROM "Posts" AS "q" WHERE FALSE ORDER BY "q"."CreationDate" NULLS FIRST
0.119141
CREATE TABLE table_name_4 (away_team VARCHAR, home_team VARCHAR)
What was the score for the away team when geelong was the home team?
SELECT away_team AS score FROM table_name_4 WHERE home_team = "geelong"
SELECT "away_team" AS "score" FROM "table_name_4" WHERE "geelong" = "home_team"
0.077148
CREATE TABLE table_32807 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
Who was the home team that had a score of 13.11 (89)?
SELECT "Home team" FROM table_32807 WHERE "Home team score" = '13.11 (89)'
SELECT "Home team" FROM "table_32807" WHERE "Home team score" = '13.11 (89)'
0.074219
CREATE TABLE table_22603 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" TEXT)
What is title of episode 06-02-407?
SELECT "Title" FROM table_22603 WHERE "Production code" = '06-02-407'
SELECT "Title" FROM "table_22603" WHERE "Production code" = '06-02-407'
0.069336
CREATE TABLE Research_Staff (staff_details VARCHAR)
List the research staff details, and order in ascending order.
SELECT staff_details FROM Research_Staff ORDER BY staff_details
SELECT "staff_details" FROM "Research_Staff" ORDER BY "staff_details" NULLS FIRST
0.079102
CREATE TABLE table_40379 ("Index" TEXT, "Name" TEXT, "Song" TEXT, "Group Song" TEXT, "Score" TEXT)
What is Score, when Name is Nicole ?
SELECT "Score" FROM table_40379 WHERE "Name" = 'nicole 赖淞凤'
SELECT "Score" FROM "table_40379" WHERE "Name" = 'nicole 赖淞凤'
0.05957
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) 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 Accounts (account_id INT, customer_id INT, date_account_opened DATETIME, account_name VARCHAR, other_account_details VARCHAR) CREATE TABLE Product_Categories (production_type_code VARCHAR, product_type_description VARCHAR, vat_rating DECIMAL) 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 Invoices (invoice_number INT, order_id INT, invoice_date DATETIME) 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 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)
Show first name and id for all customers with at least 2 accounts Show bar chart, and rank in descending by the y-axis.
SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.customer_id DESC
SELECT "T2"."customer_first_name", "T1"."customer_id" FROM "Accounts" AS "T1" JOIN "Customers" AS "T2" ON "T1"."customer_id" = "T2"."customer_id" ORDER BY "T1"."customer_id" DESC NULLS LAST
0.18457
CREATE TABLE table_71570 ("Rank" FLOAT, "Name" TEXT, "Nationality" TEXT, "Score" TEXT, "Perfection" TEXT)
Who had a perfection percentage of 73.24%?
SELECT "Name" FROM table_71570 WHERE "Perfection" = '73.24%'
SELECT "Name" FROM "table_71570" WHERE "Perfection" = '73.24%'
0.060547
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime 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 allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) 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 intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime 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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
what was the first time that the sao2 of patient 017-9785 was, , greater than 88.0?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-9785')) AND vitalperiodic.sao2 > 88.0 AND NOT vitalperiodic.sao2 IS NULL ORDER BY vitalperiodic.observationtime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '017-9785' 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 "vitalperiodic"."observationtime" FROM "vitalperiodic" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE "vitalperiodic"."sao2" > 88.0 AND NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."sao2" IS NULL ORDER BY "vitalperiodic"."observationtime" NULLS FIRST LIMIT 1
0.644531
CREATE TABLE table_name_52 (attendance INT, date VARCHAR)
What is the lowest attendance on September 3, 1972?
SELECT MIN(attendance) FROM table_name_52 WHERE date = "september 3, 1972"
SELECT MIN("attendance") FROM "table_name_52" WHERE "date" = "september 3, 1972"
0.078125
CREATE TABLE table_6461 ("District" TEXT, "2010 Population ( 000 ) " FLOAT, "2008 GDP ( USD bn ) a" FLOAT, "2008 GDP per capita ( USD ) a" FLOAT, "Agri culture b" FLOAT, "Mining b" FLOAT, "Manufac turing b" FLOAT, "Services & cons truction b" FLOAT, "Exports ( USD mn ) 2011" TEXT, "Median mo. salary ( USD ) a e" FLOAT, "Vehicles ( per 1000 ) d" FLOAT, "Income poverty f" FLOAT, "Structural poverty g" FLOAT)
Manufac turing b of 16.8, and a 2008 GDP per capita (USD) a smaller than 4,162, so what is the total number of mining b?
SELECT COUNT("Mining b") FROM table_6461 WHERE "Manufac turing b" = '16.8' AND "2008 GDP per capita (USD) a" < '4,162'
SELECT COUNT("Mining b") FROM "table_6461" WHERE "2008 GDP per capita (USD) a" < '4,162' AND "Manufac turing b" = '16.8'
0.117188
CREATE TABLE film_actor (actor_id DECIMAL, film_id DECIMAL, last_update TIME) CREATE TABLE actor (actor_id DECIMAL, first_name TEXT, last_name TEXT, last_update TIME) CREATE TABLE rental (rental_id DECIMAL, rental_date TIME, inventory_id DECIMAL, customer_id DECIMAL, return_date TIME, staff_id DECIMAL, last_update TIME) CREATE TABLE category (category_id DECIMAL, name TEXT, last_update TIME) CREATE TABLE film_category (film_id DECIMAL, category_id DECIMAL, last_update TIME) CREATE TABLE customer (customer_id DECIMAL, store_id DECIMAL, first_name TEXT, last_name TEXT, email TEXT, address_id DECIMAL, active BOOLEAN, create_date TIME, last_update TIME) CREATE TABLE country (country_id DECIMAL, country TEXT, last_update TIME) CREATE TABLE store (store_id DECIMAL, manager_staff_id DECIMAL, address_id DECIMAL, last_update TIME) CREATE TABLE inventory (inventory_id DECIMAL, film_id DECIMAL, store_id DECIMAL, last_update TIME) CREATE TABLE film (film_id DECIMAL, title TEXT, description TEXT, release_year TIME, language_id DECIMAL, original_language_id DECIMAL, rental_duration DECIMAL, rental_rate DECIMAL, length DECIMAL, replacement_cost DECIMAL, rating TEXT, special_features TEXT, last_update TIME) CREATE TABLE payment (payment_id DECIMAL, customer_id DECIMAL, staff_id DECIMAL, rental_id DECIMAL, amount DECIMAL, payment_date TIME, last_update TIME) CREATE TABLE language (language_id DECIMAL, name TEXT, last_update TIME) CREATE TABLE city (city_id DECIMAL, city TEXT, country_id DECIMAL, last_update TIME) CREATE TABLE address (address_id DECIMAL, address TEXT, address2 TEXT, district TEXT, city_id DECIMAL, postal_code TEXT, phone TEXT, last_update TIME) CREATE TABLE staff (staff_id DECIMAL, first_name TEXT, last_name TEXT, address_id DECIMAL, picture others, email TEXT, store_id DECIMAL, active BOOLEAN, username TEXT, password TEXT, last_update TIME) CREATE TABLE film_text (film_id DECIMAL, title TEXT, description TEXT)
How many different last names do the actors and actresses have?
SELECT COUNT(DISTINCT last_name) FROM actor
SELECT COUNT(DISTINCT "last_name") FROM "actor"
0.045898
CREATE TABLE medicine (FDA_approved VARCHAR)
How many distinct FDA approval statuses are there for the medicines?
SELECT COUNT(DISTINCT FDA_approved) FROM medicine
SELECT COUNT(DISTINCT "FDA_approved") FROM "medicine"
0.051758
CREATE TABLE table_23925 ("Name" TEXT, "#" FLOAT, "Height" TEXT, "Weight" FLOAT, "Position" TEXT, "Year" TEXT, "Home Town" TEXT, "High School" TEXT)
What is the high school for the player who's hometown is Blue Island, Il?
SELECT "High School" FROM table_23925 WHERE "Home Town" = 'Blue Island, IL'
SELECT "High School" FROM "table_23925" WHERE "Home Town" = 'Blue Island, IL'
0.075195
CREATE TABLE table_22786 ("Match no." FLOAT, "Match Type" TEXT, "Team Europe" TEXT, "Score" TEXT, "Team USA" TEXT, "Progressive Total" TEXT)
What was the score at the end of the match number 4?
SELECT "Score" FROM table_22786 WHERE "Match no." = '4'
SELECT "Score" FROM "table_22786" WHERE "Match no." = '4'
0.055664
CREATE TABLE table_1015521_2 (commonwealth_equivalent VARCHAR, us_air_force_equivalent VARCHAR)
If you're a major general in the US air force then what ranking will you receive in the commonwealth's air force?
SELECT commonwealth_equivalent FROM table_1015521_2 WHERE us_air_force_equivalent = "Major General"
SELECT "commonwealth_equivalent" FROM "table_1015521_2" WHERE "Major General" = "us_air_force_equivalent"
0.102539
CREATE TABLE table_46137 ("Date" TEXT, "Winning score" TEXT, "To par" TEXT, "Margin of victory" TEXT, "Runner ( s ) -up" TEXT)
Which date was the event that Yani won in a playoff over Yueh-Chyn Huang?
SELECT "Date" FROM table_46137 WHERE "Margin of victory" = 'playoff' AND "Runner(s)-up" = 'yueh-chyn huang'
SELECT "Date" FROM "table_46137" WHERE "Margin of victory" = 'playoff' AND "Runner(s)-up" = 'yueh-chyn huang'
0.106445
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) 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)
How many patients of divorced marital status have the procedure icd9 code 4523?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.icd9_code = "4523"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "4523" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "DIVORCED" = "demographic"."marital_status"
0.220703
CREATE TABLE Rooms (RoomId TEXT, roomName TEXT, beds INT, bedType TEXT, maxOccupancy INT, basePrice INT, decor TEXT) CREATE TABLE Reservations (Code INT, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate FLOAT, LastName TEXT, FirstName TEXT, Adults INT, Kids INT)
Find the number of rooms with price higher than 120 for different decor Show bar chart, and could you list Y-axis from low to high order?
SELECT decor, COUNT(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor ORDER BY COUNT(*)
SELECT "decor", COUNT(*) FROM "Rooms" WHERE "basePrice" > 120 GROUP BY "decor" ORDER BY COUNT(*) NULLS FIRST
0.105469