VishalCh/book-train huggingface dataset:
Schema:
CREATE TABLE table_69618 (
    "Representative" text,
    "Years" text,
    "State" text,
    "Party" text,
    "Lifespan" text
)

Question: Name the representative for party of whig

SQL:
SELECT "Representative" FROM table_69618 WHERE "Party" = 'whig'
Schema:
CREATE TABLE table_16185956_1 (
    status VARCHAR,
    results VARCHAR
)

Question: What is the status of the district where the result is 63% 37%?

SQL:
SELECT status FROM table_16185956_1 WHERE results = "63% 37%"
Schema:
CREATE TABLE table_name_90 (
    kashmiri VARCHAR,
    indonesian VARCHAR
)

Question: What is the Kashmiri word for the Indonesian word senin?

SQL:
SELECT kashmiri FROM table_name_90 WHERE indonesian = "senin"
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 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 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
)

Question: how many female patients followed the procedure ven cath renal dialysis?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "F" AND procedures.short_title = "Ven cath renal dialysis"
Schema:
CREATE TABLE table_name_68 (
    city_of_license VARCHAR,
    call_sign VARCHAR
)

Question: Which City of license has a Call sign of k241an?

SQL:
SELECT city_of_license FROM table_name_68 WHERE call_sign = "k241an"
Schema:
CREATE TABLE table_73366 (
    "Piano" text,
    "Conductor" text,
    "Orchestra" text,
    "Record Company" text,
    "Year of Recording" real,
    "Format" text
)

Question: Where is the orchestra when the year of recording is 1934?

SQL:
SELECT "Orchestra" FROM table_73366 WHERE "Year of Recording" = '1934'
Schema:
CREATE TABLE table_22098274_1 (
    site VARCHAR,
    date VARCHAR
)

Question: How many number of site have May 1, 2004 as the date?

SQL:
SELECT COUNT(site) FROM table_22098274_1 WHERE date = "May 1, 2004"
Schema:
CREATE TABLE intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime 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 cost (
    costid number,
    uniquepid text,
    patienthealthsystemstayid number,
    eventtype text,
    eventid number,
    chargetime time,
    cost number
)

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

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

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 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 allergy (
    allergyid number,
    patientunitstayid number,
    drugname text,
    allergyname text,
    allergytime time
)

Question: how many times has patient 015-56390 recieved a enteral tube intake: nasoduodenal nostril, r 10f intake in 12/last year?

SQL:
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-56390')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.celllabel = 'enteral tube intake: nasoduodenal nostril, r 10f' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', intakeoutput.intakeoutputtime) = '12'
Schema:
CREATE TABLE table_40076 (
    "Ring name" text,
    "Current rank" text,
    "Debut" text,
    "Stable" text,
    "Birthplace" text
)

Question: What is Current Rank, when Ring Name is Kimurayama Mamoru?

SQL:
SELECT "Current rank" FROM table_40076 WHERE "Ring name" = 'kimurayama mamoru'
Schema:
CREATE TABLE table_name_52 (
    nation VARCHAR,
    points VARCHAR
)

Question: What was the nationality of the skater with 108.8 points?

SQL:
SELECT nation FROM table_name_52 WHERE points = 108.8
Schema:
CREATE TABLE table_45574 (
    "Place" text,
    "Player" text,
    "Country" text,
    "Score" text,
    "To par" real
)

Question: What is the total number of To Par, when Score is '70-75-76=221'?

SQL:
SELECT COUNT("To par") FROM table_45574 WHERE "Score" = '70-75-76=221'
Schema:
CREATE TABLE table_63078 (
    "Rank (2012)" real,
    "Rank (2010)" real,
    "Employer" text,
    "Industry" text,
    "2012 Employees (Total)" real,
    "2010 Employees (Total)" real,
    "2007 Employees (Total)" text,
    "Head office" text
)

Question: What is the total number of 2012 Employees (Total) when 2007 Employees (Total) is 8,985, and rank (2010) is smaller than 9?

SQL:
SELECT COUNT("2012 Employees (Total)") FROM table_63078 WHERE "2007 Employees (Total)" = '8,985' AND "Rank (2010)" < '9'
Schema:
CREATE TABLE table_36998 (
    "Rank" real,
    "First quarter" text,
    "Second quarter" text,
    "Third quarter" text,
    "Fourth quarter" text
)

Question: With a rank of 2 what is the second quarter?

SQL:
SELECT "Second quarter" FROM table_36998 WHERE "Rank" = '2'
Schema:
CREATE TABLE table_22126 (
    "District" text,
    "Incumbent" text,
    "Party" text,
    "First elected" real,
    "Results" text,
    "Candidates" text
)

