VishalCh/book-train huggingface dataset:
Schema:
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
)

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

Question: what is the maximum age of patients that survived in or above the age 72?

SQL:
SELECT MAX(demographic.age) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.age >= "72"

Question: Which patients have hispanic or latino-puerto rican ethnic background?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN"

Question: what is minimum days of hospital stay of patients whose age is greater than or equal to 41?

SQL:
SELECT MIN(demographic.days_stay) FROM demographic WHERE demographic.age >= "41"
Schema:
CREATE TABLE table_23248910_9 (
    high_points VARCHAR,
    team VARCHAR
)

Question: Who is every high points for the Pistons team?

SQL:
SELECT high_points FROM table_23248910_9 WHERE team = "Pistons"
Schema:
CREATE TABLE table_5631 (
    "Frequency (MHz)" real,
    "Call letters" text,
    "Licensed location" text,
    "Type" text,
    "Format" text
)

Question: Frequency (MHz) that has a Type of primary, and a Call letters of ktbb-fm has what total number?

SQL:
SELECT COUNT("Frequency (MHz)") FROM table_5631 WHERE "Type" = 'primary' AND "Call letters" = 'ktbb-fm'
Schema:
CREATE TABLE table_25695027_1 (
    valves VARCHAR,
    years_built VARCHAR
)

Question: How many types of valves were used on this engine that was built on 1902-05?

SQL:
SELECT COUNT(valves) FROM table_25695027_1 WHERE years_built = "1902-05"
Schema:
CREATE TABLE table_name_97 (
    race_winner VARCHAR,
    fastest_lap VARCHAR,
    date VARCHAR
)

Question: Who won with the fastest lap of daijiro hiura on March 29?

SQL:
SELECT race_winner FROM table_name_97 WHERE fastest_lap = "daijiro hiura" AND date = "march 29"
Schema:
CREATE TABLE diagnosis (
    diagnosisid number,
    patientunitstayid number,
    diagnosisname text,
    diagnosistime time,
    icd9code text
)

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

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

Question: since 2100 what are the five most frequently ordered lab tests for patients 40s?

SQL:
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND STRFTIME('%y', lab.labresulttime) >= '2100' GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 5
Schema:
CREATE TABLE table_79478 (
    "Peak" text,
    "Country" text,
    "Elevation (m)" real,
    "Prominence (m)" real,
    "Col (m)" real
)

Question: What is the Elevation (m) of the Peak with a Prominence (m) larger than 2,143 and Col (m) of 2012?

SQL:
SELECT "Elevation (m)" FROM table_79478 WHERE "Prominence (m)" > '2,143' AND "Col (m)" = '2012'
Schema:
CREATE TABLE airlines (
    alid number,
    name text,
    iata text,
    icao text,
    callsign text,
    country text,
    active text
)

CREATE TABLE airports (
    apid number,
    name text,
    city text,
    country text,
    x number,
    y number,
    elevation number,
    iata text,
    icao text
)

CREATE TABLE routes (
    rid number,
    dst_apid number,
    dst_ap text,
    src_apid number,
    src_ap text,
    alid number,
    airline text,
    codeshare text
)

Question: What are the names of the airports in the city of Goroka?

SQL:
SELECT name FROM airports WHERE city = 'Goroka'

Question: What is the country of the airport with the highest elevation?

SQL:
SELECT country FROM airports ORDER BY elevation DESC LIMIT 1
Schema:
CREATE TABLE table_name_51 (
    losing_bonus VARCHAR,
    drawn VARCHAR,
    try_bonus VARCHAR
)

Question: What was the losing bonus that had 1 draw and a 10 try bonus?

SQL:
SELECT losing_bonus FROM table_name_51 WHERE drawn = "1" AND try_bonus = "10"
Schema:
CREATE TABLE addresses (
    address_id number,
    line_1_number_building text,
    city text,
    zip_postcode text,
    state_province_county text,
    country text
)

CREATE TABLE vehicles (
    vehicle_id number,
    vehicle_details text
)

CREATE TABLE lessons (
    lesson_id number,
    customer_id number,
    lesson_status_code text,
    staff_id number,
    vehicle_id number,
    lesson_date time,
    lesson_time text,
    price number
)

CREATE TABLE customers (
    customer_id number,
    customer_address_id number,
    customer_status_code text,
    date_became_customer time,
    date_of_birth time,
    first_name text,
    last_name text,
    amount_outstanding number,
    email_address text,
    phone_number text,
    cell_mobile_phone_number text
)

CREATE TABLE staff (
    staff_id number,
    staff_address_id number,
    nickname text,
    first_name text,
    middle_name text,
    last_name text,
    date_of_birth time,
    date_joined_staff time,
    date_left_staff time
)

CREATE TABLE customer_payments (
    customer_id number,
    datetime_payment time,
    payment_method_code text,
    amount_payment number
)

