VishalCh/book-train huggingface dataset:
Schema:
CREATE TABLE train (
    Train_ID int,
    Train_Num text,
    Name text,
    From text,
    Arrival text,
    Railway_ID int
)

CREATE TABLE railway (
    Railway_ID int,
    Railway text,
    Builder text,
    Built text,
    Wheels text,
    Location text,
    ObjectNumber text
)

CREATE TABLE railway_manage (
    Railway_ID int,
    Manager_ID int,
    From_Year text
)

CREATE TABLE manager (
    Manager_ID int,
    Name text,
    Country text,
    Working_year_starts text,
    Age int,
    Level int
)

Question: Show the number of the countries that have managers of age above 50 or below 46.

SQL:
SELECT Country, COUNT(Country) FROM manager WHERE Age > 50 OR Age < 46 GROUP BY Country
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 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
)

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 patients whose admission type is emergency and diagnoses icd9 code is 56210?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.icd9_code = "56210"

Question: what is the number of patients whose marital status is widowed and procedure icd9 code is 4105?

SQL:
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.icd9_code = "4105"
Schema:
CREATE TABLE table_71388 (
    "Goal" real,
    "Date" text,
    "Score" text,
    "Result" text,
    "Competition" text
)

Question: What was the date of the game that had a goal of 3?

SQL:
SELECT "Date" FROM table_71388 WHERE "Goal" = '3'
Schema:
CREATE TABLE table_name_88 (
    abbreviation VARCHAR,
    country VARCHAR
)

Question: What's the abbreviation for libya?

SQL:
SELECT abbreviation FROM table_name_88 WHERE country = "libya"
Schema:
CREATE TABLE table_name_89 (
    game VARCHAR,
    opponent VARCHAR
)

Question: What is the total number of games for the opponent in Washington?

SQL:
SELECT COUNT(game) FROM table_name_89 WHERE opponent = "washington"
Schema:
CREATE TABLE table_name_45 (
    opponent VARCHAR,
    game VARCHAR,
    march VARCHAR
)

Question: Which opponent's game was less than 76 when the march was 10?

SQL:
SELECT opponent FROM table_name_45 WHERE game < 76 AND march = 10
Schema:
CREATE TABLE table_58371 (
    "Year" text,
    "Start" text,
    "Qual" text,
    "Rank" text,
    "Finish" text,
    "Laps" real
)

Question: What finish time started at 32?

SQL:
SELECT "Finish" FROM table_58371 WHERE "Start" = '32'
Schema:
CREATE TABLE regions (
    REGION_ID decimal(5,0),
    REGION_NAME varchar(25)
)

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

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

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

CREATE TABLE 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 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 job_history (
    EMPLOYEE_ID decimal(6,0),
    START_DATE date,
    END_DATE date,
    JOB_ID varchar(10),
    DEPARTMENT_ID decimal(4,0)
)

Question: For those employees who did not have any job in the past, find hire_date and the amount of hire_date bin hire_date by time, and visualize them by a bar chart.

SQL:
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
Schema:
CREATE TABLE table_name_89 (
    player VARCHAR,
    position VARCHAR,
    loaned_to VARCHAR
)

Question: What player that has a Position of df, and Loaned to is Stoke City?

SQL:
SELECT player FROM table_name_89 WHERE position = "df" AND loaned_to = "stoke city"
Schema:
CREATE TABLE table_28053 (
    "Episode no." real,
    "Airdate" text,
    "Dave Viewers" real,
    "Dave Rank" real,
    "Rank (cable)" real,
    "Dave ja vu Viewers" real,
    "Total viewers" real
)

Question: What is the highest number of dave viewers of an episode with 119000 dave ja vu viewers?

SQL:
SELECT MAX("Dave Viewers") FROM table_28053 WHERE "Dave ja vu Viewers" = '119000'
Schema:
CREATE TABLE student (
    ID varchar(5),
    name varchar(20),
    dept_name varchar(20),
    tot_cred numeric(3,0)
)

CREATE TABLE teaches (
    ID varchar(5),
    course_id varchar(8),
    sec_id varchar(8),
    semester varchar(6),
    year numeric(4,0)
)

CREATE TABLE course (
    course_id varchar(8),
    title varchar(50),
    dept_name varchar(20),
    credits numeric(2,0)
)

CREATE TABLE instructor (
    ID varchar(5),
    name varchar(20),
    dept_name varchar(20),
    salary numeric(8,2)
)

