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

Question: how many patients whose admission type is urgent and primary disease is mesenteric ischemia?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.diagnosis = "MESENTERIC ISCHEMIA"
Schema:
CREATE TABLE table_name_15 (
    right_ascension___j2000__ VARCHAR,
    object_type VARCHAR,
    apparent_magnitude VARCHAR
)

Question: What is the Right ascension of the Object type spiral galaxy that has an Apparent magnitude larger that 12.2

SQL:
SELECT right_ascension___j2000__ FROM table_name_15 WHERE object_type = "spiral galaxy" AND apparent_magnitude > 12.2
Schema:
CREATE TABLE table_30586 (
    "Stage" real,
    "Winner" text,
    "General classification" text,
    "Points classification" text,
    "Mountains classification" text,
    "Young rider classification" text
)

Question: Who was the young rider classification when Alessandro Petacchi won?

SQL:
SELECT "Young rider classification" FROM table_30586 WHERE "Winner" = 'Alessandro Petacchi'
Schema:
CREATE TABLE table_name_24 (
    status VARCHAR,
    newspaper_magazine VARCHAR
)

Question: What is Status, when Newspaper/Magazine is Al-Thawra?

SQL:
SELECT status FROM table_name_24 WHERE newspaper_magazine = "al-thawra"
Schema:
CREATE TABLE table_name_89 (
    result VARCHAR,
    date VARCHAR
)

Question: Where Date is september 13, 1998 what is result?

SQL:
SELECT result FROM table_name_89 WHERE date = "september 13, 1998"
Schema:
CREATE TABLE table_28657 (
    "Name / designation" text,
    "Year of introduction" text,
    "Country of origin" text,
    "Primary cartridge" text,
    "primary user" text
)

Question: If the Country of Origin is Denmark and the year of introduction is 1962, what is the primary cartridge?

SQL:
SELECT "Primary cartridge" FROM table_28657 WHERE "Year of introduction" = '1962' AND "Country of origin" = 'Denmark'
Schema:
CREATE TABLE table_79697 (
    "Rank" real,
    "Name" text,
    "1st run" text,
    "2nd run" text,
    "3rd run" text,
    "Total" real
)

Question: Which 3rd run has rank of 8?

SQL:
SELECT "3rd run" FROM table_79697 WHERE "Rank" = '8'
Schema:
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)
)

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

Question: For all employees who have the letters D or S in their first name, a bar chart shows the distribution of hire_date and the amount of hire_date bin hire_date by time.

SQL:
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
Schema:
CREATE TABLE allergy_type (
    allergy text,
    allergytype text
)

CREATE TABLE has_allergy (
    stuid number,
    allergy text
)

CREATE TABLE student (
    stuid number,
    lname text,
    fname text,
    age number,
    sex text,
    major number,
    advisor number,
    city_code text
)

Question: What is the type of allergy Cat?

SQL:
SELECT allergytype FROM allergy_type WHERE allergy = "Cat"
Schema:
CREATE TABLE table_18796 (
    "Season" real,
    "Premiers" text,
    "Runners Up" text,
    "Score" text,
    "Captain" text,
    "Coach" text,
    "Simpson Medal" text,
    "Venue" text,
    "Attendance" real,
    "Umpires" text
)

Question: Which venue did Luke Blackwell serve as captain?

SQL:
SELECT "Venue" FROM table_18796 WHERE "Captain" = 'Luke Blackwell'
Schema:
CREATE TABLE table_55351 (
    "Driver" text,
    "Constructor" text,
    "Laps" real,
    "Time/Retired" text,
    "Grid" real
)

Question: When the driver peter gethin has a grid less than 25, what is the average number of laps?

SQL:
SELECT AVG("Laps") FROM table_55351 WHERE "Driver" = 'peter gethin' AND "Grid" < '25'
Schema:
CREATE TABLE table_35910 (
    "Date" text,
    "Visitor" text,
    "Score" text,
    "Home" text,
    "Leading scorer" text,
    "Attendance" real,
    "Record" text
)

Question: How many people attended the game when Larry Hughes(33) was the leading scorer and cleveland was visiting?

SQL:
SELECT SUM("Attendance") FROM table_35910 WHERE "Visitor" = 'cleveland' AND "Leading scorer" = 'larry hughes(33)'
Schema:
CREATE TABLE table_489 (
    "Celebrity" text,
    "Background" text,
    "Original Team" text,
    "Age" real,
    "Hometown" text,
    "Charity" text,
    "Result" text,
    "Raised" text
)

Question: What is the original team of the celebrity who had the result 08 fired in week 10 (2008-03-06)

SQL:
SELECT "Original Team" FROM table_489 WHERE "Result" = '08 Fired in week 10 (2008-03-06)'
Schema:
CREATE TABLE table_204_265 (
    id number,
    "no." number,
    "title (latin)" text,
    "title (english translation)" text,
    "subject" text,
    "date" text
)

