VishalCh/book-train huggingface dataset:
Schema:
CREATE TABLE table_12652 (
    "Perpetrator" text,
    "Year" text,
    "Location" text,
    "Country" text,
    "Killed" text
)

Question: Who is the perpetrator in Bait Al-Aqari?

SQL:
SELECT "Perpetrator" FROM table_12652 WHERE "Location" = 'bait al-aqari'
Schema:
CREATE TABLE table_name_22 (
    uni_number VARCHAR,
    bats VARCHAR,
    surname VARCHAR
)

Question: What's the Uni# of Timms, who has bats of R?

SQL:
SELECT uni_number FROM table_name_22 WHERE bats = "r" AND surname = "timms"
Schema:
CREATE TABLE table_name_40 (
    score VARCHAR,
    place VARCHAR,
    player VARCHAR
)

Question: What is Score, when Place is 'T8', and when Player is 'Orville Moody'?

SQL:
SELECT score FROM table_name_40 WHERE place = "t8" AND player = "orville moody"
Schema:
CREATE TABLE airport_aircraft (
    ID int,
    Airport_ID int,
    Aircraft_ID int
)

CREATE TABLE pilot (
    Pilot_Id int(11),
    Name varchar(50),
    Age int(11)
)

CREATE TABLE match (
    Round real,
    Location text,
    Country text,
    Date text,
    Fastest_Qualifying text,
    Winning_Pilot text,
    Winning_Aircraft text
)

CREATE TABLE airport (
    Airport_ID int,
    Airport_Name text,
    Total_Passengers real,
    %_Change_2007 text,
    International_Passengers real,
    Domestic_Passengers real,
    Transit_Passengers real,
    Aircraft_Movements real,
    Freight_Metric_Tonnes real
)

CREATE TABLE aircraft (
    Aircraft_ID int(11),
    Aircraft varchar(50),
    Description varchar(50),
    Max_Gross_Weight varchar(50),
    Total_disk_area varchar(50),
    Max_disk_Loading varchar(50)
)

Question: What are the descriptions for the aircrafts, and count them by a bar chart

SQL:
SELECT Description, COUNT(Description) FROM aircraft GROUP BY Description
Schema:
CREATE TABLE table_35745 (
    "Name" text,
    "Location" text,
    "State" text,
    "Opened (closing date if defunct)" text,
    "Surface" text,
    "Length" text
)

Question: What is the Name with an Opened (closing date if defunct) of 1995 and has a Length of miles (m), in Illinois?

SQL:
SELECT "Name" FROM table_35745 WHERE "Opened (closing date if defunct)" = '1995' AND "Length" = 'miles (m)' AND "State" = 'illinois'
Schema:
CREATE TABLE table_name_46 (
    nation VARCHAR,
    total VARCHAR,
    bronze VARCHAR
)

Question: Name the nation when bronze is less than 4 and the total is more than 4

SQL:
SELECT nation FROM table_name_46 WHERE total > 4 AND bronze < 4
Schema:
CREATE TABLE table_51074 (
    "Date" text,
    "Distance" text,
    "Handler" text,
    "Event" text,
    "Location" text
)

Question: On what date was Mike Jackson a handler at the Indianapolis Boat, Sport & Travel Show?

SQL:
SELECT "Date" FROM table_51074 WHERE "Handler" = 'mike jackson' AND "Event" = 'indianapolis boat, sport & travel show'
Schema:
CREATE TABLE table_54575 (
    "Home team" text,
    "Home team score" text,
    "Away team" text,
    "Away team score" text,
    "Venue" text,
    "Crowd" real,
    "Date" text
)

Question: For the Venue of western oval, what's the Away team playing?

SQL:
SELECT "Away team" FROM table_54575 WHERE "Venue" = 'western oval'
Schema:
CREATE TABLE microlab (
    microlabid number,
    patientunitstayid number,
    culturesite text,
    organism text,
    culturetakentime time
)

CREATE TABLE treatment (
    treatmentid number,
    patientunitstayid number,
    treatmentname text,
    treatmenttime time
)

CREATE TABLE vitalperiodic (
    vitalperiodicid number,
    patientunitstayid number,
    temperature number,
    sao2 number,
    heartrate number,
    respiration number,
    systemicsystolic number,
    systemicdiastolic number,
    systemicmean number,
    observationtime time
)