CREATE TABLE takes (
    ID varchar(5),
    course_id varchar(8),
    sec_id varchar(8),
    semester varchar(6),
    year numeric(4,0),
    grade varchar(2)
)

CREATE TABLE classroom (
    building varchar(15),
    room_number varchar(7),
    capacity numeric(4,0)
)

CREATE TABLE section (
    course_id varchar(8),
    sec_id varchar(8),
    semester varchar(6),
    year numeric(4,0),
    building varchar(15),
    room_number varchar(7),
    time_slot_id varchar(4)
)

CREATE TABLE time_slot (
    time_slot_id varchar(4),
    day varchar(1),
    start_hr numeric(2),
    start_min numeric(2),
    end_hr numeric(2),
    end_min numeric(2)
)

CREATE TABLE prereq (
    course_id varchar(8),
    prereq_id varchar(8)
)

CREATE TABLE department (
    dept_name varchar(20),
    building varchar(15),
    budget numeric(12,2)
)

CREATE TABLE advisor (
    s_ID varchar(5),
    i_ID varchar(5)
)

Question: Bar chart of mean salary from each dept name, and rank by the X-axis in desc.

SQL:
SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name ORDER BY dept_name DESC
Schema:
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 medication (
    medicationid number,
    patientunitstayid number,
    drugname text,
    dosage text,
    routeadmin text,
    drugstarttime time,
    drugstoptime time
)

CREATE TABLE patient (
    uniquepid text,
    patienthealthsystemstayid number,
    patientunitstayid number,
    gender text,
    age text,
    ethnicity text,
    hospitalid number,
    wardid number,
    admissionheight number,
    admissionweight number,
    dischargeweight number,
    hospitaladmittime time,
    hospitaladmitsource text,
    unitadmittime time,
    unitdischargetime time,
    hospitaldischargetime time,
    hospitaldischargestatus text
)

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

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

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

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

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

Question: has patient 015-59552 had any milrinone intake since 06/10/2105.

SQL:
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-59552')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.celllabel = 'milrinone' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2105-06-10'
Schema:
CREATE TABLE table_16524 (
    "Year" text,
    "Champion" text,
    "Score" text,
    "Runner-Up" text,
    "Location" text,
    "Semi-Finalist #1" text,
    "Semi-Finalist #2" text
)

Question: who is the champion where semi-finalist #2 is na and location is morrisville, nc

SQL:
SELECT "Champion" FROM table_16524 WHERE "Semi-Finalist #2" = 'NA' AND "Location" = 'Morrisville, NC'
Schema:
CREATE TABLE table_203_271 (
    id number,
    "date" text,
    "series" text,
    "circuit" text,
    "city / state" text,
    "winner" text,
    "team" text,
    "car" text,
    "report" text
)

Question: mark skaife was the winnter of atcc round 1 , but what was the name of his team ?

SQL:
SELECT "team" FROM table_203_271 WHERE "series" = 'atcc round 1' AND "winner" = 'mark skaife'
Schema:
CREATE TABLE table_45213 (
    "Round" real,
    "Pick" real,
    "Player" text,
    "Position" text,
    "Nationality" text,
    "School/Club Team" text
)

Question: Who is the player in guard position from Stephen F. Austin in a round less than 8?

SQL:
SELECT "Player" FROM table_45213 WHERE "Round" < '8' AND "Position" = 'guard' AND "School/Club Team" = 'stephen f. austin'
Schema:
CREATE TABLE table_name_88 (
    stadium VARCHAR,
    final_score VARCHAR
)

Question: What stadium was the game held in when the final score was 17-31?

SQL:
SELECT stadium FROM table_name_88 WHERE final_score = "17-31"
Schema:
CREATE TABLE table_name_73 (
    acquired INTEGER,
    number VARCHAR
)

Question: What is the average Acquired when the Number shows as 7?

SQL:
SELECT AVG(acquired) FROM table_name_73 WHERE number = 7
Schema:
CREATE TABLE table_22347090_4 (
    us_viewers__million_ VARCHAR,
    no_in_season VARCHAR
)

Question: How many viewers tuned in for season 2?

SQL:
SELECT us_viewers__million_ FROM table_22347090_4 WHERE no_in_season = 2
Schema:
CREATE TABLE table_55448 (
    "Date" text,
    "Tournament" text,
    "Winning score" text,
    "To par" text,
    "Margin of victory" text,
    "Runner(s)-up" text
)

Question: When was the Masters Tournament?