Question: what is the total number of title ?

SQL:
SELECT COUNT("subject") FROM table_204_265
Schema:
CREATE TABLE table_204_1 (
    id number,
    "season" text,
    "north" text,
    "south" text,
    "east" text,
    "west" text
)

Question: who won the south after esc geretsried did during the 2006-07 season ?

SQL:
SELECT "south" FROM table_204_1 WHERE id = (SELECT id FROM table_204_1 WHERE "south" = 'esc geretsried') + 1
Schema:
CREATE TABLE table_44900 (
    "Team" text,
    "Coach" text,
    "Home Ground" text,
    "Location" text,
    "Founded" real
)

Question: Where is the home ground for the club coached by nick pantsaras and founded before 1946?

SQL:
SELECT "Home Ground" FROM table_44900 WHERE "Founded" < '1946' AND "Coach" = 'nick pantsaras'
Schema:
CREATE TABLE table_name_82 (
    year INTEGER,
    tyres VARCHAR,
    chassis VARCHAR
)

Question: How many years were g Tyres and Minardi m187 used?

SQL:
SELECT AVG(year) FROM table_name_82 WHERE tyres = "g" AND chassis = "minardi m187"
Schema:
CREATE TABLE table_78664 (
    "Week" text,
    "Date" text,
    "Opponent" text,
    "Result" text,
    "Location" text
)

Question: What was the result of the game against the Miami Dolphins held at the Riverfront Stadium?

SQL:
SELECT "Result" FROM table_78664 WHERE "Location" = 'riverfront stadium' AND "Opponent" = 'miami dolphins'
Schema:
CREATE TABLE table_20709 (
    "Number in series" real,
    "Broadcast Order" text,
    "Title" text,
    "Directed by" text,
    "Written by" text,
    "Original airdate" text,
    "Production Code" real
)

Question: Who directed the totle 'tjockare n vatten'?

SQL:
SELECT "Directed by" FROM table_20709 WHERE "Title" = 'Tjockare än vatten'
Schema:
CREATE TABLE table_44491 (
    "Archbishop" text,
    "Born" text,
    "Ordained Priest" text,
    "Ordained Bishop" text,
    "Appointed Archbishop" text,
    "Vacated throne" text,
    "Died" text
)

Question: When did the archbishop that was ordained a bishop on July 25, 1902 die?

SQL:
SELECT "Died" FROM table_44491 WHERE "Ordained Bishop" = 'july 25, 1902'
Schema:
CREATE TABLE table_17829 (
    "City/Town" text,
    "July av. T" text,
    "Rain" text,
    "Days with rain (year/summer)" text,
    "Days with frost" real,
    "Sunlight hours" real
)

Question: How many rain figures are provided for sunlight hours in 1966?

SQL:
SELECT COUNT("Rain") FROM table_17829 WHERE "Sunlight hours" = '1966'
Schema:
CREATE TABLE round (
    Round_ID int,
    Member_ID int,
    Decoration_Theme text,
    Rank_in_Round int
)

CREATE TABLE member (
    Member_ID int,
    Name text,
    Country text,
    College_ID int
)

CREATE TABLE college (
    College_ID int,
    Name text,
    Leader_Name text,
    College_Location text
)

Question: Show the different countries and the number of members from each with a bar chart, rank by the bar in ascending.

SQL:
SELECT Country, COUNT(*) FROM member GROUP BY Country ORDER BY Country
Schema:
CREATE TABLE candidate (
    Candidate_ID int,
    People_ID int,
    Poll_Source text,
    Date text,
    Support_rate real,
    Consider_rate real,
    Oppose_rate real,
    Unsure_rate real
)

CREATE TABLE people (
    People_ID int,
    Sex text,
    Name text,
    Date_of_Birth text,
    Height real,
    Weight real
)

Question: Bar chart of total number of height from each sex

SQL:
SELECT Sex, SUM(Height) FROM people GROUP BY Sex
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 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 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
)

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

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 the first time until 05/2100 patient 002-52932 was prescribed a medication via a misc route?

SQL:
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-52932')) AND medication.routeadmin = 'misc' AND STRFTIME('%y-%m', medication.drugstarttime) <= '2100-05' ORDER BY medication.drugstarttime LIMIT 1
Schema:
CREATE TABLE table_802 (
    "Game" real,
    "Date" text,
    "Team" text,
    "Score" text,
    "High points" text,
    "High rebounds" text,
    "High assists" text,
    "Location Attendance" text,
    "Record" text
)

Question: how many times have there been helps by damon stoudamire (13)