CREATE TABLE medication (
    medicationid number,
    patientunitstayid number,
    drugname text,
    dosage text,
    routeadmin text,
    drugstarttime time,
    drugstoptime 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 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 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 intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

Question: what are the top four common diagnoses that patients were diagnosed with within the same hospital visit after having been diagnosed with thrombocytopenia - alcohol-related since 2105?

SQL:
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'thrombocytopenia - alcohol-related' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2105') AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', diagnosis.diagnosistime) >= '2105') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.diagnosistime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.diagnosisname) AS t3 WHERE t3.c1 <= 4
Schema:
CREATE TABLE table_23211 (
    "Further Cities" text,
    "County, Oblast or State" text,
    "Country" text,
    "Distance" text,
    "Direction" text
)

Question: Name the number of direction for debrecen

SQL:
SELECT COUNT("Direction") FROM table_23211 WHERE "Further Cities" = 'Debrecen'
Schema:
CREATE TABLE table_18333678_2 (
    arrival VARCHAR,
    departure VARCHAR
)

Question: when does the train departuring at 11.35 arrive

SQL:
SELECT arrival FROM table_18333678_2 WHERE departure = "11.35"
Schema:
CREATE TABLE table_19858 (
    "Stage" real,
    "Winner" text,
    "General classification" text,
    "Points classification" text,
    "Mountains classification" text,
    "Combination classification" text,
    "Team classification" text
)

Question: what is the minimum stage where mountains classification is aitor osa and aitor gonz lez won?

SQL:
SELECT MIN("Stage") FROM table_19858 WHERE "Mountains classification" = 'Aitor Osa' AND "Winner" = 'Aitor González'
Schema:
CREATE TABLE table_74398 (
    "Date" text,
    "Time" text,
    "ACC Team" text,
    "Big Ten Team" text,
    "Location" text,
    "Television" text,
    "Attendance" real,
    "Winner" text,
    "Challenge Leader" text
)

Question: What was the time of the games that took place at the cassell coliseum blacksburg, va?

SQL:
SELECT "Time" FROM table_74398 WHERE "Location" = 'Cassell Coliseum • Blacksburg, VA'
Schema:
CREATE TABLE table_3683 (
    "No. in series" real,
    "No. in season" real,
    "Title" text,
    "Directed by" text,
    "Written by" text,
    "Original air date" text,
    "U.S. viewers (million)" text
)

Question: Who was the writer in the episode directed by Jesse Peretz?

SQL:
SELECT "Written by" FROM table_3683 WHERE "Directed by" = 'Jesse Peretz'
Schema:
CREATE TABLE table_4022 (
    "Representative" text,
    "Party" text,
    "Years" text,
    "Congress" text,
    "District Home" text,
    "Occupation" text,
    "Electoral history" text
)

Question: What time span is listed under years for the 96th congres?

SQL:
SELECT "Years" FROM table_4022 WHERE "Congress" = '96th'
Schema:
CREATE TABLE diagnoses (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

CREATE TABLE 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
)

Question: give me the number of patients whose admission location is transfer from hosp/extram and procedure icd9 code is 5781?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.icd9_code = "5781"

Question: how many patients stayed in hospital for more than 34 days and were procedured with icd9 code 3931?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "34" AND procedures.icd9_code = "3931"
Schema:
CREATE TABLE school_details (
    school_id number,
    nickname text,
    colors text,
    league text,
    class text,
    division text
)

CREATE TABLE school (
    school_id number,
    school text,
    location text,
    enrollment number,
    founded number,
    denomination text,
    boys_or_girls text,
    day_or_boarding text,
    year_entered_competition number,
    school_colors text
)

CREATE TABLE player (
    player_id number,
    player text,
    team text,
    age number,
    position text,
    school_id number
)

CREATE TABLE school_performance (
    school_id number,
    school_year text,
    class_a text,
    class_aa text
)

Question: Take the average of the school enrollment.

SQL:
SELECT AVG(enrollment) FROM school
Schema:
CREATE TABLE treatment (
    treatmentid number,
    patientunitstayid number,
    treatmentname text,
    treatmenttime time
)

CREATE TABLE allergy (
    allergyid number,
    patientunitstayid number,
    drugname text,
    allergyname text,
    allergytime time
)