SQL:
SELECT "Date" FROM table_55448 WHERE "Tournament" = 'masters tournament'
Schema:
CREATE TABLE player (
    Residence VARCHAR,
    gender VARCHAR
)

Question: Show the residences that have both a player of gender 'M' and a player of gender 'F'.

SQL:
SELECT Residence FROM player WHERE gender = "M" INTERSECT SELECT Residence FROM player WHERE gender = "F"
Schema:
CREATE TABLE table_36390 (
    "Date" text,
    "Visitor" text,
    "Score" text,
    "Home" text,
    "Decision" text,
    "Attendance" real,
    "Series" text
)

Question: How many Attendances on may 24?

SQL:
SELECT MIN("Attendance") FROM table_36390 WHERE "Date" = 'may 24'
Schema:
CREATE TABLE table_19894 (
    "Series Ep." text,
    "Episode" real,
    "Netflix" text,
    "Segment A" text,
    "Segment B" text,
    "Segment C" text,
    "Segment D" text
)

Question: In what episode was segment D ned Can Corn?

SQL:
SELECT MAX("Episode") FROM table_19894 WHERE "Segment D" = 'ned Can Corn'
Schema:
CREATE TABLE table_3916 (
    "Episode #" real,
    "Series #" real,
    "Title" text,
    "Director" text,
    "Writer" text,
    "Original airdate" text,
    "Viewers (millions)" text
)

Question: Who directed 'running the gauntlet'?

SQL:
SELECT "Director" FROM table_3916 WHERE "Title" = 'Running the Gauntlet'
Schema:
CREATE TABLE table_name_18 (
    class VARCHAR,
    behind VARCHAR
)

Question: What is the class of the team that has a behind of +44.780?

SQL:
SELECT class FROM table_name_18 WHERE behind = "+44.780"
Schema:
CREATE TABLE employees (
    employee_id VARCHAR,
    first_name VARCHAR,
    last_name VARCHAR,
    department_id VARCHAR
)

Question: display the employee number and name( first name and last name ) for all employees who work in a department with any employee whose name contains a T .

SQL:
SELECT employee_id, first_name, last_name FROM employees WHERE department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%T%')
Schema:
CREATE TABLE table_40258 (
    "Res." text,
    "Record" text,
    "Opponent" text,
    "Method" text,
    "Event" text,
    "Round" real,
    "Time" text,
    "Location" text
)

Question: What Round against Aleksander Emelianenko had a time of 5:00?

SQL:
SELECT "Round" FROM table_40258 WHERE "Time" = '5:00' AND "Opponent" = 'aleksander emelianenko'
Schema:
CREATE TABLE table_27515452_3 (
    agency VARCHAR,
    sizes VARCHAR
)

Question: which company has a person that can wear clothing in 33-23-36

SQL:
SELECT agency FROM table_27515452_3 WHERE sizes = "33-23-36"
Schema:
CREATE TABLE table_48308 (
    "Rank" text,
    "Nation" text,
    "Gold" real,
    "Silver" real,
    "Bronze" real,
    "Total" real
)

Question: Which Nation has a Gold larger than 0, and a Total larger than 4, and a Rank of 6?

SQL:
SELECT "Nation" FROM table_48308 WHERE "Gold" > '0' AND "Total" > '4' AND "Rank" = '6'
Schema:
CREATE TABLE locations (
    LOCATION_ID decimal(4,0),
    STREET_ADDRESS varchar(40),
    POSTAL_CODE varchar(12),
    CITY varchar(30),
    STATE_PROVINCE varchar(25),
    COUNTRY_ID varchar(2)
)

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

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

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

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

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

Question: For all employees who have the letters D or S in their first name, show me about the distribution of hire_date and the amount of hire_date bin hire_date by weekday in a bar chart, and rank from high to low by the Y please.

SQL:
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY COUNT(HIRE_DATE) DESC
Schema:
CREATE TABLE table_73512 (
    "Game" real,
    "Date" text,
    "Team" text,
    "Score" text,
    "High points" text,
    "High rebounds" text,
    "High assists" text,
    "Location Attendance" text,
    "Record" text
)

Question: If the record is 5-8, what is the team name?

SQL:
SELECT "Team" FROM table_73512 WHERE "Record" = '5-8'
Schema:
CREATE TABLE Subjects (
    subject_id INTEGER,
    subject_name VARCHAR(120)
)