Question: List the first name and last name of customers have the amount of outstanding between 1000 and 3000.

SQL:
SELECT first_name, last_name FROM customers WHERE amount_outstanding BETWEEN 1000 AND 3000
Schema:
CREATE TABLE table_56767 (
    "Grade" text,
    "Points" real,
    "Sit-up (reps)" text,
    "Standing Broad Jump (cm)" text,
    "Chin-up (reps)" text,
    "Shuttle Run (sec)" text,
    "2.4km Run (min:sec)" text
)

Question: What shuttle Run (sec) time has a 2.4km Run (min:sec) of 12:21-13:00?

SQL:
SELECT "Shuttle Run (sec)" FROM table_56767 WHERE "2.4km Run (min:sec)" = '12:21-13:00'
Schema:
CREATE TABLE table_name_27 (
    round INTEGER,
    result VARCHAR
)

Question: Which highest Round has a Result of loss?

SQL:
SELECT MAX(round) FROM table_name_27 WHERE result = "loss"
Schema:
CREATE TABLE table_name_25 (
    publication_date VARCHAR,
    fictional_date VARCHAR
)

Question: Name the publication date when the fictional date is 2112

SQL:
SELECT publication_date FROM table_name_25 WHERE fictional_date = "2112"
Schema:
CREATE TABLE table_22466 (
    "Township" text,
    "County" text,
    "Pop. (2010)" real,
    "Land ( sqmi )" text,
    "Water (sqmi)" text,
    "Latitude" text,
    "Longitude" text,
    "GEO ID" real,
    "ANSI code" real
)

Question: What township is 28.597 square miles of land?

SQL:
SELECT "Township" FROM table_22466 WHERE "Land ( sqmi )" = '28.597'
Schema:
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 countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
)

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 departments (
    DEPARTMENT_ID decimal(4,0),
    DEPARTMENT_NAME varchar(30),
    MANAGER_ID decimal(6,0),
    LOCATION_ID decimal(4,0)
)

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 regions (
    REGION_ID decimal(5,0),
    REGION_NAME varchar(25)
)

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

Question: For those employees who did not have any job in the past, a bar chart shows the distribution of job_id and the sum of employee_id , and group by attribute job_id, and display from low to high by the sum employee id.

SQL:
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID)
Schema:
CREATE TABLE table_name_32 (
    laps INTEGER,
    driver VARCHAR
)

Question: What is the lowest number of laps obtained by driver Nick Heidfeld?

SQL:
SELECT MIN(laps) FROM table_name_32 WHERE driver = "nick heidfeld"
Schema:
CREATE TABLE county (
    County_Id int,
    County_name text,
    Population real,
    Zip_code text
)

CREATE TABLE party (
    Party_ID int,
    Year real,
    Party text,
    Governor text,
    Lieutenant_Governor text,
    Comptroller text,
    Attorney_General text,
    US_Senate text
)

CREATE TABLE election (
    Election_ID int,
    Counties_Represented text,
    District int,
    Delegate text,
    Party int,
    First_Elected real,
    Committee text
)

Question: Show the name of each county along with the corresponding number of delegates from that county.

SQL:
SELECT County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District GROUP BY T1.County_Id
Schema:
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 intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

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

Question: give me the top four most common diagnoses since 1 year ago.

SQL:
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 4
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 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 diagnoses (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

Question: how many patients are diagnosed with polyneuropathy in diabetes and treated with base drug?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Polyneuropathy in diabetes" AND prescriptions.drug_type = "BASE"

Question: what is drug type of drug name cephalexin?

SQL:
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Cephalexin"
Schema:
CREATE TABLE table_name_43 (
    career_sr VARCHAR
)

Question: What is the career SR with a 1r in 1985?

SQL:
SELECT career_sr FROM table_name_43 WHERE 1985 = "1r"
Schema:
CREATE TABLE table_1341453_7 (
    party VARCHAR,
    first_elected VARCHAR
)

Question: What party was first elected in 1974?

SQL:
SELECT party FROM table_1341453_7 WHERE first_elected = 1974
Schema:
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
)

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
)

Question: count the number of patients whose insurance is government and procedure short title is rt/left heart card cath?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.short_title = "Rt/left heart card cath"

Question: what is lab test name of subject name kelly gallardo?

SQL:
SELECT lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Kelly Gallardo"
Schema:
CREATE TABLE table_name_45 (
    attendance INTEGER,
    leading_scorer VARCHAR,
    date VARCHAR
)

Question: How many attended the game on 12/17 with stephen jackson as the leading scorer?

SQL:
SELECT SUM(attendance) FROM table_name_45 WHERE leading_scorer = "stephen jackson" AND date = "12/17"
Schema:
CREATE TABLE table_204_722 (
    id number,
    "season" text,
    "series" text,
    "team" text,
    "races" number,
    "wins" number,
    "poles" number,
    "f/lap" number,
    "podiums" number,
    "points" number,
    "position" text
)

