schema
stringlengths
29
5.42k
question
stringlengths
0
752
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
8.94k
weight
float64
0
8.73
CREATE TABLE table_name_35 (popular_votes NUMBER, percentage VARCHAR2, year VARCHAR2)
Name the average popular votes in years after 1990 with percentage of 4.94%
SELECT AVG(popular_votes) FROM table_name_35 WHERE percentage = "4.94%" AND year > 1990
SELECT AVG("popular_votes") FROM "table_name_35" WHERE "4.94%" = "percentage" AND "year" > 1990
0.092773
CREATE TABLE trip (id NUMBER, duration NUMBER, start_date CLOB, start_station_name CLOB, start_station_id NUMBER, end_date CLOB, end_station_name CLOB, end_station_id NUMBER, bike_id NUMBER, subscription_type CLOB, zip_code NUMBER) CREATE TABLE weather (date CLOB, max_temperature_f NUMBER, mean_temperature_f NUMBER, min_temperature_f NUMBER, max_dew_point_f NUMBER, mean_dew_point_f NUMBER, min_dew_point_f NUMBER, max_humidity NUMBER, mean_humidity NUMBER, min_humidity NUMBER, max_sea_level_pressure_inches NUMBER, mean_sea_level_pressure_inches NUMBER, min_sea_level_pressure_inches NUMBER, max_visibility_miles NUMBER, mean_visibility_miles NUMBER, min_visibility_miles NUMBER, max_wind_Speed_mph NUMBER, mean_wind_speed_mph NUMBER, max_gust_speed_mph NUMBER, precipitation_inches NUMBER, cloud_cover NUMBER, events CLOB, wind_dir_degrees NUMBER, zip_code NUMBER) CREATE TABLE station (id NUMBER, name CLOB, lat NUMBER, long NUMBER, dock_count NUMBER, city CLOB, installation_date CLOB) CREATE TABLE status (station_id NUMBER, bikes_available NUMBER, docks_available NUMBER, time CLOB)
A bar chart about what is the name of every city that has at least 15 stations and how many stations does it have?
SELECT city, COUNT(*) FROM station GROUP BY city
SELECT "city", COUNT(*) FROM "station" GROUP BY "city"
0.052734
CREATE TABLE table_name_3 (total_tenure_time VARCHAR2, total_tenure_rank VARCHAR2)
What was the total tenure time with a rank of 49?
SELECT total_tenure_time FROM table_name_3 WHERE total_tenure_rank = 49
SELECT "total_tenure_time" FROM "table_name_3" WHERE "total_tenure_rank" = 49
0.075195
CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
in 2105 what was the first care unit of patient 4900?
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 4900) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) = '2105' ORDER BY transfers.intime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 4900 GROUP BY "hadm_id") SELECT "transfers"."careunit" FROM "transfers" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "transfers"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND NOT "transfers"."careunit" IS NULL AND STRFTIME('%y', "transfers"."intime") = '2105' ORDER BY "transfers"."intime" FETCH FIRST 1 ROWS ONLY
0.391602
CREATE TABLE table_2402 ("Game" FLOAT, "Date" CLOB, "Opponent" CLOB, "Result" CLOB, "Sun Devils points" FLOAT, "Opponents" FLOAT, "Record" CLOB)
What was the record for the Sun Devils when they scored 44 points?
SELECT "Record" FROM table_2402 WHERE "Sun Devils points" = '44'
SELECT "Record" FROM "table_2402" WHERE "Sun Devils points" = '44'
0.064453
CREATE TABLE table_name_80 (rank NUMBER, singapore_cup VARCHAR2, name VARCHAR2)
What is the sum of Rank that when the Singapore Cup is 0 (1), and the Name is masrezwan masturi?
SELECT SUM(rank) FROM table_name_80 WHERE singapore_cup = "0 (1)" AND name = "masrezwan masturi"
SELECT SUM("rank") FROM "table_name_80" WHERE "0 (1)" = "singapore_cup" AND "masrezwan masturi" = "name"
0.101563
CREATE TABLE table_name_72 (race_name VARCHAR2, winning_driver VARCHAR2)
What is the name of the race won by driver Carlos Reutemann?
SELECT race_name FROM table_name_72 WHERE winning_driver = "carlos reutemann"
SELECT "race_name" FROM "table_name_72" WHERE "carlos reutemann" = "winning_driver"
0.081055
CREATE TABLE table_5355 ("Nation" CLOB, "Skip" CLOB, "Third" CLOB, "Second" CLOB, "Lead" CLOB)
Which Skip has a Third of constanze hummelt?
SELECT "Skip" FROM table_5355 WHERE "Third" = 'constanze hummelt'
SELECT "Skip" FROM "table_5355" WHERE "Third" = 'constanze hummelt'
0.06543
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
how many patients below the age of 54 had stayed in the hospital for more than 20 days?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "54" AND demographic.days_stay > "20"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "20" < "demographic"."days_stay" AND "54" > "demographic"."age"
0.134766
CREATE TABLE bridge (architect_id NUMBER, id NUMBER, name CLOB, location CLOB, length_meters FLOAT, length_feet FLOAT) CREATE TABLE architect (id CLOB, name CLOB, nationality CLOB, gender CLOB) CREATE TABLE mill (architect_id NUMBER, id NUMBER, location CLOB, name CLOB, type CLOB, built_year NUMBER, notes CLOB)
What are the ids and names of the architects who built at least 3 bridges .
SELECT T1.name, T1.id FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id
SELECT "T1"."name", "T1"."id" FROM "architect" "T1" JOIN "bridge" "T2" ON "T1"."id" = "T2"."architect_id"
0.102539
CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER)
when was the first time that patient 002-64535 was prescribed with potassium chloride and aspirin at the same time since 09/2105?
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'potassium chloride' AND patient.uniquepid = '002-64535' AND STRFTIME('%y-%m', medication.drugstarttime) >= '2105-09') AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'aspirin' AND patient.uniquepid = '002-64535' AND STRFTIME('%y-%m', medication.drugstarttime) >= '2105-09') AS t2 ON t1.uniquepid = t2.uniquepid WHERE DATETIME(t1.drugstarttime) = DATETIME(t2.drugstarttime) ORDER BY t1.drugstarttime LIMIT 1
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."uniquepid" = '002-64535' WHERE "medication"."drugname" = 'aspirin' AND STRFTIME('%y-%m', "medication"."drugstarttime") >= '2105-09') SELECT "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."uniquepid" = '002-64535' JOIN "t2" "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("medication"."drugstarttime") = DATETIME("t2"."drugstarttime") WHERE "medication"."drugname" = 'potassium chloride' AND STRFTIME('%y-%m', "medication"."drugstarttime") >= '2105-09' ORDER BY "medication"."drugstarttime" FETCH FIRST 1 ROWS ONLY
0.793945
CREATE TABLE table_10572 ("Team" CLOB, "Outgoing manager" CLOB, "Manner of departure" CLOB, "Replaced by" CLOB, "Date of appointment" CLOB)
I want the date of appointment for manner of departure being sacked
SELECT "Date of appointment" FROM table_10572 WHERE "Manner of departure" = 'sacked'
SELECT "Date of appointment" FROM "table_10572" WHERE "Manner of departure" = 'sacked'
0.083984
CREATE TABLE table_67571 ("Place" CLOB, "Player" CLOB, "Country" CLOB, "Score" CLOB, "To par" CLOB)
Which player has the score 72-67-69=208?
SELECT "Player" FROM table_67571 WHERE "Score" = '72-67-69=208'
SELECT "Player" FROM "table_67571" WHERE "Score" = '72-67-69=208'
0.063477
CREATE TABLE table_17653 ("#" FLOAT, "Athlete ( NOC ) " CLOB, "Shooting" CLOB, "Fencing" CLOB, "Swimming" CLOB, "Riding" CLOB, "Running" CLOB, "Total" FLOAT)
What's the fencing score of the player with 9:40.31 (1080 pts) in running?
SELECT "Fencing" FROM table_17653 WHERE "Running" = '9:40.31 (1080 pts)'
SELECT "Fencing" FROM "table_17653" WHERE "Running" = '9:40.31 (1080 pts)'
0.072266
CREATE TABLE table_204_859 (id NUMBER, "year" NUMBER, "seniors ( trood award & rodda medal ) " CLOB, "reserves ( rex hartley medal ) " CLOB, "under 18's ( bruce wilkinson medal ) " CLOB, "under 16's ( shaw/carter medal ) " CLOB)
tell me the only year vinall appears on the list .
SELECT "year" FROM table_204_859 WHERE "reserves (rex hartley medal)" = 'jack vinall'
SELECT "year" FROM "table_204_859" WHERE "reserves (rex hartley medal)" = 'jack vinall'
0.084961
CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2)
Which classes are available this Spring ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND semester.semester = 'Spring' AND semester.semester_id = course_offering.semester 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 "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'Spring' AND "semester"."year" = 2016 WHERE "course"."department" = 'EECS'
0.335938
CREATE TABLE city (City_ID NUMBER, Official_Name CLOB, Status CLOB, Area_km_2 FLOAT, Population FLOAT, Census_Ranking CLOB) CREATE TABLE farm (Farm_ID NUMBER, Year NUMBER, Total_Horses FLOAT, Working_Horses FLOAT, Total_Cattle FLOAT, Oxen FLOAT, Bulls FLOAT, Cows FLOAT, Pigs FLOAT, Sheep_and_Goats FLOAT) CREATE TABLE competition_record (Competition_ID NUMBER, Farm_ID NUMBER, Rank NUMBER) CREATE TABLE farm_competition (Competition_ID NUMBER, Year NUMBER, Theme CLOB, Host_city_ID NUMBER, Hosts CLOB)
What are the statuses and average populations of each city.
SELECT Status, AVG(Population) FROM city GROUP BY Status
SELECT "Status", AVG("Population") FROM "city" GROUP BY "Status"
0.0625
CREATE TABLE table_26842217_4 (result VARCHAR2, site VARCHAR2)
What were the results in the bryant-denny stadium tuscaloosa, al?
SELECT result FROM table_26842217_4 WHERE site = "Bryant-Denny Stadium • Tuscaloosa, AL"
SELECT "result" FROM "table_26842217_4" WHERE "Bryant-Denny Stadium • Tuscaloosa, AL" = "site"
0.091797
CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
what is the number of patients less than 79 years who have femoral artery primary disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "FEMORAL ARTERY THROMBOSIS" AND demographic.age < "79"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "79" > "demographic"."age" AND "FEMORAL ARTERY THROMBOSIS" = "demographic"."diagnosis"
0.157227
CREATE TABLE table_28052 ("Episode no." FLOAT, "Airdate" CLOB, "Dave Viewers" FLOAT, "Dave Rank" FLOAT, "Rank ( cable ) " FLOAT, "Dave ja vu Viewers" FLOAT, "Total viewers" FLOAT)
What is the lowest cable rank of an episode with 1464000 viewers?
SELECT MIN("Rank (cable)") FROM table_28052 WHERE "Total viewers" = '1464000'
SELECT MIN("Rank (cable)") FROM "table_28052" WHERE "Total viewers" = '1464000'
0.077148
CREATE TABLE table_21284 ("Official Name" CLOB, "Status" CLOB, "Area km 2" CLOB, "Population" FLOAT, "Census Ranking" CLOB)
What is the maximum population of the land with an area of 276.84 km2?
SELECT MAX("Population") FROM table_21284 WHERE "Area km 2" = '276.84'
SELECT MAX("Population") FROM "table_21284" WHERE "Area km 2" = '276.84'
0.070313
CREATE TABLE cite (citingpaperid NUMBER, citedpaperid NUMBER) CREATE TABLE paperfield (fieldid NUMBER, paperid NUMBER) CREATE TABLE paperkeyphrase (paperid NUMBER, keyphraseid NUMBER) CREATE TABLE keyphrase (keyphraseid NUMBER, keyphrasename VARCHAR2) CREATE TABLE writes (paperid NUMBER, authorid NUMBER) CREATE TABLE dataset (datasetid NUMBER, datasetname VARCHAR2) CREATE TABLE venue (venueid NUMBER, venuename VARCHAR2) CREATE TABLE author (authorid NUMBER, authorname VARCHAR2) CREATE TABLE paperdataset (paperid NUMBER, datasetid NUMBER) CREATE TABLE journal (journalid NUMBER, journalname VARCHAR2) CREATE TABLE field (fieldid NUMBER) CREATE TABLE paper (paperid NUMBER, title VARCHAR2, venueid NUMBER, year NUMBER, numciting NUMBER, numcitedby NUMBER, journalid NUMBER)
When was richard anderson 's first publication ?
SELECT DISTINCT COUNT(paper.paperid), paper.year FROM author, paper, writes WHERE author.authorname = 'richard anderson' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY paper.year ORDER BY paper.year
SELECT DISTINCT COUNT("paper"."paperid"), "paper"."year" FROM "author" JOIN "writes" ON "author"."authorid" = "writes"."authorid" JOIN "paper" ON "paper"."paperid" = "writes"."paperid" WHERE "author"."authorname" = 'richard anderson' GROUP BY "paper"."year" ORDER BY "paper"."year"
0.274414
CREATE TABLE table_5567 ("School" CLOB, "Location" CLOB, "Mascot" CLOB, "Enrollment" FLOAT, "IHSAA Class" CLOB, "# / County" CLOB)
What school is located in rossville?
SELECT "School" FROM table_5567 WHERE "Location" = 'rossville'
SELECT "School" FROM "table_5567" WHERE "Location" = 'rossville'
0.0625
CREATE TABLE table_3119 ("Venue" CLOB, "Hosted" FLOAT, "Average" FLOAT, "Highest" FLOAT, "Lowest" FLOAT, "Total" FLOAT, "Last Year" CLOB, "Up/Down" CLOB)
What is the up/down associated with the Subiaco Oval?
SELECT "Up/Down" FROM table_3119 WHERE "Venue" = 'Subiaco Oval'
SELECT "Up/Down" FROM "table_3119" WHERE "Venue" = 'Subiaco Oval'
0.063477
CREATE TABLE table_67962 ("Year" FLOAT, "Class" CLOB, "Team" CLOB, "Points" FLOAT, "Wins" FLOAT)
What is the least amount of wins earlier than 1964 with more than 7 points?
SELECT MIN("Wins") FROM table_67962 WHERE "Year" < '1964' AND "Points" > '7'
SELECT MIN("Wins") FROM "table_67962" WHERE "Points" > '7' AND "Year" < '1964'
0.076172
CREATE TABLE table_16575 ("Club" CLOB, "Position in 2012\\u201313" CLOB, "First season in top division" CLOB, "Number of seasons in top division" FLOAT, "Number of seasons in the Premier League" FLOAT, "First season of current spell in top division" CLOB, "Top division titles" FLOAT, "Last top division title" CLOB)
What is the least top division titles?
SELECT MIN("Top division titles") FROM table_16575
SELECT MIN("Top division titles") FROM "table_16575"
0.050781
CREATE TABLE table_11344 ("Rank" FLOAT, "Player" CLOB, "Country" CLOB, "Earnings ( $ ) " FLOAT, "Events" FLOAT, "Wins" FLOAT)
How much money did the player ranked above 3 with under 28 events earn?
SELECT COUNT("Earnings ( $ )") FROM table_11344 WHERE "Events" < '28' AND "Rank" < '3'
SELECT COUNT("Earnings ( $ )") FROM "table_11344" WHERE "Events" < '28' AND "Rank" < '3'
0.085938
CREATE TABLE table_name_14 (co_drivers VARCHAR2, year VARCHAR2, team VARCHAR2)
Which co-driver was part of team Martini Lancia earlier than 1986?
SELECT co_drivers FROM table_name_14 WHERE year < 1986 AND team = "martini lancia"
SELECT "co_drivers" FROM "table_name_14" WHERE "martini lancia" = "team" AND "year" < 1986
0.087891
CREATE TABLE table_23056 ("Rank" CLOB, "Rating" CLOB, "Completion Percentage" CLOB, "Touchdown Percentage" CLOB, "Yards Per Attempt" CLOB, "Total Yards" CLOB)
How many yards per attempt were there when total yards were 513?
SELECT "Yards Per Attempt" FROM table_23056 WHERE "Total Yards" = '513'
SELECT "Yards Per Attempt" FROM "table_23056" WHERE "Total Yards" = '513'
0.071289
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER) CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
Show the name of the product that is cheapest in each product category with their minimum price with a bar graph, sort in ascending by the bar.
SELECT Name, MIN(Price) FROM Products GROUP BY Name ORDER BY Name
SELECT "Name", MIN("Price") FROM "Products" GROUP BY "Name" ORDER BY "Name"
0.073242
CREATE TABLE table_69789 ("Name" CLOB, "Years" CLOB, "Gender" CLOB, "Area" CLOB, "Authority" CLOB, "Decile" FLOAT, "Roll" FLOAT)
What is the roll number for East Gore School?
SELECT COUNT("Roll") FROM table_69789 WHERE "Name" = 'east gore school'
SELECT COUNT("Roll") FROM "table_69789" WHERE "Name" = 'east gore school'
0.071289
CREATE TABLE table_name_99 (year NUMBER, entrant VARCHAR2, points VARCHAR2)
What year did Austria-Marlboro BRM get more than 0 points?
SELECT AVG(year) FROM table_name_99 WHERE entrant = "austria-marlboro brm" AND points > 0
SELECT AVG("year") FROM "table_name_99" WHERE "austria-marlboro brm" = "entrant" AND "points" > 0
0.094727
CREATE TABLE table_name_54 (h___a VARCHAR2, date VARCHAR2)
What is the H/A for 20 february 2007?
SELECT h___a FROM table_name_54 WHERE date = "20 february 2007"
SELECT "h___a" FROM "table_name_54" WHERE "20 february 2007" = "date"
0.067383
CREATE TABLE table_name_90 (name___generation VARCHAR2, architecture_version VARCHAR2, model VARCHAR2)
What is the name of the architecture version of the MIPS-III 64-bit, and model 2b?
SELECT name___generation FROM table_name_90 WHERE architecture_version = "mips-iii 64-bit" AND model = "2b"
SELECT "name___generation" FROM "table_name_90" WHERE "2b" = "model" AND "architecture_version" = "mips-iii 64-bit"
0.112305
CREATE TABLE table_name_54 (category VARCHAR2, for_the_show VARCHAR2, year VARCHAR2)
For 2006 what category has the Show of kasautii zindagii kay?
SELECT category FROM table_name_54 WHERE for_the_show = "kasautii zindagii kay" AND year = 2006
SELECT "category" FROM "table_name_54" WHERE "for_the_show" = "kasautii zindagii kay" AND "year" = 2006
0.100586
CREATE TABLE table_name_38 (score VARCHAR2, team VARCHAR2)
Which score is the Seattle team?
SELECT score FROM table_name_38 WHERE team = "seattle"
SELECT "score" FROM "table_name_38" WHERE "seattle" = "team"
0.058594
CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
what the first height of patient 016-14568 until 36 months ago.
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-14568') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime) <= DATETIME(CURRENT_TIME(), '-36 month') ORDER BY patient.unitadmittime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '016-14568' GROUP BY "patienthealthsystemstayid") SELECT "patient"."admissionheight" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE DATETIME("patient"."unitadmittime") <= DATETIME(CURRENT_TIME(), '-36 month') AND NOT "_u_0"."" IS NULL AND NOT "patient"."admissionheight" IS NULL ORDER BY "patient"."unitadmittime" FETCH FIRST 1 ROWS ONLY
0.482422
CREATE TABLE table_name_22 (time VARCHAR2, event VARCHAR2)
Name the time for event of tfc 21
SELECT time FROM table_name_22 WHERE event = "tfc 21"
SELECT "time" FROM "table_name_22" WHERE "event" = "tfc 21"
0.057617
CREATE TABLE table_name_56 (year VARCHAR2, points NUMBER)
What year has more than 0 points?
SELECT year FROM table_name_56 WHERE points > 0
SELECT "year" FROM "table_name_56" WHERE "points" > 0
0.051758
CREATE TABLE table_1784514_1 (year_established NUMBER)
What is the latest year a division was established?
SELECT MAX(year_established) FROM table_1784514_1
SELECT MAX("year_established") FROM "table_1784514_1"
0.051758
CREATE TABLE table_27675 ("Position" CLOB, "Number" FLOAT, "Horse" CLOB, "Jockey" CLOB, "Age" FLOAT, "Handicap" CLOB, "SP" CLOB, "Distance" CLOB)
who isthe jockey in 10th position?
SELECT "Jockey" FROM table_27675 WHERE "Position" = '10th'
SELECT "Jockey" FROM "table_27675" WHERE "Position" = '10th'
0.058594
CREATE TABLE table_10007452_3 (fleet_series__quantity_ VARCHAR2, fuel_propulsion VARCHAR2)
how many times is the fuel propulsion is cng?
SELECT COUNT(fleet_series__quantity_) FROM table_10007452_3 WHERE fuel_propulsion = "CNG"
SELECT COUNT("fleet_series__quantity_") FROM "table_10007452_3" WHERE "CNG" = "fuel_propulsion"
0.092773
CREATE TABLE table_203_276 (id NUMBER, "album#" CLOB, "english title" CLOB, "chinese ( traditional ) " CLOB, "chinese ( simplified ) " CLOB, "release date" CLOB, "label" CLOB)
what is the number of songs on rock records ?
SELECT COUNT("english title") FROM table_203_276 WHERE "label" = 'rock records'
SELECT COUNT("english title") FROM "table_203_276" WHERE "label" = 'rock records'
0.079102
CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME)
when was the first time patient 033-42758 got prescribed for pantoprazole 40 mg iv recon soln and meropenem 500 mg iv solr at the same time in 11/2104?
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'pantoprazole 40 mg iv recon soln' AND patient.uniquepid = '033-42758' AND STRFTIME('%y-%m', medication.drugstarttime) = '2104-11') AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'meropenem 500 mg iv solr' AND patient.uniquepid = '033-42758' AND STRFTIME('%y-%m', medication.drugstarttime) = '2104-11') AS t2 ON t1.uniquepid = t2.uniquepid WHERE DATETIME(t1.drugstarttime) = DATETIME(t2.drugstarttime) ORDER BY t1.drugstarttime LIMIT 1
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."uniquepid" = '033-42758' WHERE "medication"."drugname" = 'meropenem 500 mg iv solr' AND STRFTIME('%y-%m', "medication"."drugstarttime") = '2104-11') SELECT "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."uniquepid" = '033-42758' JOIN "t2" "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("medication"."drugstarttime") = DATETIME("t2"."drugstarttime") WHERE "medication"."drugname" = 'pantoprazole 40 mg iv recon soln' AND STRFTIME('%y-%m', "medication"."drugstarttime") = '2104-11' ORDER BY "medication"."drugstarttime" FETCH FIRST 1 ROWS ONLY
0.822266
CREATE TABLE room (blockcode VARCHAR2, unavailable VARCHAR2)
What are the unique block codes that have available rooms?
SELECT DISTINCT blockcode FROM room WHERE unavailable = 0
SELECT DISTINCT "blockcode" FROM "room" WHERE "unavailable" = 0
0.061523
CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB)
what are the five most commonly given diagnoses for patients who have received esophagogastroduodenoscopy - with biopsy previously within 2 months until 2102?
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'esophagogastroduodenoscopy - with biopsy' AND STRFTIME('%y', treatment.treatmenttime) <= '2102') AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', diagnosis.diagnosistime) <= '2102') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.diagnosistime AND DATETIME(t2.diagnosistime) BETWEEN DATETIME(t1.treatmenttime) AND DATETIME(t1.treatmenttime, '+2 month') GROUP BY t2.diagnosisname) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosisname", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE STRFTIME('%y', "diagnosis"."diagnosistime") <= '2102'), "t3" AS (SELECT "t2"."diagnosisname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" JOIN "t2" "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND "t2"."diagnosistime" > "treatment"."treatmenttime" AND DATETIME("t2"."diagnosistime") <= DATETIME("treatment"."treatmenttime", '+2 month') AND DATETIME("t2"."diagnosistime") >= DATETIME("treatment"."treatmenttime") WHERE "treatment"."treatmentname" = 'esophagogastroduodenoscopy - with biopsy' AND STRFTIME('%y', "treatment"."treatmenttime") <= '2102' GROUP BY "t2"."diagnosisname") SELECT "t3"."diagnosisname" FROM "t3" "t3" WHERE "t3"."c1" <= 5
0.936523
CREATE TABLE airport (airport_code VARCHAR2, airport_name CLOB, airport_location CLOB, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2, minimum_connect_time NUMBER) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE flight_stop (flight_id NUMBER, stop_number NUMBER, stop_days CLOB, stop_airport CLOB, arrival_time NUMBER, arrival_airline CLOB, arrival_flight_number NUMBER, departure_time NUMBER, departure_airline CLOB, departure_flight_number NUMBER, stop_time NUMBER) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE restriction (restriction_code CLOB, advance_purchase NUMBER, stopovers CLOB, saturday_stay_required CLOB, minimum_stay NUMBER, maximum_stay NUMBER, application CLOB, no_discounts CLOB) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE aircraft (aircraft_code VARCHAR2, aircraft_description VARCHAR2, manufacturer VARCHAR2, basic_type VARCHAR2, engines NUMBER, propulsion VARCHAR2, wide_body VARCHAR2, wing_span NUMBER, length NUMBER, weight NUMBER, capacity NUMBER, pay_load NUMBER, cruising_speed NUMBER, range_miles NUMBER, pressurized VARCHAR2) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB)
BALTIMORE to KANSAS CITY economy
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'KANSAS CITY' AND fare_basis.economy = 'YES' AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" "AIRPORT_SERVICE_0" JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'BALTIMORE' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "flight_fare" ON "flight"."flight_id" = "flight_fare"."flight_id" JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'KANSAS CITY' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" JOIN "fare_basis" ON "fare"."fare_basis_code" = "fare_basis"."fare_basis_code" AND "fare_basis"."economy" = 'YES'
0.725586
CREATE TABLE table_8166 ("Week" FLOAT, "Date" CLOB, "Opponent" CLOB, "Result" CLOB, "Record" CLOB, "Game site" CLOB)
What is the opponent on May 25, 2007?
SELECT "Opponent" FROM table_8166 WHERE "Date" = 'may 25, 2007'
SELECT "Opponent" FROM "table_8166" WHERE "Date" = 'may 25, 2007'
0.063477
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB)
find the dtug type and drug code of propafenone hci.
SELECT prescriptions.drug_type, prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.drug = "Propafenone HCl"
SELECT "prescriptions"."drug_type", "prescriptions"."formulary_drug_cd" FROM "prescriptions" WHERE "Propafenone HCl" = "prescriptions"."drug"
0.137695
CREATE TABLE table_1600 ("Official Name" CLOB, "Status" CLOB, "Area km 2" CLOB, "Population" FLOAT, "Census Ranking" CLOB)
How many areas are named West Isles?
SELECT COUNT("Area km 2") FROM table_1600 WHERE "Official Name" = 'West Isles'
SELECT COUNT("Area km 2") FROM "table_1600" WHERE "Official Name" = 'West Isles'
0.078125
CREATE TABLE table_7604 ("Tie no" CLOB, "Home team" CLOB, "Score" CLOB, "Away team" CLOB, "Date" CLOB)
When has a Score of 0 0, and a Away team of scunthorpe united?
SELECT "Date" FROM table_7604 WHERE "Score" = '0–0' AND "Away team" = 'scunthorpe united'
SELECT "Date" FROM "table_7604" WHERE "Away team" = 'scunthorpe united' AND "Score" = '0–0'
0.088867
CREATE TABLE table_train_274 ("id" NUMBER, "gender" CLOB, "serum_bicarbonate" NUMBER, "randomization_bg" NUMBER, "positive_serum" BOOLEAN, "diabetic_ketoacidosis" BOOLEAN, "urinary_ketones" BOOLEAN, "diastolic_blood_pressure_dbp" NUMBER, "heart_rate" NUMBER, "body_mass_index_bmi" FLOAT, "age" FLOAT, "NOUSE" FLOAT)
bmi range: > 25 kg / m^2 and < 45 kg / m^2
SELECT * FROM table_train_274 WHERE body_mass_index_bmi > 25 AND body_mass_index_bmi < 45
SELECT * FROM "table_train_274" WHERE "body_mass_index_bmi" < 45 AND "body_mass_index_bmi" > 25
0.092773
CREATE TABLE table_70698 ("Race" CLOB, "Position" CLOB, "Time ( HH:MM:SS ) " CLOB, "Speed ( Mph ) " CLOB, "Replica" CLOB)
What race is in the 5th position?
SELECT "Race" FROM table_70698 WHERE "Position" = '5th'
SELECT "Race" FROM "table_70698" WHERE "Position" = '5th'
0.055664
CREATE TABLE MEDIATYPE (Name VARCHAR2, MediaTypeId VARCHAR2) CREATE TABLE TRACK (MediaTypeId VARCHAR2)
What is the least common media type in all tracks?
SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) LIMIT 1
SELECT "T1"."Name" FROM "MEDIATYPE" "T1" JOIN "TRACK" "T2" ON "T1"."MediaTypeId" = "T2"."MediaTypeId" GROUP BY "T2"."MediaTypeId" ORDER BY COUNT(*) FETCH FIRST 1 ROWS ONLY
0.166992
CREATE TABLE table_1816947_2 (division___section VARCHAR2, season VARCHAR2)
In which division did they compete in 2012?
SELECT division___section FROM table_1816947_2 WHERE season = 2012
SELECT "division___section" FROM "table_1816947_2" WHERE "season" = 2012
0.070313
CREATE TABLE table_18193 ("District" CLOB, "Incumbent" CLOB, "Party" CLOB, "First elected" FLOAT, "Result" CLOB, "Candidates" CLOB)
Name the result for New York 11
SELECT "Result" FROM table_18193 WHERE "District" = 'New York 11'
SELECT "Result" FROM "table_18193" WHERE "District" = 'New York 11'
0.06543
CREATE TABLE table_204_542 (id NUMBER, "season" CLOB, "competition" CLOB, "round" CLOB, "club" CLOB, "home" CLOB, "away" CLOB, "aggregate" CLOB)
who won by the most points at home ?
SELECT "club" FROM table_204_542 ORDER BY "home" DESC LIMIT 1
SELECT "club" FROM "table_204_542" ORDER BY "home" DESC FETCH FIRST 1 ROWS ONLY
0.077148
CREATE TABLE table_45708 ("Place" CLOB, "Player" CLOB, "Country" CLOB, "Score" FLOAT, "To par" CLOB)
How many strokes under par was the player who scored 71?
SELECT "To par" FROM table_45708 WHERE "Score" = '71'
SELECT "To par" FROM "table_45708" WHERE "Score" = '71'
0.053711
CREATE TABLE table_2114238_1 (archive VARCHAR2, run_time VARCHAR2)
Which archive has a run time of 23:48?
SELECT archive FROM table_2114238_1 WHERE run_time = "23:48"
SELECT "archive" FROM "table_2114238_1" WHERE "23:48" = "run_time"
0.064453
CREATE TABLE table_name_91 (manufacturer VARCHAR2, rider VARCHAR2)
Who is the manufacturer of the car driven by Bradley Smith?
SELECT manufacturer FROM table_name_91 WHERE rider = "bradley smith"
SELECT "manufacturer" FROM "table_name_91" WHERE "bradley smith" = "rider"
0.072266
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
count the number of patients whose procedure icd9 code is 3606.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "3606"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "3606" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id"
0.171875
CREATE TABLE table_name_1 (surface VARCHAR2, score_in_final VARCHAR2)
What was the surface of the match that ended in a score of 5 7, 6 4, [10 7]?
SELECT surface FROM table_name_1 WHERE score_in_final = "5–7, 6–4, [10–7]"
SELECT "surface" FROM "table_name_1" WHERE "5–7, 6–4, [10–7]" = "score_in_final"
0.078125
CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER)
Your accepted answers sorted by score.
SELECT * FROM Posts AS Answers WHERE OwnerUserId = '##UserId##' AND PostTypeId = 2 AND EXISTS(SELECT Id FROM Posts AS Questions WHERE PostTypeId = 1 AND Questions.AcceptedAnswerId = Answers.Id) ORDER BY Score DESC
SELECT * FROM "Posts" "Answers" WHERE "OwnerUserId" = '##UserId##' AND "PostTypeId" = 2 AND EXISTS(SELECT "Id" FROM "Posts" "Questions" WHERE "Answers"."Id" = "Questions"."AcceptedAnswerId" AND "PostTypeId" = 1) ORDER BY "Score" DESC
0.227539
CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER)
tell me the length of stay of patient 73913's first stay in icu.
SELECT STRFTIME('%j', icustays.outtime) - STRFTIME('%j', icustays.intime) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73913) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 73913 GROUP BY "hadm_id") SELECT STRFTIME('%j', "icustays"."outtime") - STRFTIME('%j', "icustays"."intime") FROM "icustays" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND NOT "icustays"."outtime" IS NULL ORDER BY "icustays"."intime" FETCH FIRST 1 ROWS ONLY
0.389648
CREATE TABLE table_78552 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
Who was South Melbourne's away opponents?
SELECT "Away team" FROM table_78552 WHERE "Home team" = 'south melbourne'
SELECT "Away team" FROM "table_78552" WHERE "Home team" = 'south melbourne'
0.073242
CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE airport (airport_code VARCHAR2, airport_name CLOB, airport_location CLOB, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2, minimum_connect_time NUMBER) CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE restriction (restriction_code CLOB, advance_purchase NUMBER, stopovers CLOB, saturday_stay_required CLOB, minimum_stay NUMBER, maximum_stay NUMBER, application CLOB, no_discounts CLOB) CREATE TABLE aircraft (aircraft_code VARCHAR2, aircraft_description VARCHAR2, manufacturer VARCHAR2, basic_type VARCHAR2, engines NUMBER, propulsion VARCHAR2, wide_body VARCHAR2, wing_span NUMBER, length NUMBER, weight NUMBER, capacity NUMBER, pay_load NUMBER, cruising_speed NUMBER, range_miles NUMBER, pressurized VARCHAR2) CREATE TABLE flight_stop (flight_id NUMBER, stop_number NUMBER, stop_days CLOB, stop_airport CLOB, arrival_time NUMBER, arrival_airline CLOB, arrival_flight_number NUMBER, departure_time NUMBER, departure_airline CLOB, departure_flight_number NUMBER, stop_time NUMBER) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB)
explain the fare code Q
SELECT DISTINCT booking_class FROM class_of_service WHERE booking_class = 'Q'
SELECT DISTINCT "booking_class" FROM "class_of_service" WHERE "booking_class" = 'Q'
0.081055
CREATE TABLE basketball_match (Team_ID NUMBER, School_ID NUMBER, Team_Name CLOB, ACC_Regular_Season CLOB, ACC_Percent CLOB, ACC_Home CLOB, ACC_Road CLOB, All_Games CLOB, All_Games_Percent NUMBER, All_Home CLOB, All_Road CLOB, All_Neutral CLOB) CREATE TABLE university (School_ID NUMBER, School CLOB, Location CLOB, Founded FLOAT, Affiliation CLOB, Enrollment FLOAT, Nickname CLOB, Primary_conference CLOB)
Give me the comparison about Team_ID over the All_Games , could you show by the total number from high to low?
SELECT All_Games, Team_ID FROM basketball_match ORDER BY Team_ID DESC
SELECT "All_Games", "Team_ID" FROM "basketball_match" ORDER BY "Team_ID" DESC
0.075195
CREATE TABLE table_5274 ("Club" CLOB, "Sport" CLOB, "League" CLOB, "Titles" FLOAT, "Founded" FLOAT)
Which Founded has a Club of tri-city storm and a Titles larger than 1?
SELECT SUM("Founded") FROM table_5274 WHERE "Club" = 'tri-city storm' AND "Titles" > '1'
SELECT SUM("Founded") FROM "table_5274" WHERE "Club" = 'tri-city storm' AND "Titles" > '1'
0.087891
CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME)
what were the top five frequently prescribed drugs that the patients were prescribed in the same hospital visit after they had been prescribed klonopin?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'klonopin') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.drugstarttime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime", "patient"."patienthealthsystemstayid" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid"), "t3" AS (SELECT "t2"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" "t2" ON "medication"."drugstarttime" < "t2"."drugstarttime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "medication"."drugname" = 'klonopin' GROUP BY "t2"."drugname") SELECT "t3"."drugname" FROM "t3" "t3" WHERE "t3"."c1" <= 5
0.726563
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
what is the drug type of drug name aloe vesta 2-n-1 skin cond?
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Aloe Vesta 2-n-1 Skin Cond"
SELECT "prescriptions"."drug_type" FROM "prescriptions" WHERE "Aloe Vesta 2-n-1 Skin Cond" = "prescriptions"."drug"
0.112305
CREATE TABLE table_53364 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
Where did a home team score 8.14 (62)?
SELECT "Venue" FROM table_53364 WHERE "Home team score" = '8.14 (62)'
SELECT "Venue" FROM "table_53364" WHERE "Home team score" = '8.14 (62)'
0.069336
CREATE TABLE table_name_33 (ga VARCHAR2, losses VARCHAR2, team VARCHAR2)
What's the G.A. when there were 2 losses and Scotland played?
SELECT ga FROM table_name_33 WHERE losses = "2" AND team = "scotland"
SELECT "ga" FROM "table_name_33" WHERE "2" = "losses" AND "scotland" = "team"
0.075195
CREATE TABLE film_market_estimation (Estimation_ID NUMBER, Low_Estimate FLOAT, High_Estimate FLOAT, Film_ID NUMBER, Type CLOB, Market_ID NUMBER, Year NUMBER) CREATE TABLE film (Film_ID NUMBER, Title CLOB, Studio CLOB, Director CLOB, Gross_in_dollar NUMBER) CREATE TABLE market (Market_ID NUMBER, Country CLOB, Number_cities NUMBER)
For each title, use a bar chart to show the number of films, list from low to high by the x axis please.
SELECT Title, COUNT(Title) FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID GROUP BY Title ORDER BY Title
SELECT "Title", COUNT("Title") FROM "film" "T1" JOIN "film_market_estimation" "T2" ON "T1"."Film_ID" = "T2"."Film_ID" GROUP BY "Title" ORDER BY "Title"
0.147461
CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER)
If I want to declare a major in DHYGRACK , then what classes to do I need to take ?
SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE course.department LIKE '%DHYGRACK%' AND program_course.category LIKE 'PreMajor' AND program_course.course_id = course.course_id
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE 'PreMajor' WHERE "course"."department" LIKE '%DHYGRACK%'
0.251953
CREATE TABLE table_38682 ("Rank" FLOAT, "Quarterback" CLOB, "Seasons" CLOB, "Teams" CLOB, "Team Wins" FLOAT, "Team Losses" FLOAT, "Career Wins" FLOAT, "Career Losses" FLOAT, "Ties" FLOAT)
Which Seattle quarterback has more than 81 career wins and less than 70 team wins?
SELECT "Quarterback" FROM table_38682 WHERE "Career Wins" > '81' AND "Teams" = 'seattle' AND "Team Wins" < '70'
SELECT "Quarterback" FROM "table_38682" WHERE "Career Wins" > '81' AND "Team Wins" < '70' AND "Teams" = 'seattle'
0.110352
CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER) CREATE TABLE employees (EMPLOYEE_ID NUMBER, FIRST_NAME VARCHAR2, LAST_NAME VARCHAR2, EMAIL VARCHAR2, PHONE_NUMBER VARCHAR2, HIRE_DATE DATE, JOB_ID VARCHAR2, SALARY NUMBER, COMMISSION_PCT NUMBER, MANAGER_ID NUMBER, DEPARTMENT_ID NUMBER) CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2) CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER)
For employees with first names that end with the letter m, groups and count the first name to visualize a bar graph, list in ascending by the X-axis.
SELECT FIRST_NAME, COUNT(FIRST_NAME) FROM employees WHERE FIRST_NAME LIKE '%m' GROUP BY FIRST_NAME ORDER BY FIRST_NAME
SELECT "FIRST_NAME", COUNT("FIRST_NAME") FROM "employees" WHERE "FIRST_NAME" LIKE '%m' GROUP BY "FIRST_NAME" ORDER BY "FIRST_NAME"
0.126953
CREATE TABLE table_name_66 (high_points VARCHAR2, record VARCHAR2)
What is the name of the player with the High points when there was a Record of 31 48?
SELECT high_points FROM table_name_66 WHERE record = "31–48"
SELECT "high_points" FROM "table_name_66" WHERE "31–48" = "record"
0.064453
CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB)
Votes received on answers to closed questions vs votes received on all answers.
SELECT * FROM (SELECT u.Id, u.DisplayName, SUM(a.Score) AS allVotes, SUM(a.Score * CASE WHEN q.ClosedDate IS NULL THEN 0 ELSE 1 END) AS closedVotes FROM Users AS u JOIN Posts AS a ON a.PostTypeId = 2 AND u.Id = a.OwnerUserId JOIN Posts AS q ON q.Id = a.ParentId GROUP BY u.Id, u.DisplayName) AS x WHERE x.allVotes > 1000 ORDER BY x.closedVotes / x.allVotes DESC
WITH "x" AS (SELECT "u"."Id", "u"."DisplayName", SUM("a"."Score") AS "allVotes", SUM("a"."Score" * CASE WHEN "q"."ClosedDate" IS NULL THEN 0 ELSE 1 END) AS "closedVotes" FROM "Users" "u" JOIN "Posts" "a" ON "a"."OwnerUserId" = "u"."Id" AND "a"."PostTypeId" = 2 JOIN "Posts" "q" ON "a"."ParentId" = "q"."Id" GROUP BY "u"."Id", "u"."DisplayName") SELECT * FROM "x" "x" WHERE "x"."allVotes" > 1000 ORDER BY "x"."closedVotes" / NULLIF("x"."allVotes", 0) DESC
0.443359
CREATE TABLE table_26414 ("Rank" FLOAT, "WS Points" FLOAT, "Name" CLOB, "Country" CLOB, "08-09 I/O best" FLOAT, "08-09 GP/JGP best" FLOAT, "08-09 GP/JGP 2nd" FLOAT, "08-09 OI best" FLOAT, "08-09 OI 2nd" FLOAT, "07-08 I/O best" FLOAT, "07-08 GP/JGP best" FLOAT, "07-08 GP/JGP 2nd" FLOAT, "07-08 OI best" FLOAT, "07-08 OI 2nd" FLOAT)
What is the number of 07-08 oi best values associated with 08-09 i/o bests of exactly 202?
SELECT COUNT("07-08 OI best") FROM table_26414 WHERE "08-09 I/O best" = '202'
SELECT COUNT("07-08 OI best") FROM "table_26414" WHERE "08-09 I/O best" = '202'
0.077148
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB)
how many patients whose age is less than 30 and procedure icd9 code is 3771?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "30" AND procedures.icd9_code = "3771"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "3771" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "30" > "demographic"."age"
0.204102
CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
find the admission type and diagnosis of the subject id 30011.
SELECT demographic.admission_type, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "30011"
SELECT "demographic"."admission_type", "diagnoses"."short_title" FROM "demographic" JOIN "diagnoses" ON "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "30011" = "demographic"."subject_id"
0.189453
CREATE TABLE table_56412 ("Judge" CLOB, "State" CLOB, "Born/Died" CLOB, "Active service" CLOB, "Chief Judge" CLOB, "Senior status" CLOB, "Appointed by" CLOB, "Reason for termination" CLOB)
Who was Judge Jack Edward Tanner's chief judge?
SELECT "Chief Judge" FROM table_56412 WHERE "Judge" = 'jack edward tanner'
SELECT "Chief Judge" FROM "table_56412" WHERE "Judge" = 'jack edward tanner'
0.074219
CREATE TABLE department (dno NUMBER, division CLOB, dname CLOB, room CLOB, building CLOB, dphone NUMBER) CREATE TABLE gradeconversion (lettergrade CLOB, gradepoint NUMBER) CREATE TABLE minor_in (stuid NUMBER, dno NUMBER) CREATE TABLE course (cid CLOB, cname CLOB, credits NUMBER, instructor NUMBER, days CLOB, hours CLOB, dno NUMBER) CREATE TABLE enrolled_in (stuid NUMBER, cid CLOB, grade CLOB) CREATE TABLE student (stuid NUMBER, lname CLOB, fname CLOB, age NUMBER, sex CLOB, major NUMBER, advisor NUMBER, city_code CLOB) CREATE TABLE faculty (facid NUMBER, lname CLOB, fname CLOB, rank CLOB, sex CLOB, phone NUMBER, room CLOB, building CLOB) CREATE TABLE member_of (facid NUMBER, dno NUMBER, appt_type CLOB)
Find the max and min grade point for all letter grade.
SELECT MAX(gradepoint), MIN(gradepoint) FROM gradeconversion
SELECT MAX("gradepoint"), MIN("gradepoint") FROM "gradeconversion"
0.064453
CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME)
how much does patient 006-86236's heartrate differ between last measured on the last intensive care unit visit compared to the second to last value measured on the last intensive care unit visit?
SELECT (SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-86236') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND NOT vitalperiodic.heartrate IS NULL ORDER BY vitalperiodic.observationtime DESC LIMIT 1) - (SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-86236') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND NOT vitalperiodic.heartrate IS NULL ORDER BY vitalperiodic.observationtime DESC LIMIT 1 OFFSET 1)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-86236' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL GROUP BY "patientunitstayid" ORDER BY "patient"."unitadmittime" DESC FETCH FIRST 1 ROWS ONLY), "_u_4" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_3" ON "_u_3"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_3"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL GROUP BY "patientunitstayid" ORDER BY "patient"."unitadmittime" DESC FETCH FIRST 1 ROWS ONLY) SELECT (SELECT "vitalperiodic"."heartrate" FROM "vitalperiodic" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."heartrate" IS NULL ORDER BY "vitalperiodic"."observationtime" DESC FETCH FIRST 1 ROWS ONLY) - (SELECT "vitalperiodic"."heartrate" FROM "vitalperiodic" LEFT JOIN "_u_4" "_u_4" ON "_u_4"."" = "vitalperiodic"."patientunitstayid" WHERE NOT "_u_4"."" IS NULL AND NOT "vitalperiodic"."heartrate" IS NULL ORDER BY "vitalperiodic"."observationtime" DESC OFFSET 1 ROWS FETCH FIRST 1 ROWS ONLY)
1.318359
CREATE TABLE table_204_683 (id NUMBER, "no." NUMBER, "constituency" CLOB, "winner candidate" CLOB, "party" CLOB, "votes" NUMBER, "margin" NUMBER)
what was the average number of votes for the first 5 elections ?
SELECT AVG("votes") FROM table_204_683 WHERE "no." <= 5
SELECT AVG("votes") FROM "table_204_683" WHERE "no." <= 5
0.055664
CREATE TABLE table_74435 ("Pick #" FLOAT, "MLS team" CLOB, "Player" CLOB, "Position" CLOB, "Affiliation" CLOB)
What MLS team picked Babayele Sodade?
SELECT "MLS team" FROM table_74435 WHERE "Player" = 'Babayele Sodade'
SELECT "MLS team" FROM "table_74435" WHERE "Player" = 'Babayele Sodade'
0.069336
CREATE TABLE table_58058 ("Team" CLOB, "Points" FLOAT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Against" FLOAT, "Diff" FLOAT)
How many games were played when the loss is less than 5 and points greater than 41?
SELECT SUM("Played") FROM table_58058 WHERE "Lost" < '5' AND "Points" > '41'
SELECT SUM("Played") FROM "table_58058" WHERE "Lost" < '5' AND "Points" > '41'
0.076172
CREATE TABLE table_name_86 (away_team VARCHAR2)
When the away team was collingwood, what was the away team score?
SELECT away_team AS score FROM table_name_86 WHERE away_team = "collingwood"
SELECT "away_team" AS "score" FROM "table_name_86" WHERE "away_team" = "collingwood"
0.082031
CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME)
did patient 025-44495 have any results from the microbiology of the sputum, tracheal specimen this month?
SELECT COUNT(*) FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-44495')) AND microlab.culturesite = 'sputum, tracheal specimen' AND DATETIME(microlab.culturetakentime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '025-44495' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "microlab" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "microlab"."patientunitstayid" WHERE "microlab"."culturesite" = 'sputum, tracheal specimen' AND DATETIME("microlab"."culturetakentime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND NOT "_u_1"."" IS NULL
0.646484
CREATE TABLE table_name_15 (architecture VARCHAR2, vehicle_name VARCHAR2)
What type of architecture does the Saturn Vue have?
SELECT architecture FROM table_name_15 WHERE vehicle_name = "saturn vue"
SELECT "architecture" FROM "table_name_15" WHERE "saturn vue" = "vehicle_name"
0.076172
CREATE TABLE table_23857 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" CLOB, "Directedby" CLOB, "Writtenby" CLOB, "Originalairdate" CLOB, "Production code" CLOB, "U.S.viewers ( million ) " CLOB)
What season number did production code 2wab12?
SELECT "No. in season" FROM table_23857 WHERE "Production code" = '2WAB12'
SELECT "No. in season" FROM "table_23857" WHERE "Production code" = '2WAB12'
0.074219
CREATE TABLE table_name_42 (season VARCHAR2, goals VARCHAR2, team VARCHAR2)
What is Season, when Goals is less than 6, and when Team is 'Tarbiat Yazd'?
SELECT season FROM table_name_42 WHERE goals < 6 AND team = "tarbiat yazd"
SELECT "season" FROM "table_name_42" WHERE "goals" < 6 AND "tarbiat yazd" = "team"
0.080078
CREATE TABLE table_name_8 (drawn NUMBER, played NUMBER)
What is the largest drawn that has a played less than 38?
SELECT MAX(drawn) FROM table_name_8 WHERE played < 38
SELECT MAX("drawn") FROM "table_name_8" WHERE "played" < 38
0.057617
CREATE TABLE table_6050 ("Game" FLOAT, "Date" CLOB, "Opponent" CLOB, "Score" CLOB, "Series" CLOB)
What was the series standing after game 1?
SELECT "Series" FROM table_6050 WHERE "Game" = '1'
SELECT "Series" FROM "table_6050" WHERE "Game" = '1'
0.050781
CREATE TABLE table_17828 ("City/Town" CLOB, "July av. T" CLOB, "Rain" CLOB, "Days with rain ( year/summer ) " CLOB, "Days with frost" FLOAT, "Sunlight hours" FLOAT)
What is the days with rain figure for the city of Santiago de Compostela?
SELECT "Days with rain (year/summer)" FROM table_17828 WHERE "City/Town" = 'Santiago de Compostela'
SELECT "Days with rain (year/summer)" FROM "table_17828" WHERE "City/Town" = 'Santiago de Compostela'
0.098633
CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE flight_stop (flight_id NUMBER, stop_number NUMBER, stop_days CLOB, stop_airport CLOB, arrival_time NUMBER, arrival_airline CLOB, arrival_flight_number NUMBER, departure_time NUMBER, departure_airline CLOB, departure_flight_number NUMBER, stop_time NUMBER) CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE aircraft (aircraft_code VARCHAR2, aircraft_description VARCHAR2, manufacturer VARCHAR2, basic_type VARCHAR2, engines NUMBER, propulsion VARCHAR2, wide_body VARCHAR2, wing_span NUMBER, length NUMBER, weight NUMBER, capacity NUMBER, pay_load NUMBER, cruising_speed NUMBER, range_miles NUMBER, pressurized VARCHAR2) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE airport (airport_code VARCHAR2, airport_name CLOB, airport_location CLOB, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2, minimum_connect_time NUMBER) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE restriction (restriction_code CLOB, advance_purchase NUMBER, stopovers CLOB, saturday_stay_required CLOB, minimum_stay NUMBER, maximum_stay NUMBER, application CLOB, no_discounts CLOB) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB)
list aircraft types that fly between BOSTON and SAN FRANCISCO
SELECT DISTINCT aircraft.aircraft_code FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, equipment_sequence, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND equipment_sequence.aircraft_code = aircraft.aircraft_code AND flight.aircraft_code_sequence = equipment_sequence.aircraft_code_sequence AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
SELECT DISTINCT "aircraft"."aircraft_code" FROM "aircraft" JOIN "equipment_sequence" ON "aircraft"."aircraft_code" = "equipment_sequence"."aircraft_code" JOIN "flight" ON "equipment_sequence"."aircraft_code_sequence" = "flight"."aircraft_code_sequence" JOIN "airport_service" "AIRPORT_SERVICE_0" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'BOSTON' JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SAN FRANCISCO'
0.68457
CREATE TABLE table_10565 ("Week" CLOB, "Date" CLOB, "Opponent" CLOB, "Result" CLOB, "Kickoff [a ]" CLOB, "Game site" CLOB, "Attendance" CLOB, "Record" CLOB)
Which date did 64,443 people attend a game?
SELECT "Date" FROM table_10565 WHERE "Attendance" = '64,443'
SELECT "Date" FROM "table_10565" WHERE "Attendance" = '64,443'
0.060547
CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME)
what is the name of the drug prescribed to patient 9038 within 2 days after they had been diagnosed with adv eff antprotazoal nec until 03/2105?
SELECT t2.drug FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 9038 AND diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'adv eff antprotazoal nec') AND STRFTIME('%y-%m', diagnoses_icd.charttime) <= '2105-03') AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 9038 AND STRFTIME('%y-%m', prescriptions.startdate) <= '2105-03') AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.startdate AND DATETIME(t2.startdate) BETWEEN DATETIME(t1.charttime) AND DATETIME(t1.charttime, '+2 day')
WITH "t2" AS (SELECT "admissions"."subject_id", "prescriptions"."drug", "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" AND "admissions"."subject_id" = 9038 WHERE STRFTIME('%y-%m', "prescriptions"."startdate") <= '2105-03') SELECT "t2"."drug" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'adv eff antprotazoal nec' JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" AND "admissions"."subject_id" = 9038 JOIN "t2" "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND "diagnoses_icd"."charttime" < "t2"."startdate" AND DATETIME("diagnoses_icd"."charttime") <= DATETIME("t2"."startdate") AND DATETIME("diagnoses_icd"."charttime", '+2 day') >= DATETIME("t2"."startdate") WHERE STRFTIME('%y-%m', "diagnoses_icd"."charttime") <= '2105-03'
0.90918
CREATE TABLE table_25853 ("Mother Tongue" CLOB, "Population ( 2006 ) " FLOAT, "Percentage ( 2006 ) " CLOB, "Population ( 2011 ) " FLOAT, "Percentage ( 2011 ) " CLOB)
What was the percentage in 2006 whose natives is Polish?
SELECT "Percentage (2006)" FROM table_25853 WHERE "Mother Tongue" = 'Polish'
SELECT "Percentage (2006)" FROM "table_25853" WHERE "Mother Tongue" = 'Polish'
0.076172
CREATE TABLE table_name_6 (seating VARCHAR2, notes VARCHAR2, introduced VARCHAR2)
How many people can be seated on the aircraft that was introduced in 2008 and has notes of in service?
SELECT seating FROM table_name_6 WHERE notes = "in service" AND introduced = 2008
SELECT "seating" FROM "table_name_6" WHERE "in service" = "notes" AND "introduced" = 2008
0.086914