CREATE TABLE Student_Tests_Taken (
    registration_id INTEGER,
    date_test_taken DATETIME,
    test_result VARCHAR(255)
)

CREATE TABLE Students (
    student_id INTEGER,
    date_of_registration DATETIME,
    date_of_latest_logon DATETIME,
    login_name VARCHAR(40),
    password VARCHAR(10),
    personal_name VARCHAR(40),
    middle_name VARCHAR(40),
    family_name VARCHAR(40)
)

CREATE TABLE Course_Authors_and_Tutors (
    author_id INTEGER,
    author_tutor_ATB VARCHAR(3),
    login_name VARCHAR(40),
    password VARCHAR(40),
    personal_name VARCHAR(80),
    middle_name VARCHAR(80),
    family_name VARCHAR(80),
    gender_mf VARCHAR(1),
    address_line_1 VARCHAR(80)
)

CREATE TABLE Student_Course_Enrolment (
    registration_id INTEGER,
    student_id INTEGER,
    course_id INTEGER,
    date_of_enrolment DATETIME,
    date_of_completion DATETIME
)

CREATE TABLE Courses (
    course_id INTEGER,
    author_id INTEGER,
    subject_id INTEGER,
    course_name VARCHAR(120),
    course_description VARCHAR(255)
)

Question: How many courses for each subject? Plot a bar chart, could you display bar in ascending order?

SQL:
SELECT subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY subject_name
Schema:
CREATE TABLE table_69280 (
    "Year" real,
    "Class" text,
    "Tyres" text,
    "Team" text,
    "Co-Drivers" text,
    "Laps" real,
    "Pos." text
)

Question: Are there any Teams after 1997?

SQL:
SELECT "Team" FROM table_69280 WHERE "Year" > '1997'
Schema:
CREATE TABLE table_75427 (
    "Country" text,
    "Skip" text,
    "Third" text,
    "Second" text,
    "Lead" text
)

Question: What skip has angela tuvaeva as the lead?

SQL:
SELECT "Skip" FROM table_75427 WHERE "Lead" = 'angela tuvaeva'
Schema:
CREATE TABLE Mailshot_Customers (
    mailshot_id INTEGER,
    customer_id INTEGER,
    outcome_code VARCHAR(15),
    mailshot_customer_date DATETIME
)

CREATE TABLE Products (
    product_id INTEGER,
    product_category VARCHAR(15),
    product_name VARCHAR(80)
)

CREATE TABLE Mailshot_Campaigns (
    mailshot_id INTEGER,
    product_category VARCHAR(15),
    mailshot_name VARCHAR(80),
    mailshot_start_date DATETIME,
    mailshot_end_date DATETIME
)

CREATE TABLE Premises (
    premise_id INTEGER,
    premises_type VARCHAR(15),
    premise_details VARCHAR(255)
)

CREATE TABLE Order_Items (
    item_id INTEGER,
    order_item_status_code VARCHAR(15),
    order_id INTEGER,
    product_id INTEGER,
    item_status_code VARCHAR(15),
    item_delivered_datetime DATETIME,
    item_order_quantity VARCHAR(80)
)

CREATE TABLE Customer_Addresses (
    customer_id INTEGER,
    premise_id INTEGER,
    date_address_from DATETIME,
    address_type_code VARCHAR(15),
    date_address_to DATETIME
)

CREATE TABLE Customers (
    customer_id INTEGER,
    payment_method VARCHAR(15),
    customer_name VARCHAR(80),
    customer_phone VARCHAR(80),
    customer_email VARCHAR(80),
    customer_address VARCHAR(255),
    customer_login VARCHAR(80),
    customer_password VARCHAR(10)
)

CREATE TABLE Customer_Orders (
    order_id INTEGER,
    customer_id INTEGER,
    order_status_code VARCHAR(15),
    shipping_method_code VARCHAR(15),
    order_placed_datetime DATETIME,
    order_delivered_datetime DATETIME,
    order_shipping_charges VARCHAR(255)
)

Question: Create a pie chart showing the total number across outcome code.

SQL:
SELECT outcome_code, COUNT(*) FROM Mailshot_Customers GROUP BY outcome_code
Schema:
CREATE TABLE table_name_95 (
    home VARCHAR,
    score VARCHAR
)

Question: What is Home, when Score is 103-93?

SQL:
SELECT home FROM table_name_95 WHERE score = "103-93"
Schema:
CREATE TABLE table_name_11 (
    television_service VARCHAR,
    hdtv VARCHAR,
    language VARCHAR
)