Question: What party did hilda solis represent?

SQL:
SELECT "Party" FROM table_22126 WHERE "Incumbent" = 'Hilda Solis'
Schema:
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 intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

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

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

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

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

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 medication (
    medicationid number,
    patientunitstayid number,
    drugname text,
    dosage text,
    routeadmin text,
    drugstarttime time,
    drugstoptime time
)

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

Question: what was the last height of patient 005-73237 in the last month.

SQL:
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-73237') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY patient.unitadmittime DESC LIMIT 1
Schema:
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 cost (
    costid number,
    uniquepid text,
    patienthealthsystemstayid number,
    eventtype text,
    eventid number,
    chargetime time,
    cost number
)

CREATE TABLE medication (
    medicationid number,
    patientunitstayid number,
    drugname text,
    dosage text,
    routeadmin text,
    drugstarttime time,
    drugstoptime time
)

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

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

CREATE TABLE intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

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 diagnosis (
    diagnosisid number,
    patientunitstayid number,
    diagnosisname text,
    diagnosistime time,
    icd9code text
)

Question: how old was patient 035-18528's age during the first hospital visit?

SQL:
SELECT patient.age FROM patient WHERE patient.uniquepid = '035-18528' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1
Schema:
CREATE TABLE table_12721 (
    "Place" text,
    "Player" text,
    "Country" text,
    "Score" text,
    "To par" text
)

Question: What is the score for Greg Norman

SQL:
SELECT "Score" FROM table_12721 WHERE "Player" = 'greg norman'
Schema:
CREATE TABLE table_40579 (
    "Spoofed Title" text,
    "Actual Title" text,
    "Writer" text,
    "Artist" text,
    "Issue" real,
    "Date" text
)

Question: What is the Artist with a Date that is june 1979?

SQL:
SELECT "Artist" FROM table_40579 WHERE "Date" = 'june 1979'
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 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 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
)

Question: how many married patients have lab test item id 51214?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.itemid = "51214"
Schema:
CREATE TABLE table_22590 (
    "No. in series" real,
    "Title" text,
    "Directed by" text,
    "Written by" text,
    "Original air date" text,
    "Production code" text
)

Question: Name the total number of series for march 19, 2000

SQL:
SELECT COUNT("No. in series") FROM table_22590 WHERE "Original air date" = 'March 19, 2000'
Schema:
CREATE TABLE table_14710 (
    "Name" text,
    "Line" text,
    "Location" text,
    "Closed" text,
    "Current Status" text
)

Question: What is the line of the station in Toolamba that is currently demolished and closed in the late 1970s?

SQL:
SELECT "Line" FROM table_14710 WHERE "Current Status" = 'demolished' AND "Closed" = 'late 1970s' AND "Location" = 'toolamba'
Schema:
CREATE TABLE table_30058355_3 (
    thurs_25_aug VARCHAR,
    rank VARCHAR
)

Question: What is every value on Thursday August 25 for rank 3?

SQL:
SELECT thurs_25_aug FROM table_30058355_3 WHERE rank = 3
Schema:
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 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 lab (
    labid number,
    patientunitstayid number,
    labname text,
    labresult number,
    labresulttime time
)

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

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

CREATE TABLE medication (
    medicationid number,
    patientunitstayid number,
    drugname text,
    dosage text,
    routeadmin text,
    drugstarttime time,
    drugstoptime time
)