SQL:
SELECT COUNT("Record") FROM table_802 WHERE "High assists" = 'Damon Stoudamire (13)'
Schema:
CREATE TABLE countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,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 jobs (
    JOB_ID varchar(10),
    JOB_TITLE varchar(35),
    MIN_SALARY decimal(6,0),
    MAX_SALARY decimal(6,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 regions (
    REGION_ID decimal(5,0),
    REGION_NAME varchar(25)
)

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

Question: For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the sum of employee_id , and group by attribute job_id, and sort y axis in ascending order.

SQL:
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID)
Schema:
CREATE TABLE table_name_13 (
    date VARCHAR,
    director VARCHAR
)

Question: When was the film directed by Pen-Ek Ratanaruang released?

SQL:
SELECT date FROM table_name_13 WHERE director = "pen-ek ratanaruang"
Schema:
CREATE TABLE table_52741 (
    "Rank" real,
    "Rider" text,
    "Team" text,
    "Speed" text,
    "Time" text
)

Question: Which rider had a speed of 104.630mph?

SQL:
SELECT "Rider" FROM table_52741 WHERE "Speed" = '104.630mph'
Schema:
CREATE TABLE table_204_340 (
    id number,
    "name" text,
    "year inducted" number,
    "position" text,
    "apps" number,
    "goals" number
)

Question: what is the total number of apps and goals for luther blissett ?

SQL:
SELECT "apps" + "goals" FROM table_204_340 WHERE "name" = 'luther blissett'
Schema:
CREATE TABLE table_name_21 (
    driver_s_ VARCHAR,
    primary_sponsor_s_ VARCHAR
)

Question: Parts Plus sponsors what driver?

SQL:
SELECT driver_s_ FROM table_name_21 WHERE primary_sponsor_s_ = "parts plus"
Schema:
CREATE TABLE table_name_65 (
    place VARCHAR,
    performance VARCHAR
)

Question: What is the place when the performance is 60.73m?

SQL:
SELECT place FROM table_name_65 WHERE performance = "60.73m"
Schema:
CREATE TABLE table_name_35 (
    year VARCHAR,
    producer VARCHAR
)

Question: What year was Sam Kazman a producer?

SQL:
SELECT year FROM table_name_35 WHERE producer = "sam kazman"
Schema:
CREATE TABLE table_203_254 (
    id number,
    "position" number,
    "team" text,
    "points" number,
    "played" number,
    "won" number,
    "drawn" number,
    "lost" number,
    "for" number,
    "against" number,
    "difference" number
)

Question: which team had the largest goal difference ?

SQL:
SELECT "team" FROM table_203_254 ORDER BY ABS("difference") DESC LIMIT 1
Schema:
CREATE TABLE table_13239 (
    "Position" text,
    "Player" text,
    "Loaned to" text,
    "Date" text,
    "Loan expires" text
)

Question: What loan expires date has a Date of 29 december 2003?

SQL:
SELECT "Loan expires" FROM table_13239 WHERE "Date" = '29 december 2003'
Schema:
CREATE TABLE table_9885 (
    "Outcome" text,
    "Year" real,
    "Championship" text,
    "Surface" text,
    "Partner" text,
    "Opponents in the final" text,
    "Score in the final" text
)

Question: Who was the partner that played against Serena Williams Venus Williams?

SQL:
SELECT "Partner" FROM table_9885 WHERE "Opponents in the final" = 'serena williams venus williams'
Schema:
CREATE TABLE party (
    party_name VARCHAR,
    party_id VARCHAR
)

CREATE TABLE Member (
    party_id VARCHAR
)

Question: What is the name of party with most number of members?

SQL:
SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1
Schema:
CREATE TABLE table_28631 (
    "Channel" real,
    "Channel name" text,
    "Callsign" text,
    "Signal power" text,
    "Broadcast area" text
)

Question: What is the call sign for channel 6?

SQL:
SELECT "Callsign" FROM table_28631 WHERE "Channel" = '6'
Schema:
CREATE TABLE table_42037 (
    "Date" text,
    "Score" text,
    "Set 1" text,
    "Set 2" text,
    "Set 3" text,
    "Set 4" text,
    "Set 5" text,
    "Total" text
)

Question: What date has a set 4 of 25-19?

SQL:
SELECT "Date" FROM table_42037 WHERE "Set 4" = '25-19'
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 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 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: get me the number of patients suffering from celo-vessicle fistula primary disease.

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CELO-VESSICLE FISTULA"

Question: provide the number of patients whose diagnoses long title is antineoplastic and immunosuppressive drugs causing adverse effects in therapeutic use and drug type is main?

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 = "Antineoplastic and immunosuppressive drugs causing adverse effects in therapeutic use" AND prescriptions.drug_type = "MAIN"

Question: what is the drug route of Ascorbic acid?

SQL:
SELECT prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Ascorbic Acid"

Question: how many patients were admitted before the year 2135 under procedure icd9 code 3893?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2135" AND procedures.icd9_code = "3893"
Schema:
CREATE TABLE table_9027 (
    "Name" text,
    "GP-GS" text,
    "Effic" real,
    "Att-Cmp-Int" text,
    "Avg/G" real
)

Question: What was the total effic for the quarterbacks?

SQL:
SELECT MIN("Effic") FROM table_9027 WHERE "Name" = 'total'
Schema:
CREATE TABLE table_name_78 (
    civil_liberties INTEGER,
    year VARCHAR,
    political_rights VARCHAR,
    president VARCHAR
)

Question: When the president was Yoweri Museveni, and the year was 1993, with rank of 6 under political rights, what was the total of civil liberties?

SQL:
SELECT SUM(civil_liberties) FROM table_name_78 WHERE political_rights = 6 AND president = "yoweri museveni" AND year = 1993
Schema:
CREATE TABLE table_31955 (
    "Points" real,
    "Name" text,
    "Club" text,
    "Tries" real,
    "Drop" real
)

Question: Name the fewest tries for leicester tigers with points less than 207

SQL:
SELECT MIN("Tries") FROM table_31955 WHERE "Club" = 'leicester tigers' AND "Points" < '207'
Schema:
CREATE TABLE Addresses (
    address_id INTEGER,
    line_1 VARCHAR(120),
    line_2 VARCHAR(120),
    line_3 VARCHAR(120),
    city VARCHAR(80),
    zip_postcode VARCHAR(20),
    state_province_county VARCHAR(50),
    country VARCHAR(50),
    other_address_details VARCHAR(255)
)

CREATE TABLE Students_in_Detention (
    student_id INTEGER,
    detention_id INTEGER,
    incident_id INTEGER
)

CREATE TABLE Behavior_Incident (
    incident_id INTEGER,
    incident_type_code VARCHAR(10),
    student_id INTEGER,
    date_incident_start DATETIME,
    date_incident_end DATETIME,
    incident_summary VARCHAR(255),
    recommendations VARCHAR(255),
    other_details VARCHAR(255)
)

CREATE TABLE Ref_Detention_Type (
    detention_type_code VARCHAR(10),
    detention_type_description VARCHAR(80)
)

CREATE TABLE Assessment_Notes (
    notes_id INTEGER,
    student_id INTEGER,
    teacher_id INTEGER,
    date_of_notes DATETIME,
    text_of_notes VARCHAR(255),
    other_details VARCHAR(255)
)

CREATE TABLE Ref_Address_Types (
    address_type_code VARCHAR(15),
    address_type_description VARCHAR(80)
)

CREATE TABLE Teachers (
    teacher_id INTEGER,
    address_id INTEGER,
    first_name VARCHAR(80),
    middle_name VARCHAR(80),
    last_name VARCHAR(80),
    gender VARCHAR(1),
    cell_mobile_number VARCHAR(40),
    email_address VARCHAR(40),
    other_details VARCHAR(255)
)

CREATE TABLE Student_Addresses (
    student_id INTEGER,
    address_id INTEGER,
    date_address_from DATETIME,
    date_address_to DATETIME,
    monthly_rental DECIMAL(19,4),
    other_details VARCHAR(255)
)

CREATE TABLE Detention (
    detention_id INTEGER,
    detention_type_code VARCHAR(10),
    teacher_id INTEGER,
    datetime_detention_start DATETIME,
    datetime_detention_end DATETIME,
    detention_summary VARCHAR(255),
    other_details VARCHAR(255)
)

CREATE TABLE Students (
    student_id INTEGER,
    address_id INTEGER,
    first_name VARCHAR(80),
    middle_name VARCHAR(40),
    last_name VARCHAR(40),
    cell_mobile_number VARCHAR(40),
    email_address VARCHAR(40),
    date_first_rental DATETIME,
    date_left_university DATETIME,
    other_student_details VARCHAR(255)
)

CREATE TABLE Ref_Incident_Type (
    incident_type_code VARCHAR(10),
    incident_type_description VARCHAR(80)
)

Question: Find other_details and the sum of monthly_rental , and group by attribute other_details, and visualize them by a bar chart.

SQL:
SELECT other_details, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
Schema:
CREATE TABLE table_2668401_17 (
    district VARCHAR,
    incumbent VARCHAR
)

Question: In what district was the incumbent Edwin Gray?

SQL:
SELECT district FROM table_2668401_17 WHERE incumbent = "Edwin Gray"
Schema:
CREATE TABLE table_64172 (
    "Year" real,
    "Game" text,
    "Genre" text,
    "Platform(s)" text,
    "Developer(s)" text
)

Question: What year was the developer(s) Bioware?

SQL:
SELECT AVG("Year") FROM table_64172 WHERE "Developer(s)" = 'bioware'