Question: what is the least number of points that daly won in a single seasons

SQL:
SELECT MIN("points") FROM table_204_722
Schema:
CREATE TABLE volume (
    Volume_ID int,
    Volume_Issue text,
    Issue_Date text,
    Weeks_on_Top real,
    Song text,
    Artist_ID int
)

CREATE TABLE music_festival (
    ID int,
    Music_Festival text,
    Date_of_ceremony text,
    Category text,
    Volume int,
    Result text
)

CREATE TABLE artist (
    Artist_ID int,
    Artist text,
    Age int,
    Famous_Title text,
    Famous_Release_date text
)

Question: Return the number of the categories of music festivals that have the result 'Awarded'.

SQL:
SELECT Category, COUNT(Category) FROM music_festival WHERE Result = "Awarded" GROUP BY Category
Schema:
CREATE TABLE table_31228 (
    "Skip (Club)" text,
    "W" real,
    "L" real,
    "PF" real,
    "PA" real,
    "Ends Won" real,
    "Ends Lost" real,
    "Blank Ends" real,
    "Stolen Ends" real
)

Question: What is listed under L when the ends won is 21?

SQL:
SELECT MAX("L") FROM table_31228 WHERE "Ends Won" = '21'
Schema:
CREATE TABLE table_15803 (
    "Riding" text,
    "Candidate's Name" text,
    "Gender" text,
    "Residence" text,
    "Occupation" text,
    "Votes" real,
    "Rank" text
)

Question: What job is at red bank?

SQL:
SELECT "Occupation" FROM table_15803 WHERE "Residence" = 'red bank'
Schema:
CREATE TABLE table_59579 (
    "Tie no" text,
    "Home team" text,
    "Score" text,
    "Away team" text,
    "Date" text
)

Question: What is the score of the game against away team queens park rangers on 23 january 1982?

SQL:
SELECT "Score" FROM table_59579 WHERE "Date" = '23 january 1982' AND "Away team" = 'queens park rangers'
Schema:
CREATE TABLE table_1845 (
    "Date(s)" text,
    "Venue" text,
    "City, state" text,
    "Ticket price(s)" text,
    "Ticket sold / available" text,
    "Ticket grossing" text
)

Question: How much do the tickets cost for August 7, 1987?

SQL:
SELECT "Ticket price(s)" FROM table_1845 WHERE "Date(s)" = 'August 7, 1987'
Schema:
CREATE TABLE table_63272 (
    "Name" text,
    "Games" text,
    "A-League" text,
    "Finals" text,
    "Goals" real,
    "Assists" real,
    "Years" text
)

Question: How many finals had more than 0 goals and 8 assists?

SQL:
SELECT "Finals" FROM table_63272 WHERE "Goals" > '0' AND "Assists" = '8'
Schema:
CREATE TABLE table_71765 (
    "Year" real,
    "Men's singles" text,
    "Women's singles" text,
    "Men's doubles" text,
    "Women's doubles" text,
    "Mixed doubles" text
)

Question: When did Deng Xuan first win Women's singles?

SQL:
SELECT MIN("Year") FROM table_71765 WHERE "Women's singles" = 'deng xuan'
Schema:
CREATE TABLE table_55219 (
    "Home team" text,
    "Home team score" text,
    "Away team" text,
    "Away team score" text,
    "Venue" text,
    "Crowd" real,
    "Date" text
)

Question: Who is the away team that played home team Footscray?

SQL:
SELECT "Away team" FROM table_55219 WHERE "Home team" = 'footscray'
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 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 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: provide the number of patients whose admission year is less than 2133 and drug route is po?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2133" AND prescriptions.route = "PO"
Schema:
CREATE TABLE table_12517 (
    "Rank" real,
    "Name" text,
    "Team" text,
    "Goals" real,
    "Appearances" real,
    "Minutes played" text
)

Question: What Rank has a Team of roma?

SQL:
SELECT "Rank" FROM table_12517 WHERE "Team" = 'roma'
Schema:
CREATE TABLE table_name_50 (
    population INTEGER,
    area_km_2 VARCHAR,
    official_name VARCHAR
)

Question: What is the population of northfield parish that has an area less than 342.4?

SQL:
SELECT SUM(population) FROM table_name_50 WHERE area_km_2 < 342.4 AND official_name = "northfield"
Schema:
CREATE TABLE table_54515 (
    "Driver" text,
    "Constructor" text,
    "Laps" real,
    "Time/Retired" text,
    "Grid" real
)

Question: In what grid did Richard Robarts make 36 laps?

SQL:
SELECT SUM("Grid") FROM table_54515 WHERE "Driver" = 'richard robarts' AND "Laps" < '36'