CREATE TABLE diagnosis (
    diagnosisid number,
    patientunitstayid number,
    diagnosisname text,
    diagnosistime time,
    icd9code 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 intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

Question: what diagnosis did patient 025-53910 receive last?

SQL:
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-53910')) ORDER BY diagnosis.diagnosistime DESC LIMIT 1
Schema:
CREATE TABLE table_name_69 (
    location VARCHAR,
    type VARCHAR
)

Question: What is the location for the club trophy?

SQL:
SELECT location FROM table_name_69 WHERE type = "club trophy"
Schema:
CREATE TABLE table_2876467_3 (
    total_top_3_placements VARCHAR,
    region_represented VARCHAR
)

Question: How many values of total top 3 placements does Taiwan have?

SQL:
SELECT COUNT(total_top_3_placements) FROM table_2876467_3 WHERE region_represented = "Taiwan"
Schema:
CREATE TABLE table_name_80 (
    date VARCHAR,
    location VARCHAR
)

Question: What is the Date for the game at michie stadium west point, ny?

SQL:
SELECT date FROM table_name_80 WHERE location = "michie stadium • west point, ny"
Schema:
CREATE TABLE table_name_56 (
    against INTEGER,
    draws VARCHAR,
    losses VARCHAR,
    byes VARCHAR
)

Question: Can you tell me the highest Against that has the Losses larger than 9, and the Byes of 2, and the Draws larger than 0?

SQL:
SELECT MAX(against) FROM table_name_56 WHERE losses > 9 AND byes = 2 AND draws > 0
Schema:
CREATE TABLE table_name_53 (
    date VARCHAR,
    type VARCHAR,
    opponent VARCHAR
)

Question: When is a Type of tko, and an Opponent of jesse brinkley

SQL:
SELECT date FROM table_name_53 WHERE type = "tko" AND opponent = "jesse brinkley"
Schema:
CREATE TABLE table_name_1 (
    outcome VARCHAR,
    championship VARCHAR,
    year VARCHAR
)

Question: What was Shaun Murphy's outcome in the Premier League Snooker championship held before 2010?

SQL:
SELECT outcome FROM table_name_1 WHERE championship = "premier league snooker" AND year < 2010
Schema:
CREATE TABLE table_name_40 (
    commissioned VARCHAR,
    launched VARCHAR,
    pennant_number VARCHAR
)

Question: Which commission was launched 28 june 1934, and has a Pennant number of h.78?

SQL:
SELECT commissioned FROM table_name_40 WHERE launched = "28 june 1934" AND pennant_number = "h.78"
Schema:
CREATE TABLE table_78639 (
    "Team" text,
    "2003\u201304 Pts" text,
    "2004\u201305 Pts" text,
    "2001\u201302 Pts" real,
    "Total Pts" real,
    "Total Pld" real
)

Question: Which Total Pts have a 2001 02 Pts smaller than 38?

SQL:
SELECT MIN("Total Pts") FROM table_78639 WHERE "2001\u201302 Pts" < '38'
Schema:
CREATE TABLE Catalog_Structure (
    catalog_level_number INTEGER,
    catalog_id INTEGER,
    catalog_level_name VARCHAR(50)
)

CREATE TABLE Catalogs (
    catalog_id INTEGER,
    catalog_name VARCHAR(50),
    catalog_publisher VARCHAR(80),
    date_of_publication DATETIME,
    date_of_latest_revision DATETIME
)

CREATE TABLE Catalog_Contents_Additional_Attributes (
    catalog_entry_id INTEGER,
    catalog_level_number INTEGER,
    attribute_id INTEGER,
    attribute_value VARCHAR(255)
)

CREATE TABLE Catalog_Contents (
    catalog_entry_id INTEGER,
    catalog_level_number INTEGER,
    parent_entry_id INTEGER,
    previous_entry_id INTEGER,
    next_entry_id INTEGER,
    catalog_entry_name VARCHAR(80),
    product_stock_number VARCHAR(50),
    price_in_dollars DOUBLE,
    price_in_euros DOUBLE,
    price_in_pounds DOUBLE,
    capacity VARCHAR(20),
    length VARCHAR(20),
    height VARCHAR(20),
    width VARCHAR(20)
)

CREATE TABLE Attribute_Definitions (
    attribute_id INTEGER,
    attribute_name VARCHAR(30),
    attribute_data_type VARCHAR(10)
)

Question: Find the dates on which more than one revisions were made, and the bin the date of latest revision into weekday interval and count them as a line chart.

SQL:
SELECT date_of_latest_revision, COUNT(date_of_latest_revision) FROM Catalogs
Schema:
CREATE TABLE table_61910 (
    "Name in English" text,
    "Name in Malay" text,
    "Acronym" text,
    "Foundation" text,
    "Location" text
)

Question: What is the acronym for the name Malay of Kolej Komuniti Sungai Petani?

SQL:
SELECT "Acronym" FROM table_61910 WHERE "Name in Malay" = 'kolej komuniti sungai petani'
Schema:
CREATE TABLE table_35365 (
    "Year" real,
    "Wins" real,
    "Earnings ($)" text,
    "Rank" real,
    "Scoring average" real
)

Question: What year has earnings of $557,158?

SQL:
SELECT MAX("Year") FROM table_35365 WHERE "Earnings ($)" = '557,158'
Schema:
CREATE TABLE table_14058433_4 (
    points_against VARCHAR,
    won VARCHAR
)

Question: what's the points against with won being 11

SQL:
SELECT points_against FROM table_14058433_4 WHERE won = "11"
Schema:
CREATE TABLE table_29788 (
    "Game" real,
    "Date" text,
    "Team" text,
    "Score" text,
    "High points" text,
    "High rebounds" text,
    "High assists" text,
    "Location Attendance" text,
    "Record" text
)

Question: What was the team score when Tim Duncan (12) got the high rebounds?

SQL:
SELECT "Score" FROM table_29788 WHERE "High rebounds" = 'Tim Duncan (12)'