answer
stringlengths
6
3.91k
question
stringlengths
7
766
context
stringlengths
27
7.14k
SELECT COUNT(directed_by) FROM table_23097214_1 WHERE season__number = 3
How many directors directed episode 3 of the season?
CREATE TABLE table_23097214_1 (directed_by VARCHAR, season__number VARCHAR)
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 = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.departure_time BETWEEN 1800 AND 2200
show me the evening flights from BALTIMORE to ATLANTA
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar )
SELECT player FROM table_23346303_5 WHERE field_goals = 26
If the field goals is 26, what are the players names?
CREATE TABLE table_23346303_5 (player VARCHAR, field_goals VARCHAR)
SELECT written_by FROM table_23097214_1 WHERE directed_by = "Ken Whittingham"
Who wrote the episode directed by Ken Whittingham?
CREATE TABLE table_23097214_1 (written_by VARCHAR, directed_by VARCHAR)
SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'oliguria - suspect atn' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-4 year'))
since 4 years ago who is diagnosed with oliguria - suspect atn?
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) 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 text, allergyname text, allergytime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
SELECT MIN(steals) FROM table_23346303_5 WHERE player = "Jasmine Wynne"
If the player is Jasmine Wynne, what is the minimum number of steals?
CREATE TABLE table_23346303_5 (steals INTEGER, player VARCHAR)
SELECT MIN(production_code) FROM table_23097214_1 WHERE series__number = 153
What is the production code for Episode 153 in the series?
CREATE TABLE table_23097214_1 (production_code INTEGER, series__number VARCHAR)
SELECT MAX("Gold") FROM table_47068 WHERE "Bronze" > '3' AND "Total" < '24'
Can you tell me the highest Gold that has the Bronze larger than 3, and the Total smaller than 24?
CREATE TABLE table_47068 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
SELECT COUNT(blocks) FROM table_23346303_5 WHERE points = 4
What is the blocks total number if the points is 4?
CREATE TABLE table_23346303_5 (blocks VARCHAR, points VARCHAR)
SELECT title FROM table_23114705_3 WHERE no_in_season = 13
What is the name of the episode where the season number is 13?
CREATE TABLE table_23114705_3 (title VARCHAR, no_in_season VARCHAR)
SELECT tues_25_aug FROM table_23465864_6 WHERE mon_24_aug = "22' 24.56 101.021mph"
What was the Tues 25 Aug time and speed when Mon 24 Aug was 22' 24.56 101.021mph?
CREATE TABLE table_23465864_6 ( tues_25_aug VARCHAR, mon_24_aug VARCHAR )
SELECT steals FROM table_23346303_4 WHERE player = "Jasmine Wynne"
How many steals did jasmine wynne have?
CREATE TABLE table_23346303_4 (steals VARCHAR, player VARCHAR)
SELECT original_air_date FROM table_23114705_3 WHERE written_by = "Tim Balme"
If the episode was written by Tim Balme, what was the original air date?
CREATE TABLE table_23114705_3 (original_air_date VARCHAR, written_by VARCHAR)
SELECT branding FROM table_19874169_3 WHERE callsign = "DXYR"
If the call sign is DXYR, what is the branding?
CREATE TABLE table_19874169_3 ( branding VARCHAR, callsign VARCHAR )
SELECT MAX(games_played) FROM table_23346303_4 WHERE player = "Janae Stokes"
How many games did janae stokes play?
CREATE TABLE table_23346303_4 (games_played INTEGER, player VARCHAR)
SELECT airdate FROM table_23122988_1 WHERE headliner = "Rhod Gilbert"
What date did the show air when Rhod Gilbert was the headliner?
CREATE TABLE table_23122988_1 (airdate VARCHAR, headliner VARCHAR)
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "61" AND prescriptions.route = "INHALATION"
how many patients are under 61 years of age and use the drug route inhalation?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
SELECT COUNT(rebounds) FROM table_23346303_4 WHERE player = "Crystal Ayers"
How many rebounds did crystal ayers have?
CREATE TABLE table_23346303_4 (rebounds VARCHAR, player VARCHAR)
SELECT airdate FROM table_23122988_1 WHERE headliner = "Sean Lock"
What date did the show air when Sean Lock was the headliner?
CREATE TABLE table_23122988_1 (airdate VARCHAR, headliner VARCHAR)
SELECT "years served" FROM table_203_800 WHERE "president" = 'ulysses grant'
how many years did ulysses grant serve ?
CREATE TABLE table_203_800 ( id number, "#" number, "president" text, "president's party" text, "senate with" number, "senate opposed" number, "house with" number, "house opposed" number, "years served" number, "elections won" number )
SELECT record FROM table_23346983_1 WHERE game = 3
What was the Orangemen record during game 3?
CREATE TABLE table_23346983_1 (record VARCHAR, game VARCHAR)
SELECT comedians FROM table_23122988_1 WHERE episode = "1x03"
Who were the comedians on episode 1x03?
CREATE TABLE table_23122988_1 (comedians VARCHAR, episode VARCHAR)
SELECT "Maximum Ceiling Temperature" FROM table_1239 WHERE "Temperature Classification" = 'Intermediate'
Name the most ceiling temperature for intermediate
CREATE TABLE table_1239 ( "Maximum Ceiling Temperature" text, "Temperature Rating" text, "Temperature Classification" text, "Color Code (with Fusible Link)" text, "Glass Bulb Color" text )
SELECT record FROM table_23346983_1 WHERE opponent = "Army"
What was the record for the Orangemen when they played against Army?
CREATE TABLE table_23346983_1 (record VARCHAR, opponent VARCHAR)
SELECT episode FROM table_23122988_1 WHERE location = "Belfast Waterfront Hall"
What episode took place in Belfast Waterfront Hall?
CREATE TABLE table_23122988_1 (episode VARCHAR, location VARCHAR)
SELECT "Crowd" FROM table_47719 WHERE "Home team" = 'st kilda'
Which Crowd has a Home team of st kilda?
CREATE TABLE table_47719 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Ground" text, "Crowd" real, "Date" text )
SELECT MAX(orangemen_points) FROM table_23346983_1 WHERE game = 1
How many points did the Orangemen score in game 1?
CREATE TABLE table_23346983_1 (orangemen_points INTEGER, game VARCHAR)
SELECT comedians FROM table_23122988_1 WHERE location = "Birmingham Hippodrome"
Who were the comedians during the episode located in Birmingham Hippodrome?
CREATE TABLE table_23122988_1 (comedians VARCHAR, location VARCHAR)
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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, flight AS FLIGHTalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'DENVER' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'PITTSBURGH' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code)
what 's the earliest flight leaving DENVER for PITTSBURGH
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
SELECT opponent FROM table_23346983_1 WHERE record = "5-1"
Who did the Orangemen play against when their record was 5-1?
CREATE TABLE table_23346983_1 (opponent VARCHAR, record VARCHAR)
SELECT COUNT(director) FROM table_23141790_1 WHERE original_title = "Vesničko má středisková"
Name the total number of director for vesničko má středisková
CREATE TABLE table_23141790_1 (director VARCHAR, original_title VARCHAR)
SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 77586 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 >= 2
what was the medication patient 77586 had been prescribed two or more times in the last hospital encounter?
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime 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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text )
SELECT location FROM table_23379776_6 WHERE year = 2007
Name the location for 2007
CREATE TABLE table_23379776_6 (location VARCHAR, year VARCHAR)
SELECT COUNT(growth_rate) FROM table_231623_3 WHERE density_per_kilometer = 1087
Name the growth rate for density of 1087
CREATE TABLE table_231623_3 (growth_rate VARCHAR, density_per_kilometer VARCHAR)
SELECT transfer_fee FROM table_name_79 WHERE ends = 2007
What was the transfer fee for the player with an ends of 2007?
CREATE TABLE table_name_79 ( transfer_fee VARCHAR, ends VARCHAR )
SELECT MIN(mir_hossein_mousavi) FROM table_23390604_1 WHERE mohsen_rezaee = 44809
Display the lowest score for candidate Mir-Hossein Mousavi when candidate Mohsen Rezaee scored 44809 votes
CREATE TABLE table_23390604_1 (mir_hossein_mousavi INTEGER, mohsen_rezaee VARCHAR)
SELECT MAX(sex_ratio) FROM table_231623_3 WHERE population = 4773138
Name the sex ratio lowest for population 4773138
CREATE TABLE table_231623_3 (sex_ratio INTEGER, population VARCHAR)
SELECT demographic.age, demographic.insurance FROM demographic WHERE demographic.name = "Hector Blair"
what is age and insurance of subject name hector blair?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
SELECT MAX(mohsen_rezaee) FROM table_23390604_1 WHERE mir_hossein_mousavi = 837858
What is the highest score for candidate Mohsen Rezaee when candidate mir-hossein mousavi scored 837858 votes?
CREATE TABLE table_23390604_1 (mohsen_rezaee INTEGER, mir_hossein_mousavi VARCHAR)
SELECT original_air_date FROM table_23177573_1 WHERE rank__week_ = 21
What is the original air date of the episode that had a week ranking of 21?
CREATE TABLE table_23177573_1 (original_air_date VARCHAR, rank__week_ VARCHAR)
SELECT MAX(no_in_season) FROM table_23117208_3 WHERE directed_by = "Constantine Makris"
which is the biggest number of episode in the season, when the director of the episode was Constantine Makris?
CREATE TABLE table_23117208_3 ( no_in_season INTEGER, directed_by VARCHAR )
SELECT total_votes FROM table_23390604_1 WHERE spoiled_ballots = 3072
List all the total scores for the election which had 3072 invalid votes
CREATE TABLE table_23390604_1 (total_votes VARCHAR, spoiled_ballots VARCHAR)
SELECT rank__week_ FROM table_23177573_1 WHERE written_by = "Russel Friend & Garrett Lerner"
What was the week ranking of the episode written by Russel Friend & Garrett Lerner?
CREATE TABLE table_23177573_1 (rank__week_ VARCHAR, written_by VARCHAR)
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'skelaxin' AND STRFTIME('%y', prescriptions.startdate) <= '2104') AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE STRFTIME('%y', prescriptions.startdate) <= '2104') AS t2 ON t1.subject_id = t2.subject_id WHERE DATETIME(t1.startdate) = DATETIME(t2.startdate) GROUP BY t2.drug) AS t3 WHERE t3.c1 <= 5
until 2104 what are the five most frequently ordered medications for patients who have also been prescribed skelaxin at the same time?
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) 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_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) 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 text, org_name text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, 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 text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
SELECT MAX(mir_hossein_mousavi) FROM table_23390604_1 WHERE province = "Azarbaijan, West"
What was the highest score of candidate mir-hossein mousavi in the location known as azarbaijan, west?
CREATE TABLE table_23390604_1 (mir_hossein_mousavi INTEGER, province VARCHAR)
SELECT rank__week_ FROM table_23177573_1 WHERE written_by = "Thomas L. Moran" AND directed_by = "Andrew Bernstein"
What was the week ranking of the episode written by Thomas L. Moran and directed by Andrew Bernstein?
CREATE TABLE table_23177573_1 (rank__week_ VARCHAR, written_by VARCHAR, directed_by VARCHAR)
SELECT MAX("Races") FROM table_1348
What is the highest value for race?
CREATE TABLE table_1348 ( "Season" real, "Series" text, "Team Name" text, "Races" real, "Podiums" real, "Poles" real, "Wins" real, "Points" real, "Final Placing" text )
SELECT mahmoud_ahmadinejad FROM table_23390604_1 WHERE mir_hossein_mousavi = 218481
List all the results for mahmoud ahmadinejad when candidate mir-hossein mousavi obtained 218481 votes.
CREATE TABLE table_23390604_1 (mahmoud_ahmadinejad VARCHAR, mir_hossein_mousavi VARCHAR)
SELECT position FROM table WHERE player = Chivu
Name the position for chivu
CREATE TABLE table (position VARCHAR, player VARCHAR, Chivu VARCHAR)
SELECT party FROM table_name_46 WHERE office = "majority floor leader"
Which Party has a Office of majority floor leader
CREATE TABLE table_name_46 ( party VARCHAR, office VARCHAR )
SELECT MAX(mir_hossein_mousavi) FROM table_23390604_1 WHERE spoiled_ballots = 5683
What was the highest number of votes for mir-hossein mousavi when the number of invalid votes is 5683
CREATE TABLE table_23390604_1 (mir_hossein_mousavi INTEGER, spoiled_ballots VARCHAR)
SELECT COUNT(r) FROM table WHERE coppa_italia > 1.0
Name the total number of r for coppa italia larger than 1.0
CREATE TABLE table (r VARCHAR, coppa_italia INTEGER)
SELECT "Hits" FROM table_80110 WHERE "Year" < '1883'
Name the hits for years before 1883
CREATE TABLE table_80110 ( "Hits" real, "Player" text, "Team" text, "Year" real, "Years Record Stood" text )
SELECT surface FROM table_23385853_1 WHERE round = 8
Name surface for 8 round
CREATE TABLE table_23385853_1 (surface VARCHAR, round VARCHAR)
SELECT oricon_albums_chart FROM table_23180638_1 WHERE debut_sales__copies_ > 339333.011497678
Which charts had debut sales of of more than 339333.011497678?
CREATE TABLE table_23180638_1 (oricon_albums_chart VARCHAR, debut_sales__copies_ INTEGER)
SELECT apt_number, room_count FROM Apartments ORDER BY apt_number
Give me a bar chart for room_count of each apt number, and order from low to high by the apt_number.
CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, available_yn BIT ) CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME ) CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) ) CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME )
SELECT rally_base FROM table_23385853_1 WHERE round = 5
Name the rally base for 5 round
CREATE TABLE table_23385853_1 (rally_base VARCHAR, round VARCHAR)
SELECT COUNT(peak_position) FROM table_23180638_1 WHERE oricon_albums_chart = "Weekly Charts"
How many peak positions were there on the weekly charts?
CREATE TABLE table_23180638_1 (peak_position VARCHAR, oricon_albums_chart VARCHAR)
SELECT MIN("Gold") FROM table_60858 WHERE "Total" = '7'
What is the smallest number of gold medals a country with 7 medals has?
CREATE TABLE table_60858 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
SELECT rally_base FROM table_23385853_1 WHERE rally_name = "Rallye de France Alsace"
Name the rally base for rallye de france alsace
CREATE TABLE table_23385853_1 (rally_base VARCHAR, rally_name VARCHAR)
SELECT peak_position FROM table_23180638_1 WHERE oricon_albums_chart = "Daily Charts"
How many peak positions were there on the daily charts?
CREATE TABLE table_23180638_1 (peak_position VARCHAR, oricon_albums_chart VARCHAR)
SELECT "Production code" FROM table_17387 WHERE "Title" = 'Dave Moves Out'
WHAT IS 'DAVE MOVES OUT' PRODUCTION CODE?
CREATE TABLE table_17387 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
SELECT MAX(pos) FROM table_23385853_19 WHERE points = 2
What is the lowest position for a driver with 2 points?
CREATE TABLE table_23385853_19 (pos INTEGER, points VARCHAR)
SELECT oricon_albums_chart FROM table_23180638_1 WHERE debut_sales__copies_ = 101976
Which charts had debut sales of 101976?
CREATE TABLE table_23180638_1 (oricon_albums_chart VARCHAR, debut_sales__copies_ VARCHAR)
SELECT "Built" FROM table_51104 WHERE "Number in class" < '10' AND "Owner" = 'downer rail'
What was built in a class with less than 10, and the Downer Rail owner?
CREATE TABLE table_51104 ( "Owner" text, "Class" text, "Number in class" real, "Road numbers" text, "Built" text )
SELECT driver FROM table_23385853_19 WHERE stage_wins = 65
What driver(s) had over 65 stag wins?
CREATE TABLE table_23385853_19 (driver VARCHAR, stage_wins VARCHAR)
SELECT score FROM table_23186738_10 WHERE team = "Milwaukee"
What was the score when playing Milwaukee?
CREATE TABLE table_23186738_10 (score VARCHAR, team VARCHAR)
SELECT "Catalog" FROM table_59824 WHERE "Label" = 'geffen records / universal music special markets'
What Catalog has a Label of geffen records / universal music special markets?
CREATE TABLE table_59824 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text )
SELECT COUNT(power_stage_wins) FROM table_23385853_20 WHERE wins = 10
What is the power stage wins total number if the wins is 10?
CREATE TABLE table_23385853_20 (power_stage_wins VARCHAR, wins VARCHAR)
SELECT high_rebounds FROM table_23186738_10 WHERE record = "27-54"
Who had the highest rebounds in the game where the record was 27-54?
CREATE TABLE table_23186738_10 (high_rebounds VARCHAR, record VARCHAR)
SELECT "Name" FROM table_66538 WHERE "Constituency number" = '214'
What is the name for the assembly segment with a constituency number of 214?
CREATE TABLE table_66538 ( "Constituency number" text, "Name" text, "Reserved for ( SC / ST /None)" text, "District" text, "Number of electorates (2009)" real )
SELECT MIN(pos) FROM table_23385853_20 WHERE finishes = 10
If finishes is 10, what is the POS minimum?
CREATE TABLE table_23385853_20 (pos INTEGER, finishes VARCHAR)
SELECT date FROM table_23184448_3 WHERE opponent = "Niagara"
When did the team play against Niagara?
CREATE TABLE table_23184448_3 (date VARCHAR, opponent VARCHAR)
SELECT "Winning score" FROM table_43395 WHERE "Margin of victory" = '2 strokes'
What was the winning score with a margin victory of 2 strokes?
CREATE TABLE table_43395 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
SELECT MAX(finishes) FROM table_23385853_20
What is the finishes maximum number?
CREATE TABLE table_23385853_20 (finishes INTEGER)
SELECT MIN(opp_points) FROM table_23184448_3 WHERE record = "6-2"
How many points did the opposing team get in the game with 6-2 record?
CREATE TABLE table_23184448_3 (opp_points INTEGER, record VARCHAR)
SELECT "Candidate" FROM table_47452 WHERE "Election" = '2008 (2)'
Who is the candidate in the 2008 (2) election?
CREATE TABLE table_47452 ( "Election" text, "Candidate" text, "Number of votes" text, "Share of votes" text, "Outcome of election" text )
SELECT branding FROM table_23394920_1 WHERE power_kw = "5kW" AND station_type = "Relay"
When relay is the station type and 5kw is the power kw what is the branding?
CREATE TABLE table_23394920_1 (branding VARCHAR, power_kw VARCHAR, station_type VARCHAR)
SELECT date FROM table_23184448_3 WHERE cyclones_points = 46
When did the Cyclones get 46 points?
CREATE TABLE table_23184448_3 (date VARCHAR, cyclones_points VARCHAR)
SELECT "Winning Driver" FROM table_16659 WHERE "Fastest Lap" = 'Michael Schumacher' AND "Pole Position" = 'Michael Schumacher'
Who was the winning driver when Michael Schumacher had the pole and the fastest lap?
CREATE TABLE table_16659 ( "Round" real, "Grand Prix" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Constructor" text, "Report" text )
SELECT power_kw FROM table_23394920_1 WHERE callsign = "DXRT-TV"
When dxrt-tv is the callsign what is the power kw?
CREATE TABLE table_23394920_1 (power_kw VARCHAR, callsign VARCHAR)
SELECT COUNT(date) FROM table_23184448_3 WHERE location = "Cedar Falls, Iowa"
On how many different dates did the team play a game in Cedar Falls, Iowa?
CREATE TABLE table_23184448_3 (date VARCHAR, location VARCHAR)
SELECT COUNT(engine) FROM table_15491596_1 WHERE no = 48
How many cars used number 48?
CREATE TABLE table_15491596_1 ( engine VARCHAR, no VARCHAR )
SELECT power_kw FROM table_23394920_1 WHERE callsign = "DXZB-TV"
When dxzb-tv is the call sign what is the power kw?
CREATE TABLE table_23394920_1 (power_kw VARCHAR, callsign VARCHAR)
SELECT date FROM table_23186738_9 WHERE location_attendance = "Air Canada Centre 18,736"
Name the date for air canada centre 18,736
CREATE TABLE table_23186738_9 (date VARCHAR, location_attendance VARCHAR)
SELECT "nation" FROM table_203_497 ORDER BY "gold" LIMIT 1
which nation has earned the least amount of gold medals ?
CREATE TABLE table_203_497 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
SELECT COUNT(station_type) FROM table_23394920_1 WHERE callsign = "DXCC-TV"
When dxcc-tv is the call sign how many station types are there?
CREATE TABLE table_23394920_1 (station_type VARCHAR, callsign VARCHAR)
SELECT score FROM table_23186738_9 WHERE team = "Chicago"
Name the score for chicago
CREATE TABLE table_23186738_9 (score VARCHAR, team VARCHAR)
SELECT "Tries against" FROM table_14447 WHERE "Points against" = '429'
Having 429 points against, what is the Tries Against?
CREATE TABLE table_14447 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text )
SELECT COUNT(station_type) FROM table_23394920_1 WHERE callsign = "DWHR-TV"
When dwhr-tv is the call sign how many station types are there?
CREATE TABLE table_23394920_1 (station_type VARCHAR, callsign VARCHAR)
SELECT MIN(game) FROM table_23186738_9 WHERE date = "March 20"
Name the least game for march 20
CREATE TABLE table_23186738_9 (game INTEGER, date VARCHAR)
SELECT COUNT("Directed by") FROM table_19532 WHERE "Written by" = 'Chris Sheridan'
How many people directed the show written by Chris Sheridan?
CREATE TABLE table_19532 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
SELECT COUNT(original_airdate) FROM table_23392257_4 WHERE _number = 22
What date did Episode 22 originally air?
CREATE TABLE table_23392257_4 (original_airdate VARCHAR, _number VARCHAR)
SELECT MIN(game) FROM table_23186738_9 WHERE score = "L 93–109 (OT)"
Name the least game for score of l 93–109 (ot)
CREATE TABLE table_23186738_9 (game INTEGER, score VARCHAR)
SELECT All_Home, AVG(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home
Visualize a bar chart about the distribution of All_Home and the average of Team_ID , and group by attribute All_Home, and rank by the X-axis in ascending please.
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text )
SELECT original_airdate FROM table_23392257_4 WHERE viewers__millions_ = "0.680"
What episode premier received 0.680 million viewers?
CREATE TABLE table_23392257_4 (original_airdate VARCHAR, viewers__millions_ VARCHAR)
SELECT date FROM table_23211041_7 WHERE location_attendance = "Verizon Center 20,173"
If the location attendance is the Verizon Center 20,173, what is the date?
CREATE TABLE table_23211041_7 (date VARCHAR, location_attendance VARCHAR)
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'glaucoma nos') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate, admissions.hadm_id FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE admissions.age BETWEEN 50 AND 59 AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.startdate AND t1.hadm_id = t2.hadm_id GROUP BY t2.drug) AS t3 WHERE t3.c1 <= 3
what are the three most frequent drugs that are prescribed to patients 50s after they were diagnosed with glaucoma nos in the previous year in the same hospital encounter?
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
SELECT timeslot FROM table_23392257_4 WHERE viewers__millions_ = "0.673"
What timeslot received 0.673 viewers?
CREATE TABLE table_23392257_4 (timeslot VARCHAR, viewers__millions_ VARCHAR)
SELECT team_captain FROM table_23214833_1 WHERE capacity = 17800
Who's captain of the team whose stadium has a capacity of 17800 people?
CREATE TABLE table_23214833_1 (team_captain VARCHAR, capacity VARCHAR)