Question: What is Television Service, when HDTV is No, and when Language is Italian?

SQL:
SELECT television_service FROM table_name_11 WHERE hdtv = "no" AND language = "italian"
Schema:
CREATE TABLE Transactions (
    transaction_id INTEGER,
    investor_id INTEGER,
    transaction_type_code VARCHAR(10),
    date_of_transaction DATETIME,
    amount_of_transaction DECIMAL(19,4),
    share_count VARCHAR(40),
    other_details VARCHAR(255)
)

CREATE TABLE Transactions_Lots (
    transaction_id INTEGER,
    lot_id INTEGER
)

CREATE TABLE Lots (
    lot_id INTEGER,
    investor_id INTEGER,
    lot_details VARCHAR(255)
)

CREATE TABLE Sales (
    sales_transaction_id INTEGER,
    sales_details VARCHAR(255)
)

CREATE TABLE Purchases (
    purchase_transaction_id INTEGER,
    purchase_details VARCHAR(255)
)

CREATE TABLE Investors (
    investor_id INTEGER,
    Investor_details VARCHAR(255)
)

CREATE TABLE Ref_Transaction_Types (
    transaction_type_code VARCHAR(10),
    transaction_type_description VARCHAR(80)
)

Question: Bin all date of transactions into the YEAR interval, and give the average of the share count for each bin. What is the trend?

SQL:
SELECT date_of_transaction, AVG(share_count) FROM Transactions
Schema:
CREATE TABLE table_3005915_3 (
    starts INTEGER
)

Question: What is the maximum number of starts?

SQL:
SELECT MAX(starts) FROM table_3005915_3
Schema:
CREATE TABLE table_24524 (
    "No." real,
    "Date" text,
    "Tournament" text,
    "Winning score" text,
    "To par" text,
    "Margin of victory" text,
    "Runner(s)-up" text
)

Question: Margin of victory on no. 4 was?

SQL:
SELECT "Margin of victory" FROM table_24524 WHERE "No." = '4'
Schema:
CREATE TABLE table_name_56 (
    original_broadway_cast VARCHAR,
    original_west_end_cast VARCHAR
)

Question: What is the name of the person who was in the Original Broadway Cast that was Original West End Cast of sheila hancock?

SQL:
SELECT original_broadway_cast FROM table_name_56 WHERE original_west_end_cast = "sheila hancock"
Schema:
CREATE TABLE table_204_35 (
    id number,
    "season" text,
    "tier" number,
    "division" text,
    "place" text
)

Question: did they place better in 1987/88 or 1993/94 ?

SQL:
SELECT "season" FROM table_204_35 WHERE "season" IN ('1987/88', '1993/94') ORDER BY "place" LIMIT 1
Schema:
CREATE TABLE department (
    Department_ID int,
    Name text,
    Creation text,
    Ranking int,
    Budget_in_Billions real,
    Num_Employees real
)

CREATE TABLE head (
    head_ID int,
    name text,
    born_state text,
    age real
)

CREATE TABLE management (
    department_ID int,
    head_ID int,
    temporary_acting text
)

Question: Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes' Visualize by bar chart, list from high to low by the Y.

SQL:
SELECT Name, AVG(Num_Employees) FROM department AS T1 JOIN management AS T2 ON T1.department_ID = T2.department_ID WHERE T2.temporary_acting = 'Yes' GROUP BY Name ORDER BY AVG(Num_Employees) DESC
Schema:
CREATE TABLE table_name_12 (
    class VARCHAR,
    rank VARCHAR
)

Question: Tell me the class with rank of 89th

SQL:
SELECT class FROM table_name_12 WHERE rank = "89th"
Schema:
CREATE TABLE table_55144 (
    "Title" text,
    "Publisher" text,
    "First Year" text,
    "Last Year" text,
    "Genre" text
)

Question: What is the first year for Popgun?

SQL:
SELECT "First Year" FROM table_55144 WHERE "Title" = 'popgun'
Schema:
CREATE TABLE table_38210 (
    "Character Name" text,
    "Voice Actor (Japanese)" text,
    "Voice Actor (English 1997 / Saban)" text,
    "Voice Actor (English 1998 / Pioneer)" text,
    "Voice Actor (English 2006 / FUNimation)" text
)

Question: what character did Masaharu satou play

SQL:
SELECT "Character Name" FROM table_38210 WHERE "Voice Actor (Japanese)" = 'masaharu satou'