VishalCh/book-train huggingface dataset:
Schema:
CREATE TABLE medication (
    medicationid number,
    patientunitstayid number,
    drugname text,
    dosage text,
    routeadmin text,
    drugstarttime time,
    drugstoptime time
)

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

CREATE TABLE cost (
    costid number,
    uniquepid text,
    patienthealthsystemstayid number,
    eventtype text,
    eventid number,
    chargetime time,
    cost number
)

CREATE TABLE microlab (
    microlabid number,
    patientunitstayid number,
    culturesite text,
    organism text,
    culturetakentime 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 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 treatment (
    treatmentid number,
    patientunitstayid number,
    treatmentname text,
    treatmenttime time
)

Question: how many patients were prescribed 10 ml vial : calcium chloride 10 % iv soln during the same month after the diagnosis of sinus tachycardia, since 4 years ago?

SQL:
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sinus tachycardia' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-4 year')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = '10 ml vial : calcium chloride 10 % iv soln' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-4 year')) AS t2 WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.drugstarttime, 'start of month')
Schema:
CREATE TABLE table_39747 (
    "Year" text,
    "Total" real,
    "Wins" real,
    "Losses" real,
    "No result" real,
    "% Win" text
)

Question: How many losses had a total of 17 and more than 10 wins?

SQL:
SELECT COUNT("Losses") FROM table_39747 WHERE "Total" = '17' AND "Wins" > '10'
Schema:
CREATE TABLE table_49576 (
    "Date" text,
    "Place" text,
    "Race winners" text,
    "GP winner" text,
    "Source" text
)

Question: What date has a place of chernivtsi, and a race winners of etienne bax / kaspars stupelis? What

SQL:
SELECT "Date" FROM table_49576 WHERE "Place" = 'chernivtsi' AND "Race winners" = 'etienne bax / kaspars stupelis'
Schema:
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
)

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

CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
)

Question: what is minimum age of patients whose gender is f and age is greater than or equal to 30?

SQL:
SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.age >= "30"

Question: provide the maximum age of patients whose marital status is widowed and stayed in the hospital for 23 days.

SQL:
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "WIDOWED" AND demographic.days_stay = "23"

Question: what is the number of patients whose primary disease is brain mass;intracranial hemorrhage and procedure icd9 code is 8856?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" AND procedures.icd9_code = "8856"

Question: how many patients whose age is less than 41 and lab test category is chemistry?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "41" AND lab."CATEGORY" = "Chemistry"
Schema:
CREATE TABLE table_25693 (
    "Player" text,
    "Games Played" real,
    "Minutes" real,
    "Field Goals" real,
    "Three Pointers" real,
    "Free Throws" real,
    "Rebounds" real,
    "Assists" real,
    "Blocks" real,
    "Steals" real,
    "Points" real
)

Question: Name the least field goals for chantel hilliard

SQL:
SELECT MIN("Field Goals") FROM table_25693 WHERE "Player" = 'Chantel Hilliard'
Schema:
CREATE TABLE table_name_53 (
    points INTEGER,
    year VARCHAR,
    entrant VARCHAR
)

Question: For the Entrant of Sasol Jordan, add up all the points with a Year larger than 1993.

SQL:
SELECT SUM(points) FROM table_name_53 WHERE year > 1993 AND entrant = "sasol jordan"
Schema:
CREATE TABLE table_50402 (
    "Pick" real,
    "Player" text,
    "Nationality" text,
    "New WNBA Team" text,
    "Former WNBA Team" text,
    "College/Country/Team" text
)

Question: Who is the player who played for the Miami Sol and went to school at North Carolina State?

SQL:
SELECT "Player" FROM table_50402 WHERE "New WNBA Team" = 'miami sol' AND "College/Country/Team" = 'north carolina state'
Schema:
CREATE TABLE table_name_94 (
    date VARCHAR,
    week VARCHAR,
    result VARCHAR
)

Question: What is the date where the result was L 27-10 in a week before week 9?

SQL:
SELECT date FROM table_name_94 WHERE week < 9 AND result = "l 27-10"
Schema:
CREATE TABLE table_22348 (
    "State (class)" text,
    "Vacator" text,
    "Reason for change" text,
    "Successor" text,
    "Date of successors formal installation" text
)

