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_19628 ("Position" FLOAT, "Team" CLOB, "Played" FLOAT, "Wins" FLOAT, "Draws" FLOAT, "Losses" FLOAT, "Scored" FLOAT, "Conceded" FLOAT, "Points" FLOAT)
What is the highest win for the team Nacional?
SELECT MAX("Wins") FROM table_19628 WHERE "Team" = 'Nacional'
SELECT MAX("Wins") FROM "table_19628" WHERE "Team" = 'Nacional'
0.061523
CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE 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) 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 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)
what are the three drugs that are prescribed the most frequently in 2104?
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE STRFTIME('%y', medication.drugstarttime) = '2104' GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 3
WITH "t1" AS (SELECT "medication"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "medication" WHERE STRFTIME('%y', "medication"."drugstarttime") = '2104' GROUP BY "medication"."drugname") SELECT "t1"."drugname" FROM "t1" "t1" WHERE "t1"."c1" <= 3
0.260742
CREATE TABLE table_name_45 (away_team VARCHAR2, time VARCHAR2)
What was the away team for the match that had a time of 18:30?
SELECT away_team FROM table_name_45 WHERE time = "18:30"
SELECT "away_team" FROM "table_name_45" WHERE "18:30" = "time"
0.060547
CREATE TABLE furniture_manufacte (Manufacturer_ID NUMBER, Furniture_ID NUMBER, Price_in_Dollar FLOAT) CREATE TABLE furniture (Furniture_ID NUMBER, Name CLOB, Num_of_Component NUMBER, Market_Rate FLOAT) CREATE TABLE manufacturer (Manufacturer_ID NUMBER, Open_Year FLOAT, Name CLOB, Num_of_Factories NUMBER, Num_of_Shops NUMBER)
Find the number of funiture types produced by each manufacturer as well as the company names Show bar chart, and list in ascending by the names please.
SELECT Name, COUNT(*) FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.Manufacturer_ID = t2.Manufacturer_ID GROUP BY t1.Manufacturer_ID ORDER BY Name
SELECT "Name", COUNT(*) FROM "manufacturer" "t1" JOIN "furniture_manufacte" "t2" ON "t1"."Manufacturer_ID" = "t2"."Manufacturer_ID" GROUP BY "t1"."Manufacturer_ID" ORDER BY "Name"
0.174805
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) 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)
provide the number of patients whose marital status is married and diagnoses short title is hypovolemia?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.short_title = "Hypovolemia"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Hypovolemia" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "MARRIED" = "demographic"."marital_status"
0.225586
CREATE TABLE table_name_53 (series VARCHAR2, date VARCHAR2)
Which Series are on september 15, 2007?
SELECT series FROM table_name_53 WHERE date = "september 15, 2007"
SELECT "series" FROM "table_name_53" WHERE "date" = "september 15, 2007"
0.070313
CREATE TABLE table_1341423_43 (first_elected VARCHAR2, district VARCHAR2)
Name the first elected for texas 6 district
SELECT first_elected FROM table_1341423_43 WHERE district = "Texas 6"
SELECT "first_elected" FROM "table_1341423_43" WHERE "Texas 6" = "district"
0.073242
CREATE TABLE table_35418 ("Week" FLOAT, "Date" CLOB, "Opponent" CLOB, "Time ( ET ) " CLOB, "Result" CLOB)
Which week has a Result of w 23 6?
SELECT "Week" FROM table_35418 WHERE "Result" = 'w 23–6'
SELECT "Week" FROM "table_35418" WHERE "Result" = 'w 23–6'
0.056641
CREATE TABLE table_49612 ("Region ( year ) " CLOB, "No. 1" CLOB, "No. 2" CLOB, "No. 3" CLOB, "No. 4" CLOB, "No. 5" CLOB, "No. 6" CLOB, "No. 7" CLOB, "No. 8" CLOB, "No. 9" CLOB, "No. 10" CLOB)
What is No. 1, when Region (Year) is Mississippi (2010)?
SELECT "No. 1" FROM table_49612 WHERE "Region (year)" = 'mississippi (2010)'
SELECT "No. 1" FROM "table_49612" WHERE "Region (year)" = 'mississippi (2010)'
0.076172
CREATE TABLE aircraft (aircraft_code VARCHAR2, aircraft_description VARCHAR2, manufacturer VARCHAR2, basic_type VARCHAR2, engines NUMBER, propulsion VARCHAR2, wide_body VARCHAR2, wing_span NUMBER, length NUMBER, weight NUMBER, capacity NUMBER, pay_load NUMBER, cruising_speed NUMBER, range_miles NUMBER, pressurized VARCHAR2) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER) 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 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 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 code_description (code VARCHAR2, description CLOB) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note 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 flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE compartment_class (compartment VARCHAR2, class_type 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 city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER)
flights from PHOENIX to MILWAUKEE on wednesday evening
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MILWAUKEE' AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHOENIX' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 1800 AND 2200
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 23 AND "date_day"."month_number" = 4 AND "date_day"."year" = 1991 JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PHOENIX' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days" AND "flight"."departure_time" <= 2200 AND "flight"."departure_time" >= 1800 JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'MILWAUKEE'
0.769531
CREATE TABLE table_name_47 (team VARCHAR2, last_match VARCHAR2)
What is the name of team with Palmeiras 4-2 portuguesa as the last match?
SELECT team FROM table_name_47 WHERE last_match = "palmeiras 4-2 portuguesa"
SELECT "team" FROM "table_name_47" WHERE "last_match" = "palmeiras 4-2 portuguesa"
0.080078
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE 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)
Give the number of patients that survived and had a procedure icd9 code of 3995.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.icd9_code = "3995"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "3995" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "0" = "demographic"."expire_flag"
0.210938
CREATE TABLE table_23212 ("Institution" CLOB, "Location" CLOB, "Nickname" CLOB, "Founded" FLOAT, "Type" CLOB, "Enrollment" FLOAT, "Joined" FLOAT)
What's the nickname of the students of the school founded in 1933?
SELECT "Nickname" FROM table_23212 WHERE "Founded" = '1933'
SELECT "Nickname" FROM "table_23212" WHERE "Founded" = '1933'
0.05957
CREATE TABLE Rating (rID VARCHAR2, stars NUMBER) CREATE TABLE Reviewer (name VARCHAR2, rID VARCHAR2)
Find the names of reviewers who had given higher than 3 star ratings.
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3
SELECT "T2"."name" FROM "Rating" "T1" JOIN "Reviewer" "T2" ON "T1"."rID" = "T2"."rID" WHERE "T1"."stars" > 3
0.105469
CREATE TABLE table_name_21 (career_sr VARCHAR2)
What is 1999, when 2003 is 'A', and when Career SR is '0 / 4'?
SELECT 1999 FROM table_name_21 WHERE 2003 = "a" AND career_sr = "0 / 4"
SELECT 1999 FROM "table_name_21" WHERE "0 / 4" = "career_sr" AND "a" = 2003
0.073242
CREATE TABLE table_204_987 (id NUMBER, "city/municipality" CLOB, "no. of\ barangays" NUMBER, "area\ ( km2 ) " NUMBER, "population\ ( 2010 census ) " NUMBER, "pop. density\ ( per km2 ) " NUMBER)
how many barangays does the city of angono have ?
SELECT "no. of\nbarangays" FROM table_204_987 WHERE "city/municipality" = 'angono'
SELECT "no. of\nbarangays" FROM "table_204_987" WHERE "city/municipality" = 'angono'
0.082031
CREATE TABLE table_name_91 (year NUMBER, score VARCHAR2)
What is the most recent year in which the score was 4 6, 6 3, 7 5?
SELECT MAX(year) FROM table_name_91 WHERE score = "4–6, 6–3, 7–5"
SELECT MAX("year") FROM "table_name_91" WHERE "4–6, 6–3, 7–5" = "score"
0.069336
CREATE TABLE shop (shop_id NUMBER, address CLOB, num_of_staff CLOB, score NUMBER, open_year CLOB) CREATE TABLE happy_hour (hh_id NUMBER, shop_id NUMBER, month CLOB, num_of_shaff_in_charge NUMBER) CREATE TABLE happy_hour_member (hh_id NUMBER, member_id NUMBER, total_amount NUMBER) CREATE TABLE member (member_id NUMBER, name CLOB, membership_card CLOB, age NUMBER, time_of_purchase NUMBER, level_of_membership NUMBER, address CLOB)
How many members are not living in Hartford?
SELECT COUNT(*) FROM member WHERE address <> 'Hartford'
SELECT COUNT(*) FROM "member" WHERE "address" <> 'Hartford'
0.057617
CREATE TABLE table_48826 ("Round" FLOAT, "Pick" FLOAT, "Overall" FLOAT, "Name" CLOB, "Position" CLOB, "College" CLOB)
What name has 5 as the pick, a round less than 25, ot as the position, at boston college?
SELECT "Name" FROM table_48826 WHERE "Pick" = '5' AND "Round" < '25' AND "Position" = 'ot' AND "College" = 'boston college'
SELECT "Name" FROM "table_48826" WHERE "College" = 'boston college' AND "Pick" = '5' AND "Position" = 'ot' AND "Round" < '25'
0.12207
CREATE TABLE table_name_69 (acceleration_0_100km_h__0_62mph_ VARCHAR2, transmission VARCHAR2)
What is the acceleration 0 100km/h (0 62mph) when the transmission is 5-speed manual?
SELECT acceleration_0_100km_h__0_62mph_ FROM table_name_69 WHERE transmission = "5-speed manual"
SELECT "acceleration_0_100km_h__0_62mph_" FROM "table_name_69" WHERE "5-speed manual" = "transmission"
0.099609
CREATE TABLE table_203_341 (id NUMBER, "season" CLOB, "champion" CLOB, "runner-up" CLOB, "score" CLOB, "third place" CLOB)
who has a larger amount of championships as a plk medalist ?
SELECT "champion" FROM table_203_341 GROUP BY "champion" ORDER BY COUNT("champion") DESC LIMIT 1
SELECT "champion" FROM "table_203_341" GROUP BY "champion" ORDER BY COUNT("champion") DESC FETCH FIRST 1 ROWS ONLY
0.111328
CREATE TABLE table_44672 ("Date" CLOB, "Time" CLOB, "Home" CLOB, "Geust" CLOB, "Result" CLOB)
What is Home, when Time is 18:00, and when Geust is Servette FC (CHL)?
SELECT "Home" FROM table_44672 WHERE "Time" = '18:00' AND "Geust" = 'servette fc (chl)'
SELECT "Home" FROM "table_44672" WHERE "Geust" = 'servette fc (chl)' AND "Time" = '18:00'
0.086914
CREATE TABLE table_5007 ("Designation" CLOB, "Type" CLOB, "Length overall" CLOB, "Launch weight" CLOB, "Warhead weight" CLOB, "Range" CLOB)
What is the overall length with a designation of s-8ko?
SELECT "Length overall" FROM table_5007 WHERE "Designation" = 's-8ko'
SELECT "Length overall" FROM "table_5007" WHERE "Designation" = 's-8ko'
0.069336
CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE d_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 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 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_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 d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) 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)
indicate the monthly minimum arterial bp mean of patient 26195 since 1199 days ago.
SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26195)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp mean' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime) >= DATETIME(CURRENT_TIME(), '-1199 day') GROUP BY STRFTIME('%y-%m', chartevents.charttime)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 26195 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'arterial bp mean' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT MIN("chartevents"."valuenum") FROM "chartevents" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE DATETIME("chartevents"."charttime") >= DATETIME(CURRENT_TIME(), '-1199 day') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL GROUP BY STRFTIME('%y-%m', "chartevents"."charttime")
0.803711
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)
how many elective hospital admission patients have prescription for amiodarone?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND prescriptions.drug = "Amiodarone"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Amiodarone" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "ELECTIVE" = "demographic"."admission_type"
0.230469
CREATE TABLE table_31138 ("Year" FLOAT, "Network" CLOB, "Play-by-play announcer" CLOB, "Color commentator" CLOB, "s Field reporter" CLOB, "Pregame hosts" CLOB, "Pregame analysts" CLOB, "Trophy presentation" CLOB)
Who is every play-by-play announcer when Chris Rose is the trophy presenter?
SELECT "Play-by-play announcer" FROM table_31138 WHERE "Trophy presentation" = 'Chris Rose'
SELECT "Play-by-play announcer" FROM "table_31138" WHERE "Trophy presentation" = 'Chris Rose'
0.09082
CREATE TABLE pilot (Name VARCHAR2)
List all pilot names in ascending alphabetical order.
SELECT Name FROM pilot ORDER BY Name
SELECT "Name" FROM "pilot" ORDER BY "Name"
0.041016
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 cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE 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 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 medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME)
what is the five most commonly given procedure for patients of 30s in 2103?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND STRFTIME('%y', treatment.treatmenttime) = '2103' GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 5
WITH "_u_0" AS (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."age" <= 39 AND "patient"."age" >= 30 GROUP BY "patientunitstayid"), "t1" AS (SELECT "treatment"."treatmentname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "treatment" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "treatment"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y', "treatment"."treatmenttime") = '2103' GROUP BY "treatment"."treatmentname") SELECT "t1"."treatmentname" FROM "t1" "t1" WHERE "t1"."c1" <= 5
0.510742
CREATE TABLE table_test_18 ("id" NUMBER, "bleeding" NUMBER, "dialysis" BOOLEAN, "hct" NUMBER, "hepatic_disease" BOOLEAN, "anaemia" BOOLEAN, "creatinine_clearance_cl" FLOAT, "polycytaemia" BOOLEAN, "thrombocytopenia" FLOAT, "kidney_disease" BOOLEAN, "body_mass_index_bmi" FLOAT, "glycosylated_hemoglobin" FLOAT, "NOUSE" FLOAT)
patients with creatinine clearance < 50 ml / min,
SELECT * FROM table_test_18 WHERE creatinine_clearance_cl < 50
SELECT * FROM "table_test_18" WHERE "creatinine_clearance_cl" < 50
0.064453
CREATE TABLE table_74896 ("Team" CLOB, "Driver" CLOB, "Laps" FLOAT, "Time" CLOB, "Grid" FLOAT)
For what Team is Narain Karthikeyan the Driver?
SELECT "Team" FROM table_74896 WHERE "Driver" = 'narain karthikeyan'
SELECT "Team" FROM "table_74896" WHERE "Driver" = 'narain karthikeyan'
0.068359
CREATE TABLE table_name_24 (tries_against VARCHAR2, points_against VARCHAR2)
Having 429 points against, what is the Tries Against?
SELECT tries_against FROM table_name_24 WHERE points_against = "429"
SELECT "tries_against" FROM "table_name_24" WHERE "429" = "points_against"
0.072266
CREATE TABLE table_70955 ("Rank" FLOAT, "Player" CLOB, "From" CLOB, "Transfer fee ( \\u20ac million ) " FLOAT, "Year" FLOAT)
What was the rank of a transfer fee larger than 13 million, and after 2008?
SELECT COUNT("Rank") FROM table_70955 WHERE "Transfer fee ( \u20ac million)" > '13' AND "Year" > '2008'
SELECT COUNT("Rank") FROM "table_70955" WHERE "Transfer fee ( \u20ac million)" > '13' AND "Year" > '2008'
0.102539
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 ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE 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 Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskStates (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 PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER)
Custom Off Topic close reasons.
SELECT * FROM CloseAsOffTopicReasonTypes WHERE DeactivationDate IS NULL
SELECT * FROM "CloseAsOffTopicReasonTypes" WHERE "DeactivationDate" IS NULL
0.073242
CREATE TABLE table_8647 ("Frequency" CLOB, "Call sign" CLOB, "Branding" CLOB, "Format" CLOB, "Owner" CLOB)
What is the Format of the Frequency CJBX-FM?
SELECT "Format" FROM table_8647 WHERE "Call sign" = 'cjbx-fm'
SELECT "Format" FROM "table_8647" WHERE "Call sign" = 'cjbx-fm'
0.061523
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE 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)
find the maximum days of hospital stay for patients primarily diagnosed with stemi.
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "STEMI"
SELECT MAX("demographic"."days_stay") FROM "demographic" WHERE "STEMI" = "demographic"."diagnosis"
0.095703
CREATE TABLE table_name_74 (away_team VARCHAR2, home_team VARCHAR2)
During footscray's home game, how much did the away team score?
SELECT away_team AS score FROM table_name_74 WHERE home_team = "footscray"
SELECT "away_team" AS "score" FROM "table_name_74" WHERE "footscray" = "home_team"
0.080078
CREATE TABLE table_2597876_1 (position VARCHAR2, year VARCHAR2)
What position was Parsons in for 1992?
SELECT position FROM table_2597876_1 WHERE year = 1992
SELECT "position" FROM "table_2597876_1" WHERE "year" = 1992
0.058594
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) 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)
what is maximum days of hospital stay of patients whose admission year is greater than or equal to 2177?
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.admityear >= "2177"
SELECT MAX("demographic"."days_stay") FROM "demographic" WHERE "2177" <= "demographic"."admityear"
0.095703
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 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)
what is maximum age of patients whose days of hospital stay is 11 and year of death is less than 2158?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.days_stay = "11" AND demographic.dod_year < "2158.0"
SELECT MAX("demographic"."age") FROM "demographic" WHERE "11" = "demographic"."days_stay" AND "2158.0" > "demographic"."dod_year"
0.125977
CREATE TABLE classroom (building VARCHAR2, room_number VARCHAR2, capacity NUMBER) CREATE TABLE time_slot (time_slot_id VARCHAR2, day VARCHAR2, start_hr NUMBER, start_min NUMBER, end_hr NUMBER, end_min NUMBER) CREATE TABLE takes (ID VARCHAR2, course_id VARCHAR2, sec_id VARCHAR2, semester VARCHAR2, year NUMBER, grade VARCHAR2) CREATE TABLE section (course_id VARCHAR2, sec_id VARCHAR2, semester VARCHAR2, year NUMBER, building VARCHAR2, room_number VARCHAR2, time_slot_id VARCHAR2) CREATE TABLE department (dept_name VARCHAR2, building VARCHAR2, budget NUMBER) CREATE TABLE advisor (s_ID VARCHAR2, i_ID VARCHAR2) CREATE TABLE teaches (ID VARCHAR2, course_id VARCHAR2, sec_id VARCHAR2, semester VARCHAR2, year NUMBER) CREATE TABLE course (course_id VARCHAR2, title VARCHAR2, dept_name VARCHAR2, credits NUMBER) CREATE TABLE instructor (ID VARCHAR2, name VARCHAR2, dept_name VARCHAR2, salary NUMBER) CREATE TABLE student (ID VARCHAR2, name VARCHAR2, dept_name VARCHAR2, tot_cred NUMBER) CREATE TABLE prereq (course_id VARCHAR2, prereq_id VARCHAR2)
How many total credits are offered by each department Show bar chart, and rank bars in asc order.
SELECT dept_name, SUM(credits) FROM course GROUP BY dept_name ORDER BY dept_name
SELECT "dept_name", SUM("credits") FROM "course" GROUP BY "dept_name" ORDER BY "dept_name"
0.087891
CREATE TABLE table_203_644 (id NUMBER, "pos." NUMBER, "driver" CLOB, "co-driver" CLOB, "car" CLOB, "time" CLOB, "difference" CLOB, "points" NUMBER)
what were the number of drivers that finished with times under 7 minutes ?
SELECT COUNT("driver") FROM table_203_644 WHERE "time" < 7
SELECT COUNT("driver") FROM "table_203_644" WHERE "time" < 7
0.058594
CREATE TABLE Player (pID NUMBER, pName VARCHAR2, yCard VARCHAR2, HS NUMBER) CREATE TABLE College (cName VARCHAR2, state VARCHAR2, enr NUMBER) CREATE TABLE Tryout (pID NUMBER, cName VARCHAR2, pPos VARCHAR2, decision VARCHAR2)
Compare the smallest enrollment of schools in each state using a bar chart, and I want to display by the X-axis in asc.
SELECT cName, MIN(enr) FROM College GROUP BY state ORDER BY cName
SELECT "cName", MIN("enr") FROM "College" GROUP BY "state" ORDER BY "cName"
0.073242
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
what is the number of patients whose lab test staus is abnormal and have undergine the lab test for rbc, joint fluid?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "abnormal" AND lab.label = "RBC, Joint Fluid"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "RBC, Joint Fluid" = "lab"."label" AND "abnormal" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.188477
CREATE TABLE fires (fire_year NUMBER, discovery_date NUMBER, discovery_doy NUMBER, discovery_time CLOB, stat_cause_code NUMBER, stat_cause_descr CLOB, cont_date CLOB, cont_doy CLOB, cont_time CLOB, fire_size NUMBER, fire_size_class CLOB, latitude NUMBER, longitude NUMBER, owner_code NUMBER, owner_descr CLOB, state CLOB, county CLOB, fips_code CLOB, fips_name CLOB)
What was the most common cause of fire between 2000 and 2005?
SELECT stat_cause_descr FROM fires WHERE fire_year BETWEEN 2000 AND 2005 GROUP BY stat_cause_descr ORDER BY COUNT(*) DESC LIMIT 1
SELECT "stat_cause_descr" FROM "fires" WHERE "fire_year" <= 2005 AND "fire_year" >= 2000 GROUP BY "stat_cause_descr" ORDER BY COUNT(*) DESC FETCH FIRST 1 ROWS ONLY
0.15918
CREATE TABLE table_69874 ("Date" CLOB, "Opponent" CLOB, "Score" CLOB, "Loss" CLOB, "Record" CLOB)
What team lost on May 1?
SELECT "Loss" FROM table_69874 WHERE "Date" = 'may 1'
SELECT "Loss" FROM "table_69874" WHERE "Date" = 'may 1'
0.053711
CREATE TABLE table_78086 ("Swedish title" CLOB, "Norwegian title" CLOB, "Translated title" CLOB, "Published" FLOAT, "Pages" FLOAT, "ISBN" CLOB)
How many pages associated with isbn 91-7713-035-9?
SELECT SUM("Pages") FROM table_78086 WHERE "ISBN" = 'isbn 91-7713-035-9'
SELECT SUM("Pages") FROM "table_78086" WHERE "ISBN" = 'isbn 91-7713-035-9'
0.072266
CREATE TABLE table_159614_2 (harris VARCHAR2, party VARCHAR2)
What is the percentage of the Labour Party on the Harris Poll
SELECT harris FROM table_159614_2 WHERE party = "Labour"
SELECT "harris" FROM "table_159614_2" WHERE "Labour" = "party"
0.060547
CREATE TABLE table_36933 ("Matches" FLOAT, "Innings" FLOAT, "Not out" FLOAT, "Runs" FLOAT, "High Score" FLOAT, "Average" FLOAT)
How many runs were there when there was 1 match and les than 86 average?
SELECT SUM("Runs") FROM table_36933 WHERE "Matches" = '1' AND "Average" < '86'
SELECT SUM("Runs") FROM "table_36933" WHERE "Average" < '86' AND "Matches" = '1'
0.078125
CREATE TABLE election (Election_ID NUMBER, Counties_Represented CLOB, District NUMBER, Delegate CLOB, Party NUMBER, First_Elected FLOAT, Committee CLOB) CREATE TABLE county (County_Id NUMBER, County_name CLOB, Population FLOAT, Zip_code CLOB) CREATE TABLE party (Party_ID NUMBER, Year FLOAT, Party CLOB, Governor CLOB, Lieutenant_Governor CLOB, Comptroller CLOB, Attorney_General CLOB, US_Senate CLOB)
For each county, find the name of the county and the number of delegates from that county Show bar chart, and could you order in desc by the x axis?
SELECT County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District GROUP BY T1.County_Id ORDER BY County_name DESC
SELECT "County_name", COUNT(*) FROM "county" "T1" JOIN "election" "T2" ON "T1"."County_Id" = "T2"."District" GROUP BY "T1"."County_Id" ORDER BY "County_name" DESC
0.158203
CREATE TABLE customer_contact_channels (customer_id NUMBER, channel_code CLOB, active_from_date TIME, active_to_date TIME, contact_number CLOB) CREATE TABLE customer_addresses (customer_id NUMBER, address_id NUMBER, date_address_from TIME, address_type CLOB, date_address_to TIME) CREATE TABLE customer_orders (order_id NUMBER, customer_id NUMBER, order_status CLOB, order_date TIME, order_details CLOB) CREATE TABLE products (product_id NUMBER, product_details CLOB) CREATE TABLE addresses (address_id NUMBER, address_content CLOB, city CLOB, zip_postcode CLOB, state_province_county CLOB, country CLOB, other_address_details CLOB) CREATE TABLE order_items (order_id NUMBER, product_id NUMBER, order_quantity CLOB) CREATE TABLE customers (customer_id NUMBER, payment_method CLOB, customer_name CLOB, date_became_customer TIME, other_customer_details CLOB)
Find the names of customers who ordered both products Latte and Americano.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Americano'
SELECT "t1"."customer_name" FROM "customers" "t1" JOIN "customer_orders" "t2" ON "t1"."customer_id" = "t2"."customer_id" JOIN "order_items" "t3" ON "t2"."order_id" = "t3"."order_id" JOIN "products" "t4" ON "t3"."product_id" = "t4"."product_id" AND "t4"."product_details" = 'Latte' INTERSECT SELECT "t1"."customer_name" FROM "customers" "t1" JOIN "customer_orders" "t2" ON "t1"."customer_id" = "t2"."customer_id" JOIN "order_items" "t3" ON "t2"."order_id" = "t3"."order_id" JOIN "products" "t4" ON "t3"."product_id" = "t4"."product_id" AND "t4"."product_details" = 'Americano'
0.561523
CREATE TABLE table_33971 ("Season" FLOAT, "Team" CLOB, "Wins" FLOAT, "Losses" FLOAT, "Draws" FLOAT)
Which Draws have Losses smaller than 16, and a Team of university, and Wins larger than 0?
SELECT AVG("Draws") FROM table_33971 WHERE "Losses" < '16' AND "Team" = 'university' AND "Wins" > '0'
SELECT AVG("Draws") FROM "table_33971" WHERE "Losses" < '16' AND "Team" = 'university' AND "Wins" > '0'
0.100586
CREATE TABLE table_name_80 (goals NUMBER, name VARCHAR2)
How many goals did coe get?
SELECT MIN(goals) FROM table_name_80 WHERE name = "coe"
SELECT MIN("goals") FROM "table_name_80" WHERE "coe" = "name"
0.05957
CREATE TABLE Museums (Museum_ID NUMBER, Museum_Details VARCHAR2) CREATE TABLE Theme_Parks (Theme_Park_ID NUMBER, Theme_Park_Details VARCHAR2) CREATE TABLE Tourist_Attractions (Tourist_Attraction_ID NUMBER, Attraction_Type_Code CHAR, Location_ID NUMBER, How_to_Get_There VARCHAR2, Name VARCHAR2, Description VARCHAR2, Opening_Hours VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Photos (Photo_ID NUMBER, Tourist_Attraction_ID NUMBER, Name VARCHAR2, Description VARCHAR2, Filename VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Shops (Shop_ID NUMBER, Shop_Details VARCHAR2) CREATE TABLE Visits (Visit_ID NUMBER, Tourist_Attraction_ID NUMBER, Tourist_ID NUMBER, Visit_Date DATETIME, Visit_Details VARCHAR2) CREATE TABLE Ref_Hotel_Star_Ratings (star_rating_code CHAR, star_rating_description VARCHAR2) CREATE TABLE Staff (Staff_ID NUMBER, Tourist_Attraction_ID NUMBER, Name VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Ref_Attraction_Types (Attraction_Type_Code CHAR, Attraction_Type_Description VARCHAR2) CREATE TABLE Locations (Location_ID NUMBER, Location_Name VARCHAR2, Address VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Visitors (Tourist_ID NUMBER, Tourist_Details VARCHAR2) CREATE TABLE Hotels (hotel_id NUMBER, star_rating_code CHAR, pets_allowed_yn CHAR, price_range FLOAT, other_hotel_details VARCHAR2) CREATE TABLE Street_Markets (Market_ID NUMBER, Market_Details VARCHAR2) CREATE TABLE Features (Feature_ID NUMBER, Feature_Details VARCHAR2) CREATE TABLE Tourist_Attraction_Features (Tourist_Attraction_ID NUMBER, Feature_ID NUMBER) CREATE TABLE Royal_Family (Royal_Family_ID NUMBER, Royal_Family_Details VARCHAR2)
Find the id and star rating of each hotel and sort them in increasing order of price. Show scatter chart.
SELECT hotel_id, star_rating_code FROM Hotels ORDER BY price_range
SELECT "hotel_id", "star_rating_code" FROM "Hotels" ORDER BY "price_range"
0.072266
CREATE TABLE table_name_77 (sponsor_s_ VARCHAR2, date_introduced VARCHAR2)
Who sponsored the bill introduced on June 9, 2011?
SELECT sponsor_s_ FROM table_name_77 WHERE date_introduced = "june 9, 2011"
SELECT "sponsor_s_" FROM "table_name_77" WHERE "date_introduced" = "june 9, 2011"
0.079102
CREATE TABLE table_204_344 (id NUMBER, "player" CLOB, "games played" NUMBER, "field goals" NUMBER, "free throws" NUMBER, "points" NUMBER)
after george halas , which two players are tied for lowest number of points ?
SELECT "player" FROM table_204_344 WHERE "points" < (SELECT "points" FROM table_204_344 WHERE "player" = 'george halas')
SELECT "player" FROM "table_204_344" WHERE "points" < (SELECT "points" FROM "table_204_344" WHERE "player" = 'george halas')
0.121094
CREATE TABLE table_23537 ("Year" CLOB, "Winner" CLOB, "First Runner Up" CLOB, "Third Place" CLOB, "Consolation Winner/4th" CLOB, "Finals Location" CLOB)
Who was the first runner up in the year when Mesa Mesa AZ was the consolation winner?
SELECT "First Runner Up" FROM table_23537 WHERE "Consolation Winner/4th" = 'Mesa Mesa AZ'
SELECT "First Runner Up" FROM "table_23537" WHERE "Consolation Winner/4th" = 'Mesa Mesa AZ'
0.088867
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 intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE 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 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 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)
among the patients diagnosed with hypercalcemia - moderate, calculate the two year survival probability.
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hypercalcemia - moderate' GROUP BY patient.uniquepid HAVING MIN(diagnosis.diagnosistime) = diagnosis.diagnosistime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.diagnosistime) > 2 * 365) AS t2 JOIN patient ON t2.uniquepid = patient.uniquepid
WITH "t1" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 'hypercalcemia - moderate' GROUP BY "patient"."uniquepid" HAVING "diagnosis"."diagnosistime" = MIN("diagnosis"."diagnosistime")) SELECT SUM(CASE WHEN "patient"."hospitaldischargestatus" = 'alive' THEN 1 WHEN STRFTIME('%j', "patient"."hospitaldischargetime") - STRFTIME('%j', "t1"."diagnosistime") > 730 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) FROM "t1" "t1" JOIN "patient" ON "patient"."uniquepid" = "t1"."uniquepid" WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "t1"."diagnosistime") > 730
0.695313
CREATE TABLE table_73199 ("No." FLOAT, "Title" CLOB, "Directed by" CLOB, "Written by" CLOB, "Original air date" CLOB, "Production code" FLOAT, "Television order" CLOB)
who directed s01e13
SELECT "Directed by" FROM table_73199 WHERE "Television order" = 'S01E13'
SELECT "Directed by" FROM "table_73199" WHERE "Television order" = 'S01E13'
0.073242
CREATE TABLE table_57463 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
Which home team has a home score of 11.14 (80)?
SELECT "Home team" FROM table_57463 WHERE "Home team score" = '11.14 (80)'
SELECT "Home team" FROM "table_57463" WHERE "Home team score" = '11.14 (80)'
0.074219
CREATE TABLE table_204_647 (id NUMBER, "year" NUMBER, "film" CLOB, "role" CLOB, "language" CLOB)
what was the actor 's first film ?
SELECT "film" FROM table_204_647 ORDER BY "year" LIMIT 1
SELECT "film" FROM "table_204_647" ORDER BY "year" FETCH FIRST 1 ROWS ONLY
0.072266
CREATE TABLE table_name_3 (march VARCHAR2, november VARCHAR2)
Who is the March playmate with a November playmate Cara Wakelin?
SELECT march FROM table_name_3 WHERE november = "cara wakelin"
SELECT "march" FROM "table_name_3" WHERE "cara wakelin" = "november"
0.066406
CREATE TABLE table_name_53 (goals NUMBER, venue VARCHAR2)
What is the average number of goals that occurred in Hong Kong Stadium, Hong Kong?
SELECT AVG(goals) FROM table_name_53 WHERE venue = "hong kong stadium, hong kong"
SELECT AVG("goals") FROM "table_name_53" WHERE "hong kong stadium, hong kong" = "venue"
0.084961
CREATE TABLE table_name_85 (home_team VARCHAR2, game VARCHAR2)
Which Home team has a Game of game 5?
SELECT home_team FROM table_name_85 WHERE game = "game 5"
SELECT "home_team" FROM "table_name_85" WHERE "game 5" = "game"
0.061523
CREATE TABLE table_25221 ("Rnd" FLOAT, "Date" CLOB, "Race Name" CLOB, "Length" CLOB, "Track" CLOB, "Location" CLOB, "Pole Position" CLOB, "Winning Driver" CLOB)
Name the race name for rnd being 11
SELECT "Race Name" FROM table_25221 WHERE "Rnd" = '11'
SELECT "Race Name" FROM "table_25221" WHERE "Rnd" = '11'
0.054688
CREATE TABLE table_name_35 (hdr_output___exr_ VARCHAR2, _hdr VARCHAR2, _logluv_ VARCHAR2, _etc_ VARCHAR2, name VARCHAR2)
What's the HDR output of Photovista Panorama?
SELECT hdr_output___exr_, _hdr, _logluv_, _etc_ FROM table_name_35 WHERE name = "photovista panorama"
SELECT "hdr_output___exr_", "_hdr", "_logluv_", "_etc_" FROM "table_name_35" WHERE "name" = "photovista panorama"
0.110352
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 offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) 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 ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req 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 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 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 area (course_id NUMBER, area VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER)
What prerequisite courses fall before MCDB 415 ?
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT_RECORDalias0.student_id = 1) AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'MCDB' AND COURSE_1.number = 415
WITH "_u_0" AS (SELECT "STUDENT_RECORDalias0"."course_id" FROM "student_record" "STUDENT_RECORDalias0" WHERE "STUDENT_RECORDalias0"."student_id" = 1 GROUP BY "course_id") SELECT DISTINCT "COURSE_0"."department", "COURSE_0"."name", "COURSE_0"."number" FROM "course" "COURSE_0" LEFT JOIN "_u_0" "_u_0" ON "COURSE_0"."course_id" = "_u_0"."" JOIN "course_prerequisite" ON "COURSE_0"."course_id" = "course_prerequisite"."pre_course_id" JOIN "course" "COURSE_1" ON "COURSE_1"."course_id" = "course_prerequisite"."course_id" AND "COURSE_1"."department" = 'MCDB' AND "COURSE_1"."number" = 415 WHERE "_u_0"."" IS NULL
0.59375
CREATE TABLE table_29668 ("Week #" CLOB, "Theme" CLOB, "Song Choice" CLOB, "Original Artist" CLOB, "Order #" CLOB, "Result" CLOB)
Which song was picked that was originally performed by Marisa Monte?
SELECT "Song Choice" FROM table_29668 WHERE "Original Artist" = 'Marisa Monte'
SELECT "Song Choice" FROM "table_29668" WHERE "Original Artist" = 'Marisa Monte'
0.078125
CREATE TABLE table_204_530 (id NUMBER, "type" CLOB, "stage" NUMBER, "cyclist" CLOB, "team" CLOB, "reason" CLOB)
which cyclist withdrew after breaking his arm in a crash during stage 2 ?
SELECT "cyclist" FROM table_204_530 WHERE "reason" = 'broken arm sustained from crash in stage 2'
SELECT "cyclist" FROM "table_204_530" WHERE "reason" = 'broken arm sustained from crash in stage 2'
0.09668
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) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB)
count the number of patients whose ethnicity is white and procedure short title is remov biliary/liver tube?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "WHITE" AND procedures.short_title = "Remov biliary/liver tube"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Remov biliary/liver tube" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "WHITE" = "demographic"."ethnicity"
0.234375
CREATE TABLE table_21304 ("Match Number" FLOAT, "Date" CLOB, "Venue" CLOB, "Team 1" CLOB, "Team 2" CLOB, "Result" CLOB, "Man of the Match" CLOB)
Who is man of the match when Team 1 is ICL Pakistan?
SELECT "Man of the Match" FROM table_21304 WHERE "Team 1" = 'ICL Pakistan'
SELECT "Man of the Match" FROM "table_21304" WHERE "Team 1" = 'ICL Pakistan'
0.074219
CREATE TABLE table_2273 ("-Butadiene" CLOB, "10 4 k /min \\u22121 ( 30 \\u00b0C ) ( \\u00b1 1-2% ) absolute" CLOB, "10 4 k /min \\u22121 ( 30 \\u00b0C ) ( \\u00b1 1-2% ) relative" CLOB, "\\u0394H \\u2021 /kcal mol \\u22121" CLOB, "\\u0394S \\u2021 /cal mol \\u22121 K \\u22121" CLOB)
Name the 10 4 k /min 1 (30 c) ( 1-2%) absolute for 1.00
SELECT "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) absolute" FROM table_2273 WHERE "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) relative" = '1.00'
SELECT "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) absolute" FROM "table_2273" WHERE "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) relative" = '1.00'
0.151367
CREATE TABLE table_203_713 (id NUMBER, "s.no." NUMBER, "name of kingdom" CLOB, "name of king" CLOB, "no. of villages" NUMBER, "capital" CLOB, "names of districts" CLOB)
how many districts does punia have ?
SELECT "names of districts" FROM table_203_713 WHERE "name of kingdom" = 'punia'
SELECT "names of districts" FROM "table_203_713" WHERE "name of kingdom" = 'punia'
0.080078
CREATE TABLE table_name_19 (points NUMBER, position VARCHAR2, lost VARCHAR2)
What is the highest number of points for a position less than 3 and less than 1 loss?
SELECT MAX(points) FROM table_name_19 WHERE position < 3 AND lost < 1
SELECT MAX("points") FROM "table_name_19" WHERE "lost" < 1 AND "position" < 3
0.075195
CREATE TABLE table_2829 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
Who has the high assists when 50-26 is the record?
SELECT "High assists" FROM table_2829 WHERE "Record" = '50-26'
SELECT "High assists" FROM "table_2829" WHERE "Record" = '50-26'
0.0625
CREATE TABLE table_27225944_3 (replaced_by VARCHAR2, team VARCHAR2)
Name the replaced by for slaven belupo
SELECT replaced_by FROM table_27225944_3 WHERE team = "Slaven Belupo"
SELECT "replaced_by" FROM "table_27225944_3" WHERE "Slaven Belupo" = "team"
0.073242
CREATE TABLE table_4240 ("Train number" FLOAT, "Train name" CLOB, "Origin" CLOB, "Destination" CLOB, "Service" CLOB, "Route/Via." CLOB)
What is the route for the destination of guruvayur?
SELECT "Route/Via." FROM table_4240 WHERE "Destination" = 'Guruvayur'
SELECT "Route/Via." FROM "table_4240" WHERE "Destination" = 'Guruvayur'
0.069336
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_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 flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE days (days_code VARCHAR2, day_name 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 compartment_class (compartment VARCHAR2, class_type VARCHAR2) 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 month (month_number NUMBER, month_name CLOB) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt 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 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 equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE 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 date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2)
what flights from KANSAS CITY to DENVER after 845 in the morning
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.departure_time > 845 AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'KANSAS CITY' 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" = 'KANSAS CITY' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."departure_time" > 845 JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'DENVER'
0.520508
CREATE TABLE table_11959669_3 (high_rebounds VARCHAR2, date VARCHAR2)
Who had the highest rebounds on November 4
SELECT high_rebounds FROM table_11959669_3 WHERE date = "November 4"
SELECT "high_rebounds" FROM "table_11959669_3" WHERE "November 4" = "date"
0.072266
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE 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)
what type of drug is isosorbide dinitrate?
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Isosorbide Dinitrate"
SELECT "prescriptions"."drug_type" FROM "prescriptions" WHERE "Isosorbide Dinitrate" = "prescriptions"."drug"
0.106445
CREATE TABLE table_name_34 (year VARCHAR2, competition VARCHAR2, score VARCHAR2)
When did nswrfl has a score of 8-21?
SELECT year FROM table_name_34 WHERE competition = "nswrfl" AND score = "8-21"
SELECT "year" FROM "table_name_34" WHERE "8-21" = "score" AND "competition" = "nswrfl"
0.083984
CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description 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 flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code 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 code_description (code VARCHAR2, description CLOB) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE restriction (restriction_code CLOB, advance_purchase NUMBER, stopovers CLOB, saturday_stay_required CLOB, minimum_stay NUMBER, maximum_stay NUMBER, application CLOB, no_discounts CLOB) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt 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 month (month_number NUMBER, month_name CLOB) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB)
information on flights from PHILADELPHIA to SAN FRANCISCO
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" "AIRPORT_SERVICE_0" JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PHILADELPHIA' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SAN FRANCISCO'
0.493164
CREATE TABLE table_56835 ("Name" CLOB, "COSPAR ID SATCAT \\u2116" CLOB, "Launch date ( UTC ) " CLOB, "Launch vehicle" CLOB, "Launch site" CLOB, "Launch designation" CLOB, "Longitude" CLOB)
What is the COSPAR ID of the satellite with a titan iv(401)a launch vehicle?
SELECT "COSPAR ID SATCAT \u2116" FROM table_56835 WHERE "Launch vehicle" = 'titan iv(401)a'
SELECT "COSPAR ID SATCAT \u2116" FROM "table_56835" WHERE "Launch vehicle" = 'titan iv(401)a'
0.09082
CREATE TABLE table_70213 ("Grand Prix" CLOB, "Pole position" CLOB, "Fastest lap" CLOB, "Winning driver" CLOB, "Winning constructor" CLOB, "Report" CLOB)
Name the pole position at the german grand prix
SELECT "Pole position" FROM table_70213 WHERE "Grand Prix" = 'german grand prix'
SELECT "Pole position" FROM "table_70213" WHERE "Grand Prix" = 'german grand prix'
0.080078
CREATE TABLE table_28068063_3 (eliminated_from_competition VARCHAR2, proceed_to_quarter_final VARCHAR2)
Who was eliminated from the competition when connacht to the quarter final?
SELECT eliminated_from_competition FROM table_28068063_3 WHERE proceed_to_quarter_final = "Connacht"
SELECT "eliminated_from_competition" FROM "table_28068063_3" WHERE "Connacht" = "proceed_to_quarter_final"
0.103516
CREATE TABLE table_71366 ("Date" CLOB, "Home captain" CLOB, "Away captain" CLOB, "Venue" CLOB, "Result" CLOB)
Name the result for venue of lord's
SELECT "Result" FROM table_71366 WHERE "Venue" = 'lord''s'
SELECT "Result" FROM "table_71366" WHERE "Venue" = 'lord''s'
0.058594
CREATE TABLE table_18877 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
Who scored the most points in the game where the Raptors became 13-49?
SELECT "High points" FROM table_18877 WHERE "Record" = '13-49'
SELECT "High points" FROM "table_18877" WHERE "Record" = '13-49'
0.0625
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 intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime 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 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 lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB)
count how many drugs are prescribed to patient 030-44598 in 12/this year.
SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-44598')) AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', medication.drugstarttime) = '12'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '030-44598' 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 "medication" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "medication"."patientunitstayid" WHERE DATETIME("medication"."drugstarttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_1"."" IS NULL AND STRFTIME('%m', "medication"."drugstarttime") = '12'
0.643555
CREATE TABLE table_28211103_1 (winner VARCHAR2, st_kilda_score VARCHAR2)
How many winners have st kilda score at 14.11.95?
SELECT COUNT(winner) FROM table_28211103_1 WHERE st_kilda_score = "14.11.95"
SELECT COUNT("winner") FROM "table_28211103_1" WHERE "14.11.95" = "st_kilda_score"
0.080078
CREATE TABLE table_30672 ("Couple" CLOB, "Style" CLOB, "Music" CLOB, "Trine Dehli Cleve" FLOAT, "Tor Fl\\u00f8ysvik" FLOAT, "Karianne Gulliksen" FLOAT, "Christer Tornell" FLOAT, "Total" FLOAT)
What is the total score received by the couple that danced to ' ymca ' village people?
SELECT MAX("Total") FROM table_30672 WHERE "Music" = ' YMCA "β€” Village People'
SELECT MAX("Total") FROM "table_30672" WHERE "Music" = ' YMCA "β€” Village People'
0.078125
CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom 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_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 cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) 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 diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME)
when was the first time that patient 54494 was prescribed with pregabalin during their last hospital encounter?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 54494 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.drug = 'pregabalin' ORDER BY prescriptions.startdate LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 54494 AND NOT "admissions"."dischtime" IS NULL GROUP BY "hadm_id" ORDER BY "admissions"."admittime" DESC FETCH FIRST 1 ROWS ONLY) SELECT "prescriptions"."startdate" FROM "prescriptions" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE "prescriptions"."drug" = 'pregabalin' AND NOT "_u_0"."" IS NULL ORDER BY "prescriptions"."startdate" FETCH FIRST 1 ROWS ONLY
0.467773
CREATE TABLE table_name_28 (_percentage_of_1_rep_max_last_set_ VARCHAR2, set_4 VARCHAR2)
How many % of 1 Rep Max(Last Set) has a Set 4 of 145lb x 5reps?
SELECT _percentage_of_1_rep_max_last_set_ FROM table_name_28 WHERE set_4 = "145lb x 5reps"
SELECT "_percentage_of_1_rep_max_last_set_" FROM "table_name_28" WHERE "145lb x 5reps" = "set_4"
0.09375
CREATE TABLE table_2841865_2 (years VARCHAR2, congress VARCHAR2)
What time span is listed under years for the 96th congres?
SELECT years FROM table_2841865_2 WHERE congress = "96th"
SELECT "years" FROM "table_2841865_2" WHERE "96th" = "congress"
0.061523
CREATE TABLE table_43963 ("Bank type" CLOB, "Number of branches" FLOAT, "On-site ATMs" FLOAT, "Off-site ATMs" FLOAT, "Total ATMs" FLOAT)
What is the minimum total ATMs with new private sector banks as the bank type, and the on-site ATMs are greater than 1883?
SELECT MIN("Total ATMs") FROM table_43963 WHERE "Bank type" = 'new private sector banks' AND "On-site ATMs" > '1883'
SELECT MIN("Total ATMs") FROM "table_43963" WHERE "Bank type" = 'new private sector banks' AND "On-site ATMs" > '1883'
0.115234
CREATE TABLE table_23927423_4 (teams NUMBER, relegated_to_league VARCHAR2)
How many teams participated (maximum) when Cornish All Blacks Pertemps Bees were relegated to the league?
SELECT MAX(teams) FROM table_23927423_4 WHERE relegated_to_league = "Cornish All Blacks Pertemps Bees"
SELECT MAX("teams") FROM "table_23927423_4" WHERE "Cornish All Blacks Pertemps Bees" = "relegated_to_league"
0.105469
CREATE TABLE table_name_38 (home VARCHAR2, attendance VARCHAR2)
What home team has an n/a attendance?
SELECT home FROM table_name_38 WHERE attendance = "n/a"
SELECT "home" FROM "table_name_38" WHERE "attendance" = "n/a"
0.05957
CREATE TABLE table_42334 ("State / Territory" CLOB, "Building" CLOB, "Height" CLOB, "Floor count" FLOAT, "Completed" FLOAT)
What height has a floor count less than 25?
SELECT "Height" FROM table_42334 WHERE "Floor count" < '25'
SELECT "Height" FROM "table_42334" WHERE "Floor count" < '25'
0.05957
CREATE TABLE table_203_69 (id NUMBER, "representative" CLOB, "title" CLOB, "from" NUMBER, "to" NUMBER, "appointed by" CLOB)
how many years has does this table cover ?
SELECT MAX("to") - MIN("from") FROM table_203_69
SELECT MAX("to") - MIN("from") FROM "table_203_69"
0.048828
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 lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime 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 vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME)
what are the four most frequent drugs that were prescribed to the leukocytosis female patients 40s within 2 months after having been diagnosed with leukocytosis last year?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'leukocytosis' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.gender = 'female' AND patient.age BETWEEN 40 AND 49 AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t2.drugstarttime) BETWEEN DATETIME(t1.diagnosistime) AND DATETIME(t1.diagnosistime, '+2 month') GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 4
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."age" <= 49 AND "patient"."age" >= 40 AND "patient"."gender" = 'female' WHERE DATETIME("medication"."drugstarttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')), "t3" AS (SELECT "t2"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" "t2" ON "diagnosis"."diagnosistime" < "t2"."drugstarttime" AND "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("diagnosis"."diagnosistime") <= DATETIME("t2"."drugstarttime") AND DATETIME("diagnosis"."diagnosistime", '+2 month') >= DATETIME("t2"."drugstarttime") WHERE "diagnosis"."diagnosisname" = 'leukocytosis' AND DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY "t2"."drugname") SELECT "t3"."drugname" FROM "t3" "t3" WHERE "t3"."c1" <= 4
1.087891
CREATE TABLE table_1071 ("Week" FLOAT, "Date" CLOB, "Opponent" CLOB, "Location" CLOB, "Time ( ET ) " CLOB, "TV" CLOB, "Result" CLOB, "Record" CLOB)
Who was the opposing team played at Riverfront Stadium?
SELECT "Opponent" FROM table_1071 WHERE "Location" = 'Riverfront Stadium'
SELECT "Opponent" FROM "table_1071" WHERE "Location" = 'Riverfront Stadium'
0.073242
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE 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 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)
tell me the number of hispanic/latino-puerto rican patients who are less than 67 years of age.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND demographic.age < "67"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "67" > "demographic"."age" AND "HISPANIC/LATINO - PUERTO RICAN" = "demographic"."ethnicity"
0.162109