CREATE TABLE microlab (
    microlabid number,
    patientunitstayid number,
    culturesite text,
    organism text,
    culturetakentime 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 cost (
    costid number,
    uniquepid text,
    patienthealthsystemstayid number,
    eventtype text,
    eventid number,
    chargetime time,
    cost number
)

CREATE TABLE lab (
    labid number,
    patientunitstayid number,
    labname text,
    labresult number,
    labresulttime 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 intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    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
)

Question: what was patient 025-44495's first sputum, tracheal specimen microbiology test time since 09/2105.

SQL:
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-44495')) AND microlab.culturesite = 'sputum, tracheal specimen' AND STRFTIME('%y-%m', microlab.culturetakentime) >= '2105-09' ORDER BY microlab.culturetakentime LIMIT 1
Schema:
CREATE TABLE table_56902 (
    "Home team" text,
    "Home team score" text,
    "Away team" text,
    "Away team score" text,
    "Venue" text,
    "Crowd" real,
    "Date" text
)

Question: Which home team played against the away team Carlton?

SQL:
SELECT "Home team" FROM table_56902 WHERE "Away team" = 'carlton'
Schema:
CREATE TABLE table_name_21 (
    tv_network_s_ VARCHAR,
    alternate_title_translation VARCHAR
)

Question: What TV network is the series aistr em aired on?

SQL:
SELECT tv_network_s_ FROM table_name_21 WHERE alternate_title_translation = "aistrų žemė"
Schema:
CREATE TABLE table_25355392_2 (
    november_3 VARCHAR,
    june_10_11 VARCHAR
)

Question: what is november 3 when june 10-11 is june 10, 1964?

SQL:
SELECT november_3 FROM table_25355392_2 WHERE june_10_11 = "June 10, 1964"
Schema:
CREATE TABLE intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

CREATE TABLE diagnosis (
    diagnosisid number,
    patientunitstayid number,
    diagnosisname text,
    diagnosistime time,
    icd9code text
)

CREATE TABLE allergy (
    allergyid number,
    patientunitstayid number,
    drugname text,
    allergyname text,
    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 cost (
    costid number,
    uniquepid text,
    patienthealthsystemstayid number,
    eventtype text,
    eventid number,
    chargetime time,
    cost number
)

CREATE TABLE lab (
    labid number,
    patientunitstayid number,
    labname text,
    labresult number,
    labresulttime time
)

CREATE TABLE microlab (
    microlabid number,
    patientunitstayid number,
    culturesite text,
    organism text,
    culturetakentime time
)

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 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
)

Question: so what's the average mch value of patient 006-157753 on their current hospital encounter?

SQL:
SELECT AVG(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-157753' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'mch'

Question: when did patient 027-149724 get for the last time a lab test since 29 months ago?

SQL:
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-149724')) AND DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-29 month') ORDER BY lab.labresulttime DESC LIMIT 1
Schema:
CREATE TABLE table_47993 (
    "Year" real,
    "Network" text,
    "Title" text,
    "Notes" text,
    "Language" text
)

Question: What is the title for the Korean progran on KBS2?

SQL:
SELECT "Title" FROM table_47993 WHERE "Language" = 'korean' AND "Network" = 'kbs2'
Schema:
CREATE TABLE table_name_52 (
    professional_partner VARCHAR,
    celebrity VARCHAR,
    rank VARCHAR,
    season VARCHAR,
    average VARCHAR
)

Question: Who is the professional partner of celebrity ma gorzata foremniak with a season less than 7, an average greater than 34.66, and a rank less than 10?

SQL:
SELECT professional_partner FROM table_name_52 WHERE season < 7 AND average > 34.66 AND rank < 10 AND celebrity = "małgorzata foremniak"
Schema:
CREATE TABLE locations (
    LOCATION_ID decimal(4,0),
    STREET_ADDRESS varchar(40),
    POSTAL_CODE varchar(12),
    CITY varchar(30),
    STATE_PROVINCE varchar(25),
    COUNTRY_ID varchar(2)
)

CREATE TABLE job_history (
    EMPLOYEE_ID decimal(6,0),
    START_DATE date,
    END_DATE date,
    JOB_ID varchar(10),
    DEPARTMENT_ID decimal(4,0)
)

CREATE TABLE regions (
    REGION_ID decimal(5,0),
    REGION_NAME varchar(25)
)

CREATE TABLE employees (
    EMPLOYEE_ID decimal(6,0),
    FIRST_NAME varchar(20),
    LAST_NAME varchar(25),
    EMAIL varchar(25),
    PHONE_NUMBER varchar(20),
    HIRE_DATE date,
    JOB_ID varchar(10),
    SALARY decimal(8,2),
    COMMISSION_PCT decimal(2,2),
    MANAGER_ID decimal(6,0),
    DEPARTMENT_ID decimal(4,0)
)

CREATE TABLE countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
)

CREATE TABLE jobs (
    JOB_ID varchar(10),
    JOB_TITLE varchar(35),
    MIN_SALARY decimal(6,0),
    MAX_SALARY decimal(6,0)
)

CREATE TABLE departments (
    DEPARTMENT_ID decimal(4,0),
    DEPARTMENT_NAME varchar(30),
    MANAGER_ID decimal(6,0),
    LOCATION_ID decimal(4,0)
)