Question: Who vacated his post when his successor was formally installed on May 11, 1966?

SQL:
SELECT "Vacator" FROM table_22348 WHERE "Date of successors formal installation" = 'May 11, 1966'
Schema:
CREATE TABLE table_42349 (
    "Tournament" text,
    "Wins" real,
    "Top-5" real,
    "Top-10" real,
    "Top-25" real,
    "Events" real,
    "Cuts made" real
)

Question: What is the lowest cuts made that had a Top-25 less than 6 and wins greater than 0?

SQL:
SELECT MIN("Cuts made") FROM table_42349 WHERE "Top-25" < '6' AND "Wins" < '0'
Schema:
CREATE TABLE table_66454 (
    "Rank" real,
    "Nation" text,
    "Gold" real,
    "Silver" real,
    "Bronze" real,
    "Total" real
)

Question: what is the least silver for germany when gold is more than 4?

SQL:
SELECT MIN("Silver") FROM table_66454 WHERE "Nation" = 'germany' AND "Gold" > '4'
Schema:
CREATE TABLE table_1233026_4 (
    competition VARCHAR,
    aggregate VARCHAR
)

Question: What is the competition when aggregate is 1 4?

SQL:
SELECT competition FROM table_1233026_4 WHERE aggregate = "1–4"
Schema:
CREATE TABLE table_name_42 (
    points INTEGER,
    chassis VARCHAR,
    stage_wins VARCHAR
)

Question: what is the highest points when the chassis is focus rs wrc 08 and 09 and the stage wins is more than 91?

SQL:
SELECT MAX(points) FROM table_name_42 WHERE chassis = "focus rs wrc 08 and 09" AND stage_wins > 91
Schema:
CREATE TABLE table_name_59 (
    score VARCHAR,
    player VARCHAR
)

Question: What was Eduardo Romero's score?

SQL:
SELECT score FROM table_name_59 WHERE player = "eduardo romero"
Schema:
CREATE TABLE table_65664 (
    "School" text,
    "City" text,
    "Mascot" text,
    "County" text,
    "Year joined" real,
    "Previous Conference" text,
    "Year Left" real,
    "Conference Joined" text
)

Question: What is the mascot of Hammond Tech?

SQL:
SELECT "Mascot" FROM table_65664 WHERE "City" = 'hammond' AND "School" = 'hammond tech'
Schema:
CREATE TABLE table_name_80 (
    wins INTEGER,
    points VARCHAR,
    rank VARCHAR
)

Question: What is the lowest number of wins with more than 113 points in 4th rank?

SQL:
SELECT MIN(wins) FROM table_name_80 WHERE points > 113 AND rank = "4th"
Schema:
CREATE TABLE table_204_360 (
    id number,
    "year" number,
    "host" text,
    "gold" text,
    "silver" text,
    "bronze" text
)

Question: how many gold 's has brazil won ?

SQL:
SELECT COUNT(*) FROM table_204_360 WHERE "gold" = 'brazil'
Schema:
CREATE TABLE table_3277 (
    "Edition" real,
    "Zone" text,
    "Round" text,
    "Against" text,
    "Surface" text,
    "Opponent" text,
    "Outcome" text,
    "Result" text
)

Question: What kind of round was played when Hanne Skak Jensen faced Austria?

SQL:
SELECT "Round" FROM table_3277 WHERE "Against" = 'Austria'
Schema:
CREATE TABLE table_357 (
    "L&CR No." real,
    "Type" text,
    "Manufacturer" text,
    "Delivered" text,
    "Name" text,
    "Jt. Cttee No." real,
    "1845 disposal" text
)

Question: What was the type of sussex?

SQL:
SELECT "Type" FROM table_357 WHERE "Name" = 'Sussex'
Schema:
CREATE TABLE claims (
    claim_id number,
    policy_id number,
    date_claim_made time,
    date_claim_settled time,
    amount_claimed number,
    amount_settled number
)

CREATE TABLE customers (
    customer_id number,
    customer_details text
)

CREATE TABLE customer_policies (
    policy_id number,
    customer_id number,
    policy_type_code text,
    start_date time,
    end_date time
)

CREATE TABLE settlements (
    settlement_id number,
    claim_id number,
    date_claim_made time,
    date_claim_settled time,
    amount_claimed number,
    amount_settled number,
    customer_policy_id number
)

CREATE TABLE payments (
    payment_id number,
    settlement_id number,
    payment_method_code text,
    date_payment_made time,
    amount_payment number
)

Question: What is the total amount of settlement made for all the settlements?

SQL:
SELECT SUM(amount_settled) FROM settlements
Schema:
CREATE TABLE writes (
    paperid int,
    authorid int
)

CREATE TABLE journal (
    journalid int,
    journalname varchar
)

CREATE TABLE cite (
    citingpaperid int,
    citedpaperid int
)

CREATE TABLE venue (
    venueid int,
    venuename varchar
)

CREATE TABLE author (
    authorid int,
    authorname varchar
)

CREATE TABLE paperkeyphrase (
    paperid int,
    keyphraseid int
)

CREATE TABLE paperfield (
    fieldid int,
    paperid int
)

CREATE TABLE keyphrase (
    keyphraseid int,
    keyphrasename varchar
)

CREATE TABLE paperdataset (
    paperid int,
    datasetid int
)

CREATE TABLE paper (
    paperid int,
    title varchar,
    venueid int,
    year int,
    numciting int,
    numcitedby int,
    journalid int
)

CREATE TABLE field (
    fieldid int
)

CREATE TABLE dataset (
    datasetid int,
    datasetname varchar
)

Question: What is the highest cited paper by jeff dean ?

SQL:
SELECT DISTINCT cite.citedpaperid, COUNT(cite.citedpaperid) FROM author, cite, paper, writes WHERE author.authorname = 'jeff dean' AND paper.paperid = cite.citedpaperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY cite.citedpaperid ORDER BY COUNT(cite.citedpaperid) DESC
Schema:
CREATE TABLE table_name_37 (
    rank INTEGER,
    silver VARCHAR,
    total VARCHAR,
    nation VARCHAR
)

Question: What is the lowest rank of Hungary where there was a total of 8 medals, including 2 silver?

SQL:
SELECT MIN(rank) FROM table_name_37 WHERE total = 8 AND nation = "hungary" AND silver > 2
Schema:
CREATE TABLE table_name_24 (
    week INTEGER,
    result VARCHAR
)

Question: How many weeks had a Result of w 20 6?

SQL:
SELECT SUM(week) FROM table_name_24 WHERE result = "w 20–6"
Schema:
CREATE TABLE table_78334 (
    "Week" real,
    "Date" text,
    "Opponent" text,
    "Result" text,
    "Attendance" real
)

Question: What is the combined attendance of all games that had a result of w 35-14?