Question: Bin the hire date of employees into the day of week interval and count them for visualizing a bar chart, and rank in asc by the total number.

SQL:
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees ORDER BY COUNT(HIRE_DATE)
Schema:
CREATE TABLE table_34793 (
    "Date" text,
    "Result" text,
    "Score" text,
    "Brazil scorers" text,
    "Competition" text
)

Question: Which Result has a Score of 4-1, and a Competition of world cup qualifying?

SQL:
SELECT "Result" FROM table_34793 WHERE "Score" = '4-1' AND "Competition" = 'world cup qualifying'
Schema:
CREATE TABLE table_45304 (
    "Place" text,
    "Player" text,
    "Country" text,
    "Score" text,
    "To par" text,
    "Money ( $ )" text
)

Question: What was the To par of Jack Nicklaus?

SQL:
SELECT "To par" FROM table_45304 WHERE "Player" = 'jack nicklaus'
Schema:
CREATE TABLE table_name_19 (
    draw INTEGER,
    competition VARCHAR,
    dynamo VARCHAR
)

Question: what is the most draw when the competition is soviet league and dynamo is more than 34?

SQL:
SELECT MAX(draw) FROM table_name_19 WHERE competition = "soviet league" AND dynamo > 34
Schema:
CREATE TABLE table_8187 (
    "Club" text,
    "Sport" text,
    "Founded" real,
    "League" text,
    "Venue" text
)

Question: COunt the Founded which has a Venue of villa park?

SQL:
SELECT SUM("Founded") FROM table_8187 WHERE "Venue" = 'villa park'
Schema:
CREATE TABLE table_26681728_1 (
    rank_qualifying INTEGER,
    score_qualifying VARCHAR,
    location VARCHAR,
    year VARCHAR
)

Question: In Ghent in 2011, what was the rank-qualifying value when the score-qualifying value was 14.850

SQL:
SELECT MAX(rank_qualifying) FROM table_26681728_1 WHERE location = "Ghent" AND year = 2011 AND score_qualifying = "14.850"
Schema:
CREATE TABLE screen_mode (
    graphics_mode number,
    char_cells text,
    pixels text,
    hardware_colours number,
    used_kb number,
    map text,
    type text
)

CREATE TABLE phone (
    company_name text,
    hardware_model_name text,
    accreditation_type text,
    accreditation_level text,
    date text,
    chip_model text,
    screen_mode text
)

CREATE TABLE chip_model (
    model_name text,
    launch_year number,
    ram_mib number,
    rom_mib number,
    slots text,
    wifi text,
    bluetooth text
)

Question: Find the details for all chip models.

SQL:
SELECT * FROM chip_model
Schema:
CREATE TABLE Ref_Document_Types (
    Document_Type_Code CHAR(15),
    Document_Type_Name VARCHAR(255),
    Document_Type_Description VARCHAR(255)
)

CREATE TABLE Accounts (
    Account_ID INTEGER,
    Statement_ID INTEGER,
    Account_Details VARCHAR(255)
)

CREATE TABLE Ref_Budget_Codes (
    Budget_Type_Code CHAR(15),
    Budget_Type_Description VARCHAR(255)
)

CREATE TABLE Projects (
    Project_ID INTEGER,
    Project_Details VARCHAR(255)
)

CREATE TABLE Documents_with_Expenses (
    Document_ID INTEGER,
    Budget_Type_Code CHAR(15),
    Document_Details VARCHAR(255)
)

CREATE TABLE Documents (
    Document_ID INTEGER,
    Document_Type_Code CHAR(15),
    Project_ID INTEGER,
    Document_Date DATETIME,
    Document_Name VARCHAR(255),
    Document_Description VARCHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Statements (
    Statement_ID INTEGER,
    Statement_Details VARCHAR(255)
)

Question: Show the number of documents created in each day and bin document date by weekday with a bar chart, and I want to show by the the number of document date in ascending please.

SQL:
SELECT Document_Date, COUNT(Document_Date) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code ORDER BY COUNT(Document_Date)
Schema:
CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
)

CREATE TABLE diagnoses (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE procedures (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

Question: what is the number of patients whose days of hospital stay is greater than 15 and diagnoses short title is respiratory distress syn?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "15" AND diagnoses.short_title = "Respiratory distress syn"
Schema:
CREATE TABLE table_25668962_1 (
    us_viewers__million_ VARCHAR,
    no_in_series VARCHAR
)

Question: How many million U.S. viewers watched episode number 6 in the series?

SQL:
SELECT us_viewers__million_ FROM table_25668962_1 WHERE no_in_series = 6