SQL:
SELECT SUM("Attendance") FROM table_78334 WHERE "Result" = 'w 35-14'
Schema:
CREATE TABLE procedures (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

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

CREATE TABLE 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 diagnoses (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
)

Question: Find the name of female patients who had a granular casts lab test.

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.gender = "F" AND lab.label = "Granular Casts"

Question: what is ethnicity of subject id 16438?

SQL:
SELECT demographic.ethnicity FROM demographic WHERE demographic.subject_id = "16438"

Question: how many patients whose admission location is phys referral/normal deli and discharge location is home?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.discharge_location = "HOME"

Question: how many patients whose admission year is less than 2111 and item id is 51446?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2111" AND lab.itemid = "51446"
Schema:
CREATE TABLE table_204_828 (
    id number,
    "whitworth size (in)" number,
    "core diameter (in)" number,
    "threads per inch" number,
    "pitch (in)" number,
    "tapping drill size" text
)

Question: what is the next whitworth size -lrb- in -rrb- below 1/8 ?

SQL:
SELECT "whitworth size (in)" FROM table_204_828 WHERE id = (SELECT id FROM table_204_828 WHERE "whitworth size (in)" = '1/8') + 1
Schema:
CREATE TABLE table_26375386_28 (
    rank_by_average VARCHAR,
    couple VARCHAR
)

Question: How many ranks by average for the couple Tana and Stuart?

SQL:
SELECT COUNT(rank_by_average) FROM table_26375386_28 WHERE couple = "Tana and Stuart"
Schema:
CREATE TABLE table_9551 (
    "Election" real,
    "Number of NDC votes" text,
    "Share of votes" text,
    "Seats" real,
    "Outcome of election" text
)

Question: What is the share of votes with 3,567,021 NDC votes?

SQL:
SELECT "Share of votes" FROM table_9551 WHERE "Number of NDC votes" = '3,567,021'
Schema:
CREATE TABLE table_name_89 (
    overall INTEGER,
    name VARCHAR,
    round VARCHAR
)

Question: Which highest overall figure had Robert Alford as a name and a round of more than 2?

SQL:
SELECT MAX(overall) FROM table_name_89 WHERE name = "robert alford" AND round > 2
Schema:
CREATE TABLE table_17968282_1 (
    points VARCHAR,
    team VARCHAR
)

Question: Name the total number of points for newell's old boys

SQL:
SELECT COUNT(points) FROM table_17968282_1 WHERE team = "Newell's Old Boys"
Schema:
CREATE TABLE table_76347 (
    "Draw" real,
    "Language" text,
    "Artist" text,
    "Song" text,
    "English translation" text,
    "Place" real,
    "Points" real
)

Question: What song was in french?

SQL:
SELECT "Song" FROM table_76347 WHERE "Language" = 'french'
Schema:
CREATE TABLE table_28767 (
    "Season #" real,
    "Series #" real,
    "Episode title" text,
    "Original air date" text,
    "Nick prod. #" real
)

Question: What's the name of the episode associated with Nick production number 342?

SQL:
SELECT "Episode title" FROM table_28767 WHERE "Nick prod. #" = '342'
Schema:
CREATE TABLE table_name_98 (
    leading_scorer VARCHAR,
    score VARCHAR
)

Question: What Leading scorer had a Score of 80 112?

SQL:
SELECT leading_scorer FROM table_name_98 WHERE score = "80–112"
Schema:
CREATE TABLE table_61209 (
    "7:00 am" text,
    "7:30 am" text,
    "8:00 am" text,
    "9:00 am" text,
    "10:00 am" text,
    "11:00 am" text,
    "noon" text,
    "12:30 pm" text,
    "1:00 pm" text,
    "1:30 pm" text,
    "2:00 pm" text,
    "3:00 pm" text,
    "3:30 pm" text,
    "5:00 pm" text,
    "6:30 pm" text
)

Question: What is on at 5pm on the channel where As the World Turns is on at 2pm?

SQL:
SELECT "5:00 pm" FROM table_61209 WHERE "2:00 pm" = 'as the world turns'
Schema:
CREATE TABLE table_57084 (
    "State" text,
    "Interview" real,
    "Swimsuit" real,
    "Evening gown" real,
    "Average" real
)

Question: Name the most interview for minnesota and average more than 7.901

SQL:
SELECT MAX("Interview") FROM table_57084 WHERE "State" = 'minnesota' AND "Average" > '7.901'
Schema:
CREATE TABLE table_56666 (
    "Date" text,
    "Visitor" text,
    "Score" text,
    "Home" text,
    "Leading scorer" text,
    "Attendance" real,
    "Record" text
)

Question: In the game where the Hornets were the home team and Clippers the visiting team, what is the score?

SQL:
SELECT "Score" FROM table_56666 WHERE "Home" = 'hornets' AND "Visitor" = 'clippers'
Schema:
CREATE TABLE table_62549 (
    "Place" text,
    "Player" text,
    "Country" text,
    "Score" text,
    "To par" text,
    "Money ( $ )" real
)

Question: What was the highest money when the score was 69-68-67-69=273?

SQL:
SELECT MAX("Money ( $ )") FROM table_62549 WHERE "Score" = '69-68-67-69=273'
Schema:
CREATE TABLE table_name_53 (
    opponent VARCHAR,
    week VARCHAR
)

Question: Who were the opponents during week 14?

SQL:
SELECT opponent FROM table_name_53 WHERE week = 14
Schema:
CREATE TABLE table_name_64 (
    entrant VARCHAR,
    points VARCHAR,
    year VARCHAR,
    engine VARCHAR
)

Question: After 1961, who as the Entrant when the engine was a Ferrari v8, and when the points were lower than 23?

SQL:
SELECT entrant FROM table_name_64 WHERE year > 1961 AND engine = "ferrari v8" AND points < 23
Schema:
CREATE TABLE news_report (
    journalist_ID int,
    Event_ID int,
    Work_Type text
)

CREATE TABLE event (
    Event_ID int,
    Date text,
    Venue text,
    Name text,
    Event_Attendance int
)

CREATE TABLE journalist (
    journalist_ID int,
    Name text,
    Nationality text,
    Age text,
    Years_working int
)

Question: What are the nationalities and the taotal ages of journalists. Visualize by a bar chart.

SQL:
SELECT Nationality, SUM(Age) FROM journalist GROUP BY Nationality
Schema:
CREATE TABLE table_43430 (
    "Year" text,
    "Award" text,
    "Production" text,
    "Role" text,
    "Result" text
)

Question: Which award was given for the role of Elphaba in 2009?

SQL:
SELECT "Award" FROM table_43430 WHERE "Role" = 'elphaba' AND "Year" = '2009'
Schema:
CREATE TABLE table_1342198_36 (
    result VARCHAR,
    incumbent VARCHAR
)

Question: What was the result when incumbent Tom Steed was elected?

SQL:
SELECT result FROM table_1342198_36 WHERE incumbent = "Tom Steed"
Schema:
CREATE TABLE table_5255 (
    "Name" text,
    "Nationality" text,
    "Position" text,
    "Tenure Began" real,
    "Term Ending" real
)

Question: Term Ending smaller than 2018, and a Nationality of new zealand what is the name?

SQL:
SELECT "Name" FROM table_5255 WHERE "Term Ending" < '2018' AND "Nationality" = 'new zealand'
Schema:
CREATE TABLE table_15187735_11 (
    segment_c VARCHAR,
    series_ep VARCHAR
)

Question: What is the name of series episode 11-02's segment c?

SQL:
SELECT segment_c FROM table_15187735_11 WHERE series_ep = "11-02"
Schema:
CREATE TABLE table_name_16 (
    high_rebounds VARCHAR,
    date VARCHAR
)

Question: Can you tell me the High rebounds that has the Date of november 5?

SQL:
SELECT high_rebounds FROM table_name_16 WHERE date = "november 5"
Schema:
CREATE TABLE wine (
    No INTEGER,
    Grape TEXT,
    Winery TEXT,
    Appelation TEXT,
    State TEXT,
    Name TEXT,
    Year INTEGER,
    Price INTEGER,
    Score INTEGER,
    Cases INTEGER,
    Drink TEXT
)

CREATE TABLE appellations (
    No INTEGER,
    Appelation TEXT,
    County TEXT,
    State TEXT,
    Area TEXT,
    isAVA TEXT
)

CREATE TABLE grapes (
    ID INTEGER,
    Grape TEXT,
    Color TEXT
)

Question: A bar chart shows the number of appellations whose score is higher than 93, and ordered by Name.

SQL:
SELECT Appelation, COUNT(Appelation) FROM wine WHERE Score > 93 GROUP BY Appelation ORDER BY Name
Schema:
CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
)

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

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

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

Question: what is minimum age of patients whose days of hospital stay is 29 and admission year is greater than or equal to 2107?

SQL:
SELECT MIN(demographic.age) FROM demographic WHERE demographic.days_stay = "29" AND demographic.admityear >= "2107"
Schema:
CREATE TABLE table_8542 (
    "Tournament" text,
    "Surface" text,
    "Week" text,
    "Winner and score" text,
    "Finalist" text,
    "Semifinalists" text
)

Question: Which Surface has a Week of march 1?

SQL:
SELECT "Surface" FROM table_8542 WHERE "Week" = 'march 1'
Schema:
CREATE TABLE CHARACTERISTICS (
    characteristic_name VARCHAR
)

Question: Find the names of all the product characteristics.

SQL:
SELECT DISTINCT characteristic_name FROM CHARACTERISTICS
Schema:
CREATE TABLE table_204_207 (
    id number,
    "week" number,
    "date" text,
    "opponent" text,
    "result" text,
    "attendance" number,
    "bye" text
)

Question: on what date did the bears win by a difference of 27 points ?

SQL:
SELECT "date" FROM table_204_207 WHERE "result" = 'w' AND "result" - "result" = 27