Instruction: when was patient 015-96048 last prescribed for tylenol on their last hospital visit?

Input:
CREATE TABLE intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime 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
)

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

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

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

Response: 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 = '015-96048' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)) AND medication.drugname = 'tylenol' ORDER BY medication.drugstarttime DESC LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: when was patient 015-96048 last prescribed for tylenol on their last hospital visit? ### Input: CREATE TABLE intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime 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
)

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

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

CREATE TABLE microlab (
    microlabid number,
    patientunitstayid number,
    culturesite text,
    organism text,
    culturetakentime 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 treatment (
    treatmentid number,
    patientunitstayid number,
    treatmentname text,
    treatmenttime time
) ### Response: 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 = '015-96048' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)) AND medication.drugname = 'tylenol' ORDER BY medication.drugstarttime DESC LIMIT 1


Instruction: What is the incumbent for pennsylvania 15

Input:
CREATE TABLE table_1342013_37 (
    incumbent VARCHAR,
    district VARCHAR
)

Response: SELECT incumbent FROM table_1342013_37 WHERE district = "Pennsylvania 15"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the incumbent for pennsylvania 15 ### Input: CREATE TABLE table_1342013_37 (
    incumbent VARCHAR,
    district VARCHAR
) ### Response: SELECT incumbent FROM table_1342013_37 WHERE district = "Pennsylvania 15"


Instruction: At what Venue was the Home team score 17.19 (121)?

Input:
CREATE TABLE table_55019 (
    "Home team" text,
    "Home team score" text,
    "Away team" text,
    "Away team score" text,
    "Venue" text,
    "Crowd" real,
    "Date" text
)

Response: SELECT "Venue" FROM table_55019 WHERE "Home team score" = '17.19 (121)'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: At what Venue was the Home team score 17.19 (121)? ### Input: CREATE TABLE table_55019 (
    "Home team" text,
    "Home team score" text,
    "Away team" text,
    "Away team score" text,
    "Venue" text,
    "Crowd" real,
    "Date" text
) ### Response: SELECT "Venue" FROM table_55019 WHERE "Home team score" = '17.19 (121)'


Instruction: What was the playoff result where the league did not qualify in the Open Cup in 1998?

Input:
CREATE TABLE table_2402864_1 (
    playoffs VARCHAR,
    open_cup VARCHAR,
    year VARCHAR
)

Response: SELECT playoffs FROM table_2402864_1 WHERE open_cup = "Did not qualify" AND year = 1998

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the playoff result where the league did not qualify in the Open Cup in 1998? ### Input: CREATE TABLE table_2402864_1 (
    playoffs VARCHAR,
    open_cup VARCHAR,
    year VARCHAR
) ### Response: SELECT playoffs FROM table_2402864_1 WHERE open_cup = "Did not qualify" AND year = 1998


Instruction: Who was the driver in 1964?

Input:
CREATE TABLE table_name_83 (
    driver VARCHAR,
    year VARCHAR
)

Response: SELECT driver FROM table_name_83 WHERE year = "1964"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who was the driver in 1964? ### Input: CREATE TABLE table_name_83 (
    driver VARCHAR,
    year VARCHAR
) ### Response: SELECT driver FROM table_name_83 WHERE year = "1964"


Instruction: which is the first church located in los angeles ?

Input:
CREATE TABLE table_203_274 (
    id number,
    "church name" text,
    "address" text,
    "community" text,
    "school" text
)

Response: SELECT "church name" FROM table_203_274 WHERE "community" = 'los angeles' ORDER BY id LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: which is the first church located in los angeles ? ### Input: CREATE TABLE table_203_274 (
    id number,
    "church name" text,
    "address" text,
    "community" text,
    "school" text
) ### Response: SELECT "church name" FROM table_203_274 WHERE "community" = 'los angeles' ORDER BY id LIMIT 1


Instruction: what is the lowest round2 when round5 is 71 and round4 is more than 64?

Input:
CREATE TABLE table_8511 (
    "Rank" real,
    "Team" text,
    "Round1" real,
    "Round2" real,
    "Round3" real,
    "Round4" real,
    "Round5" real,
    "Total Points" real
)

Response: SELECT MIN("Round2") FROM table_8511 WHERE "Round5" = '71' AND "Round4" > '64'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the lowest round2 when round5 is 71 and round4 is more than 64? ### Input: CREATE TABLE table_8511 (
    "Rank" real,
    "Team" text,
    "Round1" real,
    "Round2" real,
    "Round3" real,
    "Round4" real,
    "Round5" real,
    "Total Points" real
) ### Response: SELECT MIN("Round2") FROM table_8511 WHERE "Round5" = '71' AND "Round4" > '64'


Instruction: What was the attendance for the game against miami dolphins?

Input:
CREATE TABLE table_66129 (
    "Week" real,
    "Date" text,
    "Opponent" text,
    "Result" text,
    "Record" text,
    "TV Time" text,
    "Attendance" text
)

Response: SELECT "Attendance" FROM table_66129 WHERE "Opponent" = 'miami dolphins'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the attendance for the game against miami dolphins? ### Input: CREATE TABLE table_66129 (
    "Week" real,
    "Date" text,
    "Opponent" text,
    "Result" text,
    "Record" text,
    "TV Time" text,
    "Attendance" text
) ### Response: SELECT "Attendance" FROM table_66129 WHERE "Opponent" = 'miami dolphins'


Instruction: What was the score of the game on December 11?

Input:
CREATE TABLE table_17360840_6 (
    score VARCHAR,
    date VARCHAR
)

Response: SELECT score FROM table_17360840_6 WHERE date = "December 11"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the score of the game on December 11? ### Input: CREATE TABLE table_17360840_6 (
    score VARCHAR,
    date VARCHAR
) ### Response: SELECT score FROM table_17360840_6 WHERE date = "December 11"


Instruction: What is the date they played against fitzroy?

Input:
CREATE TABLE table_name_10 (
    date VARCHAR,
    away_team VARCHAR
)

Response: SELECT date FROM table_name_10 WHERE away_team = "fitzroy"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the date they played against fitzroy? ### Input: CREATE TABLE table_name_10 (
    date VARCHAR,
    away_team VARCHAR
) ### Response: SELECT date FROM table_name_10 WHERE away_team = "fitzroy"


Instruction: What is the place of the song 'Never Change'?

Input:
CREATE TABLE table_40447 (
    "Draw" real,
    "Artist" text,
    "Song" text,
    "Result" text,
    "Place" real
)

Response: SELECT SUM("Place") FROM table_40447 WHERE "Song" = 'never change'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the place of the song 'Never Change'? ### Input: CREATE TABLE table_40447 (
    "Draw" real,
    "Artist" text,
    "Song" text,
    "Result" text,
    "Place" real
) ### Response: SELECT SUM("Place") FROM table_40447 WHERE "Song" = 'never change'


Instruction: For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of job_id and the amount of job_id , and group by attribute job_id, rank in descending by the the number of job id.

Input:
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 departments (
    DEPARTMENT_ID decimal(4,0),
    DEPARTMENT_NAME varchar(30),
    MANAGER_ID decimal(6,0),
    LOCATION_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 job_history (
    EMPLOYEE_ID decimal(6,0),
    START_DATE date,
    END_DATE date,
    JOB_ID varchar(10),
    DEPARTMENT_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 countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
)

Response: SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY COUNT(JOB_ID) DESC

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of job_id and the amount of job_id , and group by attribute job_id, rank in descending by the the number of job id. ### Input: 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 departments (
    DEPARTMENT_ID decimal(4,0),
    DEPARTMENT_NAME varchar(30),
    MANAGER_ID decimal(6,0),
    LOCATION_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 job_history (
    EMPLOYEE_ID decimal(6,0),
    START_DATE date,
    END_DATE date,
    JOB_ID varchar(10),
    DEPARTMENT_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 countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
) ### Response: SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY COUNT(JOB_ID) DESC


Instruction: Show the number of companies whose headquarters are not from USA fpr each main industry in a bar chart, show X-axis in ascending order please.

Input:
CREATE TABLE company (
    Company_ID int,
    Rank int,
    Company text,
    Headquarters text,
    Main_Industry text,
    Sales_billion real,
    Profits_billion real,
    Assets_billion real,
    Market_Value real
)

CREATE TABLE station_company (
    Station_ID int,
    Company_ID int,
    Rank_of_the_Year int
)

CREATE TABLE gas_station (
    Station_ID int,
    Open_Year int,
    Location text,
    Manager_Name text,
    Vice_Manager_Name text,
    Representative_Name text
)

Response: SELECT Main_Industry, COUNT(Main_Industry) FROM company WHERE Headquarters <> 'USA' GROUP BY Main_Industry ORDER BY Main_Industry

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show the number of companies whose headquarters are not from USA fpr each main industry in a bar chart, show X-axis in ascending order please. ### Input: CREATE TABLE company (
    Company_ID int,
    Rank int,
    Company text,
    Headquarters text,
    Main_Industry text,
    Sales_billion real,
    Profits_billion real,
    Assets_billion real,
    Market_Value real
)

CREATE TABLE station_company (
    Station_ID int,
    Company_ID int,
    Rank_of_the_Year int
)

CREATE TABLE gas_station (
    Station_ID int,
    Open_Year int,
    Location text,
    Manager_Name text,
    Vice_Manager_Name text,
    Representative_Name text
) ### Response: SELECT Main_Industry, COUNT(Main_Industry) FROM company WHERE Headquarters <> 'USA' GROUP BY Main_Industry ORDER BY Main_Industry


Instruction: What song placed higher than#4?

Input:
CREATE TABLE table_64035 (
    "Draw" real,
    "Artist" text,
    "Song" text,
    "Percentage" text,
    "Place" real
)

Response: SELECT "Song" FROM table_64035 WHERE "Place" > '4'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What song placed higher than#4? ### Input: CREATE TABLE table_64035 (
    "Draw" real,
    "Artist" text,
    "Song" text,
    "Percentage" text,
    "Place" real
) ### Response: SELECT "Song" FROM table_64035 WHERE "Place" > '4'


Instruction: What year was the Beaudesert suburb club founded

Input:
CREATE TABLE table_name_95 (
    founded VARCHAR,
    suburb VARCHAR
)

Response: SELECT founded FROM table_name_95 WHERE suburb = "beaudesert"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What year was the Beaudesert suburb club founded ### Input: CREATE TABLE table_name_95 (
    founded VARCHAR,
    suburb VARCHAR
) ### Response: SELECT founded FROM table_name_95 WHERE suburb = "beaudesert"


Instruction: Visualize a bar chart about the distribution of date_address_to and the amount of date_address_to , and group by attribute other_details and bin date_address_to by weekday.

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

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 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 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 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 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 Students_in_Detention (
    student_id INTEGER,
    detention_id INTEGER,
    incident_id INTEGER
)

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

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 Ref_Address_Types (
    address_type_code VARCHAR(15),
    address_type_description VARCHAR(80)
)

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

Response: SELECT date_address_to, COUNT(date_address_to) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Visualize a bar chart about the distribution of date_address_to and the amount of date_address_to , and group by attribute other_details and bin date_address_to by weekday. ### Input: CREATE TABLE Ref_Detention_Type (
    detention_type_code VARCHAR(10),
    detention_type_description VARCHAR(80)
)

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 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 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 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 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 Students_in_Detention (
    student_id INTEGER,
    detention_id INTEGER,
    incident_id INTEGER
)

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

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 Ref_Address_Types (
    address_type_code VARCHAR(15),
    address_type_description VARCHAR(80)
)

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)
) ### Response: SELECT date_address_to, COUNT(date_address_to) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC


Instruction: How was the player in the position of Center acquired?

Input:
CREATE TABLE table_41725 (
    "Name" text,
    "Position" text,
    "Number" real,
    "School/Club Team" text,
    "Season" text,
    "Acquisition via" text
)

Response: SELECT "Acquisition via" FROM table_41725 WHERE "Position" = 'center'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How was the player in the position of Center acquired? ### Input: CREATE TABLE table_41725 (
    "Name" text,
    "Position" text,
    "Number" real,
    "School/Club Team" text,
    "Season" text,
    "Acquisition via" text
) ### Response: SELECT "Acquisition via" FROM table_41725 WHERE "Position" = 'center'


Instruction: Catalog Nebdj068 was released when?

Input:
CREATE TABLE table_39879 (
    "Region" text,
    "Date" text,
    "Label" text,
    "Format" text,
    "Catalog" text
)

Response: SELECT "Date" FROM table_39879 WHERE "Catalog" = 'nebdj068'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Catalog Nebdj068 was released when? ### Input: CREATE TABLE table_39879 (
    "Region" text,
    "Date" text,
    "Label" text,
    "Format" text,
    "Catalog" text
) ### Response: SELECT "Date" FROM table_39879 WHERE "Catalog" = 'nebdj068'


Instruction: What is average age for different job title Visualize by bar chart, I want to rank by the bars from low to high.

Input:
CREATE TABLE Person (
    name varchar(20),
    age INTEGER,
    city TEXT,
    gender TEXT,
    job TEXT
)

CREATE TABLE PersonFriend (
    name varchar(20),
    friend varchar(20),
    year INTEGER
)

Response: SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY job

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is average age for different job title Visualize by bar chart, I want to rank by the bars from low to high. ### Input: CREATE TABLE Person (
    name varchar(20),
    age INTEGER,
    city TEXT,
    gender TEXT,
    job TEXT
)

CREATE TABLE PersonFriend (
    name varchar(20),
    friend varchar(20),
    year INTEGER
) ### Response: SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY job


Instruction: What was the To par score for the tournament with a margin of victory of 1 stroke?

Input:
CREATE TABLE table_40653 (
    "Date" text,
    "Tournament" text,
    "Winning score" text,
    "To par" text,
    "Margin of victory" text,
    "Runner(s)-up" text
)

Response: SELECT "To par" FROM table_40653 WHERE "Margin of victory" = '1 stroke'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the To par score for the tournament with a margin of victory of 1 stroke? ### Input: CREATE TABLE table_40653 (
    "Date" text,
    "Tournament" text,
    "Winning score" text,
    "To par" text,
    "Margin of victory" text,
    "Runner(s)-up" text
) ### Response: SELECT "To par" FROM table_40653 WHERE "Margin of victory" = '1 stroke'


Instruction: On what date did the Brisbane Lions (1) win?

Input:
CREATE TABLE table_56418 (
    "Season" text,
    "Cup FinalDate" text,
    "WinningTeam" text,
    "Score" text,
    "LosingTeam" text,
    "Cup Final Attendance" text
)

Response: SELECT "Cup FinalDate" FROM table_56418 WHERE "WinningTeam" = 'brisbane lions (1)'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: On what date did the Brisbane Lions (1) win? ### Input: CREATE TABLE table_56418 (
    "Season" text,
    "Cup FinalDate" text,
    "WinningTeam" text,
    "Score" text,
    "LosingTeam" text,
    "Cup Final Attendance" text
) ### Response: SELECT "Cup FinalDate" FROM table_56418 WHERE "WinningTeam" = 'brisbane lions (1)'


Instruction: What is the winning span for the name of bernard gallacher?

Input:
CREATE TABLE table_23078 (
    "Rank" text,
    "Name" text,
    "Lifespan" text,
    "Country" text,
    "Wins" real,
    "Majors" real,
    "Winning span" text,
    "Span (years)" real
)

Response: SELECT "Winning span" FROM table_23078 WHERE "Name" = 'Bernard Gallacher'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the winning span for the name of bernard gallacher? ### Input: CREATE TABLE table_23078 (
    "Rank" text,
    "Name" text,
    "Lifespan" text,
    "Country" text,
    "Wins" real,
    "Majors" real,
    "Winning span" text,
    "Span (years)" real
) ### Response: SELECT "Winning span" FROM table_23078 WHERE "Name" = 'Bernard Gallacher'


Instruction: count the number of patients whose ethnicity is black/african american and year of birth is less than 2076?

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

Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.dob_year < "2076"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of patients whose ethnicity is black/african american and year of birth is less than 2076? ### Input: 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 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
) ### Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.dob_year < "2076"


Instruction: What is every year where opponent in the final is John Mcenroe at Wimbledon?

Input:
CREATE TABLE table_23235767_1 (
    year VARCHAR,
    opponent_in_the_final VARCHAR,
    championship VARCHAR
)

Response: SELECT year FROM table_23235767_1 WHERE opponent_in_the_final = "John McEnroe" AND championship = "Wimbledon"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is every year where opponent in the final is John Mcenroe at Wimbledon? ### Input: CREATE TABLE table_23235767_1 (
    year VARCHAR,
    opponent_in_the_final VARCHAR,
    championship VARCHAR
) ### Response: SELECT year FROM table_23235767_1 WHERE opponent_in_the_final = "John McEnroe" AND championship = "Wimbledon"


Instruction: What was the home team for the game with more than 25,000 crowd?

Input:
CREATE TABLE table_33727 (
    "Home team" text,
    "Home team score" text,
    "Away team" text,
    "Away team score" text,
    "Venue" text,
    "Crowd" real,
    "Date" text
)

Response: SELECT "Home team" FROM table_33727 WHERE "Crowd" > '25,000'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the home team for the game with more than 25,000 crowd? ### Input: CREATE TABLE table_33727 (
    "Home team" text,
    "Home team score" text,
    "Away team" text,
    "Away team score" text,
    "Venue" text,
    "Crowd" real,
    "Date" text
) ### Response: SELECT "Home team" FROM table_33727 WHERE "Crowd" > '25,000'


Instruction: What's the performance of Dire Tune?

Input:
CREATE TABLE table_name_89 (
    performance VARCHAR,
    athlete VARCHAR
)

Response: SELECT performance FROM table_name_89 WHERE athlete = "dire tune"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What's the performance of Dire Tune? ### Input: CREATE TABLE table_name_89 (
    performance VARCHAR,
    athlete VARCHAR
) ### Response: SELECT performance FROM table_name_89 WHERE athlete = "dire tune"


Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of last_name and salary , show in descending by the X.

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

Response: SELECT LAST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY LAST_NAME DESC

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of last_name and salary , show in descending by the X. ### Input: 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 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 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)
) ### Response: SELECT LAST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY LAST_NAME DESC


Instruction: What circuit had rnd 3?

Input:
CREATE TABLE table_26503 (
    "Rnd" real,
    "Circuit" text,
    "LMP Winning Team" text,
    "LMPC Winning Team" text,
    "GT Winning Team" text,
    "GTC Winning Team" text,
    "Results" text
)

Response: SELECT "Circuit" FROM table_26503 WHERE "Rnd" = '3'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What circuit had rnd 3? ### Input: CREATE TABLE table_26503 (
    "Rnd" real,
    "Circuit" text,
    "LMP Winning Team" text,
    "LMPC Winning Team" text,
    "GT Winning Team" text,
    "GTC Winning Team" text,
    "Results" text
) ### Response: SELECT "Circuit" FROM table_26503 WHERE "Rnd" = '3'


Instruction: Which date released had a Democratic Alternative value of 1% and Labour of 34%?

Input:
CREATE TABLE table_66678 (
    "Date(s) Released" text,
    "Polling institute" text,
    "Nationalist" text,
    "Labour" text,
    "Democratic Alternative" text,
    "Undecided/ No answer" text,
    "Lead" text
)

Response: SELECT "Date(s) Released" FROM table_66678 WHERE "Democratic Alternative" = '1%' AND "Labour" = '34%'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which date released had a Democratic Alternative value of 1% and Labour of 34%? ### Input: CREATE TABLE table_66678 (
    "Date(s) Released" text,
    "Polling institute" text,
    "Nationalist" text,
    "Labour" text,
    "Democratic Alternative" text,
    "Undecided/ No answer" text,
    "Lead" text
) ### Response: SELECT "Date(s) Released" FROM table_66678 WHERE "Democratic Alternative" = '1%' AND "Labour" = '34%'


Instruction: What was the score in the match against Kim Tiilikainen?

Input:
CREATE TABLE table_68453 (
    "Date" text,
    "Tournament" text,
    "Surface" text,
    "Opponent" text,
    "Score" text
)

Response: SELECT "Score" FROM table_68453 WHERE "Opponent" = 'kim tiilikainen'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the score in the match against Kim Tiilikainen? ### Input: CREATE TABLE table_68453 (
    "Date" text,
    "Tournament" text,
    "Surface" text,
    "Opponent" text,
    "Score" text
) ### Response: SELECT "Score" FROM table_68453 WHERE "Opponent" = 'kim tiilikainen'


Instruction: What is the wattage/TDP associated with model name 4x0?

Input:
CREATE TABLE table_26575 (
    "Processor" text,
    "Brand name" text,
    "Model (list)" text,
    "Cores" real,
    "L2 Cache" text,
    "Socket" text,
    "TDP" text
)

Response: SELECT "TDP" FROM table_26575 WHERE "Model (list)" = '4x0'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the wattage/TDP associated with model name 4x0? ### Input: CREATE TABLE table_26575 (
    "Processor" text,
    "Brand name" text,
    "Model (list)" text,
    "Cores" real,
    "L2 Cache" text,
    "Socket" text,
    "TDP" text
) ### Response: SELECT "TDP" FROM table_26575 WHERE "Model (list)" = '4x0'


Instruction: Name a music director, belonging to a year after 2003?

Input:
CREATE TABLE table_name_86 (
    music_director VARCHAR,
    year INTEGER
)

Response: SELECT music_director FROM table_name_86 WHERE year > 2003

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Name a music director, belonging to a year after 2003? ### Input: CREATE TABLE table_name_86 (
    music_director VARCHAR,
    year INTEGER
) ### Response: SELECT music_director FROM table_name_86 WHERE year > 2003


Instruction: Find the average age of students living in each city with a bar chart.

Input:
CREATE TABLE Lives_in (
    stuid INTEGER,
    dormid INTEGER,
    room_number INTEGER
)

CREATE TABLE Dorm (
    dormid INTEGER,
    dorm_name VARCHAR(20),
    student_capacity INTEGER,
    gender VARCHAR(1)
)

CREATE TABLE Has_amenity (
    dormid INTEGER,
    amenid INTEGER
)

CREATE TABLE Student (
    StuID INTEGER,
    LName VARCHAR(12),
    Fname VARCHAR(12),
    Age INTEGER,
    Sex VARCHAR(1),
    Major INTEGER,
    Advisor INTEGER,
    city_code VARCHAR(3)
)

CREATE TABLE Dorm_amenity (
    amenid INTEGER,
    amenity_name VARCHAR(25)
)

Response: SELECT city_code, AVG(Age) FROM Student GROUP BY city_code

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Find the average age of students living in each city with a bar chart. ### Input: CREATE TABLE Lives_in (
    stuid INTEGER,
    dormid INTEGER,
    room_number INTEGER
)

CREATE TABLE Dorm (
    dormid INTEGER,
    dorm_name VARCHAR(20),
    student_capacity INTEGER,
    gender VARCHAR(1)
)

CREATE TABLE Has_amenity (
    dormid INTEGER,
    amenid INTEGER
)

CREATE TABLE Student (
    StuID INTEGER,
    LName VARCHAR(12),
    Fname VARCHAR(12),
    Age INTEGER,
    Sex VARCHAR(1),
    Major INTEGER,
    Advisor INTEGER,
    city_code VARCHAR(3)
)

CREATE TABLE Dorm_amenity (
    amenid INTEGER,
    amenity_name VARCHAR(25)
) ### Response: SELECT city_code, AVG(Age) FROM Student GROUP BY city_code


Instruction: What are the reigns and days held of all wrestlers?

Input:
CREATE TABLE elimination (
    elimination_id text,
    wrestler_id text,
    team text,
    eliminated_by text,
    elimination_move text,
    time text
)

CREATE TABLE wrestler (
    wrestler_id number,
    name text,
    reign text,
    days_held text,
    location text,
    event text
)

Response: SELECT reign, days_held FROM wrestler

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What are the reigns and days held of all wrestlers? ### Input: CREATE TABLE elimination (
    elimination_id text,
    wrestler_id text,
    team text,
    eliminated_by text,
    elimination_move text,
    time text
)

CREATE TABLE wrestler (
    wrestler_id number,
    name text,
    reign text,
    days_held text,
    location text,
    event text
) ### Response: SELECT reign, days_held FROM wrestler


Instruction: what was the first drug that was prescribed to patient 030-56105 through im route in 03/last year?

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

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 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 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 vitalperiodic (
    vitalperiodicid number,
    patientunitstayid number,
    temperature number,
    sao2 number,
    heartrate number,
    respiration number,
    systemicsystolic number,
    systemicdiastolic number,
    systemicmean number,
    observationtime time
)

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

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
)

Response: SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-56105')) AND medication.routeadmin = 'im' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', medication.drugstarttime) = '03' ORDER BY medication.drugstarttime LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the first drug that was prescribed to patient 030-56105 through im route in 03/last year? ### Input: CREATE TABLE intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

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 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 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 vitalperiodic (
    vitalperiodicid number,
    patientunitstayid number,
    temperature number,
    sao2 number,
    heartrate number,
    respiration number,
    systemicsystolic number,
    systemicdiastolic number,
    systemicmean number,
    observationtime time
)

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

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
) ### Response: SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-56105')) AND medication.routeadmin = 'im' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', medication.drugstarttime) = '03' ORDER BY medication.drugstarttime LIMIT 1


Instruction: how many days has passed since patient 14671 had a creatinine laboratory test for the last time in the current hospital encounter?

Input:
CREATE TABLE chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE procedures_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE inputevents_cv (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    amount number
)

CREATE TABLE admissions (
    row_id number,
    subject_id number,
    hadm_id number,
    admittime time,
    dischtime time,
    admission_type text,
    admission_location text,
    discharge_location text,
    insurance text,
    language text,
    marital_status text,
    ethnicity text,
    age number
)

CREATE TABLE d_labitems (
    row_id number,
    itemid number,
    label text
)

CREATE TABLE prescriptions (
    row_id number,
    subject_id number,
    hadm_id number,
    startdate time,
    enddate time,
    drug text,
    dose_val_rx text,
    dose_unit_rx text,
    route text
)

CREATE TABLE cost (
    row_id number,
    subject_id number,
    hadm_id number,
    event_type text,
    event_id number,
    chargetime time,
    cost number
)

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto text
)

CREATE TABLE labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE diagnoses_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

CREATE TABLE transfers (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    eventtype text,
    careunit text,
    wardid number,
    intime time,
    outtime time
)

CREATE TABLE icustays (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    first_careunit text,
    last_careunit text,
    first_wardid number,
    last_wardid number,
    intime time,
    outtime time
)

CREATE TABLE d_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value number
)

CREATE TABLE microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name text
)

CREATE TABLE d_icd_procedures (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

Response: SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'creatinine') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14671 AND admissions.dischtime IS NULL) ORDER BY labevents.charttime DESC LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many days has passed since patient 14671 had a creatinine laboratory test for the last time in the current hospital encounter? ### Input: CREATE TABLE chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE procedures_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE inputevents_cv (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    amount number
)

CREATE TABLE admissions (
    row_id number,
    subject_id number,
    hadm_id number,
    admittime time,
    dischtime time,
    admission_type text,
    admission_location text,
    discharge_location text,
    insurance text,
    language text,
    marital_status text,
    ethnicity text,
    age number
)

CREATE TABLE d_labitems (
    row_id number,
    itemid number,
    label text
)

CREATE TABLE prescriptions (
    row_id number,
    subject_id number,
    hadm_id number,
    startdate time,
    enddate time,
    drug text,
    dose_val_rx text,
    dose_unit_rx text,
    route text
)

CREATE TABLE cost (
    row_id number,
    subject_id number,
    hadm_id number,
    event_type text,
    event_id number,
    chargetime time,
    cost number
)

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto text
)

CREATE TABLE labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE diagnoses_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

CREATE TABLE transfers (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    eventtype text,
    careunit text,
    wardid number,
    intime time,
    outtime time
)

CREATE TABLE icustays (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    first_careunit text,
    last_careunit text,
    first_wardid number,
    last_wardid number,
    intime time,
    outtime time
)

CREATE TABLE d_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value number
)

CREATE TABLE microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name text
)

CREATE TABLE d_icd_procedures (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
) ### Response: SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'creatinine') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14671 AND admissions.dischtime IS NULL) ORDER BY labevents.charttime DESC LIMIT 1


Instruction: what was the prescription drug that patient 27172 had received two or more times in 10/this year?

Input:
CREATE TABLE labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE procedures_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE icustays (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    first_careunit text,
    last_careunit text,
    first_wardid number,
    last_wardid number,
    intime time,
    outtime time
)

CREATE TABLE transfers (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    eventtype text,
    careunit text,
    wardid number,
    intime time,
    outtime time
)

CREATE TABLE prescriptions (
    row_id number,
    subject_id number,
    hadm_id number,
    startdate time,
    enddate time,
    drug text,
    dose_val_rx text,
    dose_unit_rx text,
    route text
)

CREATE TABLE d_labitems (
    row_id number,
    itemid number,
    label text
)

CREATE TABLE chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value number
)

CREATE TABLE cost (
    row_id number,
    subject_id number,
    hadm_id number,
    event_type text,
    event_id number,
    chargetime time,
    cost number
)

CREATE TABLE d_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name text
)

CREATE TABLE d_icd_procedures (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE inputevents_cv (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    amount number
)

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto text
)

CREATE TABLE admissions (
    row_id number,
    subject_id number,
    hadm_id number,
    admittime time,
    dischtime time,
    admission_type text,
    admission_location text,
    discharge_location text,
    insurance text,
    language text,
    marital_status text,
    ethnicity text,
    age number
)

CREATE TABLE patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

CREATE TABLE diagnoses_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

Response: SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27172) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '10' GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 >= 2

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the prescription drug that patient 27172 had received two or more times in 10/this year? ### Input: CREATE TABLE labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE procedures_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
)

CREATE TABLE icustays (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    first_careunit text,
    last_careunit text,
    first_wardid number,
    last_wardid number,
    intime time,
    outtime time
)

CREATE TABLE transfers (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    eventtype text,
    careunit text,
    wardid number,
    intime time,
    outtime time
)

CREATE TABLE prescriptions (
    row_id number,
    subject_id number,
    hadm_id number,
    startdate time,
    enddate time,
    drug text,
    dose_val_rx text,
    dose_unit_rx text,
    route text
)

CREATE TABLE d_labitems (
    row_id number,
    itemid number,
    label text
)

CREATE TABLE chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

CREATE TABLE outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value number
)

CREATE TABLE cost (
    row_id number,
    subject_id number,
    hadm_id number,
    event_type text,
    event_id number,
    chargetime time,
    cost number
)

CREATE TABLE d_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name text
)

CREATE TABLE d_icd_procedures (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE inputevents_cv (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    amount number
)

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto text
)

CREATE TABLE admissions (
    row_id number,
    subject_id number,
    hadm_id number,
    admittime time,
    dischtime time,
    admission_type text,
    admission_location text,
    discharge_location text,
    insurance text,
    language text,
    marital_status text,
    ethnicity text,
    age number
)

CREATE TABLE patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

CREATE TABLE diagnoses_icd (
    row_id number,
    subject_id number,
    hadm_id number,
    icd9_code text,
    charttime time
) ### Response: SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27172) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '10' GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 >= 2


Instruction: What is the verb meaning for Saugen in part 1?

Input:
CREATE TABLE table_44583 (
    "Class" text,
    "Part 1" text,
    "Part 2" text,
    "Part 3" text,
    "Part 4" text,
    "Verb meaning" text
)

Response: SELECT "Verb meaning" FROM table_44583 WHERE "Part 1" = 'saugen'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the verb meaning for Saugen in part 1? ### Input: CREATE TABLE table_44583 (
    "Class" text,
    "Part 1" text,
    "Part 2" text,
    "Part 3" text,
    "Part 4" text,
    "Verb meaning" text
) ### Response: SELECT "Verb meaning" FROM table_44583 WHERE "Part 1" = 'saugen'


Instruction: What date did the away team Mansfield Town play?

Input:
CREATE TABLE table_name_56 (
    date VARCHAR,
    away_team VARCHAR
)

Response: SELECT date FROM table_name_56 WHERE away_team = "mansfield town"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What date did the away team Mansfield Town play? ### Input: CREATE TABLE table_name_56 (
    date VARCHAR,
    away_team VARCHAR
) ### Response: SELECT date FROM table_name_56 WHERE away_team = "mansfield town"


Instruction: count the number of patients who were diagnosed with valvular stenosis - aortic but did not come back to hospital within 2 months until 1 year ago.

Input:
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 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 microlab (
    microlabid number,
    patientunitstayid number,
    culturesite text,
    organism text,
    culturetakentime 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 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
)

Response: SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'valvular stenosis - aortic' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t1) - (SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'valvular stenosis - aortic' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t2 JOIN patient ON t2.uniquepid = patient.uniquepid WHERE t2.diagnosistime < patient.hospitaladmittime AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-1 year') AND DATETIME(patient.hospitaladmittime) BETWEEN DATETIME(t2.diagnosistime) AND DATETIME(t2.diagnosistime, '+2 month'))

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of patients who were diagnosed with valvular stenosis - aortic but did not come back to hospital within 2 months until 1 year ago. ### Input: 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 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 microlab (
    microlabid number,
    patientunitstayid number,
    culturesite text,
    organism text,
    culturetakentime 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 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
) ### Response: SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'valvular stenosis - aortic' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t1) - (SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'valvular stenosis - aortic' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t2 JOIN patient ON t2.uniquepid = patient.uniquepid WHERE t2.diagnosistime < patient.hospitaladmittime AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-1 year') AND DATETIME(patient.hospitaladmittime) BETWEEN DATETIME(t2.diagnosistime) AND DATETIME(t2.diagnosistime, '+2 month'))


Instruction: When was the team, whose captain is Matt Smith, founded?

Input:
CREATE TABLE table_17914 (
    "Team" text,
    "Location" text,
    "Stadium" text,
    "Founded" real,
    "Joined" real,
    "Head Coach" text,
    "Captain" text
)

Response: SELECT "Founded" FROM table_17914 WHERE "Captain" = 'Matt Smith'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When was the team, whose captain is Matt Smith, founded? ### Input: CREATE TABLE table_17914 (
    "Team" text,
    "Location" text,
    "Stadium" text,
    "Founded" real,
    "Joined" real,
    "Head Coach" text,
    "Captain" text
) ### Response: SELECT "Founded" FROM table_17914 WHERE "Captain" = 'Matt Smith'


Instruction: List the physicians' employee ids together with their primary affiliation departments' ids. Plot them as scatter chart.

Input:
CREATE TABLE Room (
    RoomNumber INTEGER,
    RoomType VARCHAR(30),
    BlockFloor INTEGER,
    BlockCode INTEGER,
    Unavailable BOOLEAN
)

CREATE TABLE Affiliated_With (
    Physician INTEGER,
    Department INTEGER,
    PrimaryAffiliation BOOLEAN
)

CREATE TABLE Appointment (
    AppointmentID INTEGER,
    Patient INTEGER,
    PrepNurse INTEGER,
    Physician INTEGER,
    Start DATETIME,
    End DATETIME,
    ExaminationRoom TEXT
)

CREATE TABLE Department (
    DepartmentID INTEGER,
    Name VARCHAR(30),
    Head INTEGER
)

CREATE TABLE On_Call (
    Nurse INTEGER,
    BlockFloor INTEGER,
    BlockCode INTEGER,
    OnCallStart DATETIME,
    OnCallEnd DATETIME
)

CREATE TABLE Stay (
    StayID INTEGER,
    Patient INTEGER,
    Room INTEGER,
    StayStart DATETIME,
    StayEnd DATETIME
)

CREATE TABLE Physician (
    EmployeeID INTEGER,
    Name VARCHAR(30),
    Position VARCHAR(30),
    SSN INTEGER
)

CREATE TABLE Procedures (
    Code INTEGER,
    Name VARCHAR(30),
    Cost REAL
)

CREATE TABLE Trained_In (
    Physician INTEGER,
    Treatment INTEGER,
    CertificationDate DATETIME,
    CertificationExpires DATETIME
)

CREATE TABLE Patient (
    SSN INTEGER,
    Name VARCHAR(30),
    Address VARCHAR(30),
    Phone VARCHAR(30),
    InsuranceID INTEGER,
    PCP INTEGER
)

CREATE TABLE Undergoes (
    Patient INTEGER,
    Procedures INTEGER,
    Stay INTEGER,
    DateUndergoes DATETIME,
    Physician INTEGER,
    AssistingNurse INTEGER
)

CREATE TABLE Block (
    BlockFloor INTEGER,
    BlockCode INTEGER
)

CREATE TABLE Prescribes (
    Physician INTEGER,
    Patient INTEGER,
    Medication INTEGER,
    Date DATETIME,
    Appointment INTEGER,
    Dose VARCHAR(30)
)

CREATE TABLE Medication (
    Code INTEGER,
    Name VARCHAR(30),
    Brand VARCHAR(30),
    Description VARCHAR(30)
)

CREATE TABLE Nurse (
    EmployeeID INTEGER,
    Name VARCHAR(30),
    Position VARCHAR(30),
    Registered BOOLEAN,
    SSN INTEGER
)

Response: SELECT Physician, Department FROM Affiliated_With WHERE PrimaryAffiliation = 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: List the physicians' employee ids together with their primary affiliation departments' ids. Plot them as scatter chart. ### Input: CREATE TABLE Room (
    RoomNumber INTEGER,
    RoomType VARCHAR(30),
    BlockFloor INTEGER,
    BlockCode INTEGER,
    Unavailable BOOLEAN
)

CREATE TABLE Affiliated_With (
    Physician INTEGER,
    Department INTEGER,
    PrimaryAffiliation BOOLEAN
)

CREATE TABLE Appointment (
    AppointmentID INTEGER,
    Patient INTEGER,
    PrepNurse INTEGER,
    Physician INTEGER,
    Start DATETIME,
    End DATETIME,
    ExaminationRoom TEXT
)

CREATE TABLE Department (
    DepartmentID INTEGER,
    Name VARCHAR(30),
    Head INTEGER
)

CREATE TABLE On_Call (
    Nurse INTEGER,
    BlockFloor INTEGER,
    BlockCode INTEGER,
    OnCallStart DATETIME,
    OnCallEnd DATETIME
)

CREATE TABLE Stay (
    StayID INTEGER,
    Patient INTEGER,
    Room INTEGER,
    StayStart DATETIME,
    StayEnd DATETIME
)

CREATE TABLE Physician (
    EmployeeID INTEGER,
    Name VARCHAR(30),
    Position VARCHAR(30),
    SSN INTEGER
)

CREATE TABLE Procedures (
    Code INTEGER,
    Name VARCHAR(30),
    Cost REAL
)

CREATE TABLE Trained_In (
    Physician INTEGER,
    Treatment INTEGER,
    CertificationDate DATETIME,
    CertificationExpires DATETIME
)

CREATE TABLE Patient (
    SSN INTEGER,
    Name VARCHAR(30),
    Address VARCHAR(30),
    Phone VARCHAR(30),
    InsuranceID INTEGER,
    PCP INTEGER
)

CREATE TABLE Undergoes (
    Patient INTEGER,
    Procedures INTEGER,
    Stay INTEGER,
    DateUndergoes DATETIME,
    Physician INTEGER,
    AssistingNurse INTEGER
)

CREATE TABLE Block (
    BlockFloor INTEGER,
    BlockCode INTEGER
)

CREATE TABLE Prescribes (
    Physician INTEGER,
    Patient INTEGER,
    Medication INTEGER,
    Date DATETIME,
    Appointment INTEGER,
    Dose VARCHAR(30)
)

CREATE TABLE Medication (
    Code INTEGER,
    Name VARCHAR(30),
    Brand VARCHAR(30),
    Description VARCHAR(30)
)

CREATE TABLE Nurse (
    EmployeeID INTEGER,
    Name VARCHAR(30),
    Position VARCHAR(30),
    Registered BOOLEAN,
    SSN INTEGER
) ### Response: SELECT Physician, Department FROM Affiliated_With WHERE PrimaryAffiliation = 1


Instruction: What is the lowest number of three pointers in games where the number of rebounds was 178?

Input:
CREATE TABLE table_22824324_2 (
    three_pointers INTEGER,
    rebounds VARCHAR
)

Response: SELECT MIN(three_pointers) FROM table_22824324_2 WHERE rebounds = 178

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the lowest number of three pointers in games where the number of rebounds was 178? ### Input: CREATE TABLE table_22824324_2 (
    three_pointers INTEGER,
    rebounds VARCHAR
) ### Response: SELECT MIN(three_pointers) FROM table_22824324_2 WHERE rebounds = 178


Instruction: What is the grand slam in 1987, when round shows first round, and Ivan Lendl won?

Input:
CREATE TABLE table_62130 (
    "Year" real,
    "Grand Slam" text,
    "Round" text,
    "Winner" text,
    "Loser" text
)

Response: SELECT "Grand Slam" FROM table_62130 WHERE "Year" = '1987' AND "Round" = 'first round' AND "Winner" = 'ivan lendl'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the grand slam in 1987, when round shows first round, and Ivan Lendl won? ### Input: CREATE TABLE table_62130 (
    "Year" real,
    "Grand Slam" text,
    "Round" text,
    "Winner" text,
    "Loser" text
) ### Response: SELECT "Grand Slam" FROM table_62130 WHERE "Year" = '1987' AND "Round" = 'first round' AND "Winner" = 'ivan lendl'


Instruction: How many faculty is there in total in the year of 2002?

Input:
CREATE TABLE faculty (
    faculty INTEGER,
    YEAR VARCHAR
)

Response: SELECT SUM(faculty) FROM faculty WHERE YEAR = 2002

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many faculty is there in total in the year of 2002? ### Input: CREATE TABLE faculty (
    faculty INTEGER,
    YEAR VARCHAR
) ### Response: SELECT SUM(faculty) FROM faculty WHERE YEAR = 2002


Instruction: What is the traffic direction of 70th street?

Input:
CREATE TABLE table_56945 (
    "Street" text,
    "West" text,
    "East" text,
    "# of lanes" text,
    "Traffic direction" text
)

Response: SELECT "Traffic direction" FROM table_56945 WHERE "Street" = '70th street'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the traffic direction of 70th street? ### Input: CREATE TABLE table_56945 (
    "Street" text,
    "West" text,
    "East" text,
    "# of lanes" text,
    "Traffic direction" text
) ### Response: SELECT "Traffic direction" FROM table_56945 WHERE "Street" = '70th street'


Instruction: show me all flights from TORONTO

Input:
CREATE TABLE time_zone (
    time_zone_code text,
    time_zone_name text,
    hours_from_gmt int
)

CREATE TABLE airport_service (
    city_code varchar,
    airport_code varchar,
    miles_distant int,
    direction varchar,
    minutes_distant int
)

CREATE TABLE airline (
    airline_code varchar,
    airline_name text,
    note text
)

CREATE TABLE city (
    city_code varchar,
    city_name varchar,
    state_code varchar,
    country_name varchar,
    time_zone_code varchar
)

CREATE TABLE state (
    state_code text,
    state_name text,
    country_name text
)

CREATE TABLE restriction (
    restriction_code text,
    advance_purchase int,
    stopovers text,
    saturday_stay_required text,
    minimum_stay int,
    maximum_stay int,
    application text,
    no_discounts text
)

CREATE TABLE equipment_sequence (
    aircraft_code_sequence varchar,
    aircraft_code varchar
)

CREATE TABLE flight_fare (
    flight_id int,
    fare_id int
)

CREATE TABLE days (
    days_code varchar,
    day_name varchar
)

CREATE TABLE class_of_service (
    booking_class varchar,
    rank int,
    class_description text
)

CREATE TABLE flight_stop (
    flight_id int,
    stop_number int,
    stop_days text,
    stop_airport text,
    arrival_time int,
    arrival_airline text,
    arrival_flight_number int,
    departure_time int,
    departure_airline text,
    departure_flight_number int,
    stop_time int
)

CREATE TABLE ground_service (
    city_code text,
    airport_code text,
    transport_type text,
    ground_fare int
)

CREATE TABLE dual_carrier (
    main_airline varchar,
    low_flight_number int,
    high_flight_number int,
    dual_airline varchar,
    service_name text
)

CREATE TABLE time_interval (
    period text,
    begin_time int,
    end_time int
)

CREATE TABLE fare_basis (
    fare_basis_code text,
    booking_class text,
    class_type text,
    premium text,
    economy text,
    discounted text,
    night text,
    season text,
    basis_days text
)

CREATE TABLE month (
    month_number int,
    month_name text
)

CREATE TABLE fare (
    fare_id int,
    from_airport varchar,
    to_airport varchar,
    fare_basis_code text,
    fare_airline text,
    restriction_code text,
    one_direction_cost int,
    round_trip_cost int,
    round_trip_required varchar
)

CREATE TABLE code_description (
    code varchar,
    description text
)

CREATE TABLE flight (
    aircraft_code_sequence text,
    airline_code varchar,
    airline_flight text,
    arrival_time int,
    connections int,
    departure_time int,
    dual_carrier text,
    flight_days text,
    flight_id int,
    flight_number int,
    from_airport varchar,
    meal_code text,
    stops int,
    time_elapsed int,
    to_airport varchar
)

CREATE TABLE food_service (
    meal_code text,
    meal_number int,
    compartment text,
    meal_description varchar
)

CREATE TABLE compartment_class (
    compartment varchar,
    class_type varchar
)

CREATE TABLE date_day (
    month_number int,
    day_number int,
    year int,
    day_name varchar
)

CREATE TABLE airport (
    airport_code varchar,
    airport_name text,
    airport_location text,
    state_code varchar,
    country_name varchar,
    time_zone_code varchar,
    minimum_connect_time int
)

CREATE TABLE aircraft (
    aircraft_code varchar,
    aircraft_description varchar,
    manufacturer varchar,
    basic_type varchar,
    engines int,
    propulsion varchar,
    wide_body varchar,
    wing_span int,
    length int,
    weight int,
    capacity int,
    pay_load int,
    cruising_speed int,
    range_miles int,
    pressurized varchar
)

CREATE TABLE flight_leg (
    flight_id int,
    leg_number int,
    leg_flight int
)

Response: SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'TORONTO' AND flight.from_airport = airport_service.airport_code

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: show me all flights from TORONTO ### Input: CREATE TABLE time_zone (
    time_zone_code text,
    time_zone_name text,
    hours_from_gmt int
)

CREATE TABLE airport_service (
    city_code varchar,
    airport_code varchar,
    miles_distant int,
    direction varchar,
    minutes_distant int
)

CREATE TABLE airline (
    airline_code varchar,
    airline_name text,
    note text
)

CREATE TABLE city (
    city_code varchar,
    city_name varchar,
    state_code varchar,
    country_name varchar,
    time_zone_code varchar
)

CREATE TABLE state (
    state_code text,
    state_name text,
    country_name text
)

CREATE TABLE restriction (
    restriction_code text,
    advance_purchase int,
    stopovers text,
    saturday_stay_required text,
    minimum_stay int,
    maximum_stay int,
    application text,
    no_discounts text
)

CREATE TABLE equipment_sequence (
    aircraft_code_sequence varchar,
    aircraft_code varchar
)

CREATE TABLE flight_fare (
    flight_id int,
    fare_id int
)

CREATE TABLE days (
    days_code varchar,
    day_name varchar
)

CREATE TABLE class_of_service (
    booking_class varchar,
    rank int,
    class_description text
)

CREATE TABLE flight_stop (
    flight_id int,
    stop_number int,
    stop_days text,
    stop_airport text,
    arrival_time int,
    arrival_airline text,
    arrival_flight_number int,
    departure_time int,
    departure_airline text,
    departure_flight_number int,
    stop_time int
)

CREATE TABLE ground_service (
    city_code text,
    airport_code text,
    transport_type text,
    ground_fare int
)

CREATE TABLE dual_carrier (
    main_airline varchar,
    low_flight_number int,
    high_flight_number int,
    dual_airline varchar,
    service_name text
)

CREATE TABLE time_interval (
    period text,
    begin_time int,
    end_time int
)

CREATE TABLE fare_basis (
    fare_basis_code text,
    booking_class text,
    class_type text,
    premium text,
    economy text,
    discounted text,
    night text,
    season text,
    basis_days text
)

CREATE TABLE month (
    month_number int,
    month_name text
)

CREATE TABLE fare (
    fare_id int,
    from_airport varchar,
    to_airport varchar,
    fare_basis_code text,
    fare_airline text,
    restriction_code text,
    one_direction_cost int,
    round_trip_cost int,
    round_trip_required varchar
)

CREATE TABLE code_description (
    code varchar,
    description text
)

CREATE TABLE flight (
    aircraft_code_sequence text,
    airline_code varchar,
    airline_flight text,
    arrival_time int,
    connections int,
    departure_time int,
    dual_carrier text,
    flight_days text,
    flight_id int,
    flight_number int,
    from_airport varchar,
    meal_code text,
    stops int,
    time_elapsed int,
    to_airport varchar
)

CREATE TABLE food_service (
    meal_code text,
    meal_number int,
    compartment text,
    meal_description varchar
)

CREATE TABLE compartment_class (
    compartment varchar,
    class_type varchar
)

CREATE TABLE date_day (
    month_number int,
    day_number int,
    year int,
    day_name varchar
)

CREATE TABLE airport (
    airport_code varchar,
    airport_name text,
    airport_location text,
    state_code varchar,
    country_name varchar,
    time_zone_code varchar,
    minimum_connect_time int
)

CREATE TABLE aircraft (
    aircraft_code varchar,
    aircraft_description varchar,
    manufacturer varchar,
    basic_type varchar,
    engines int,
    propulsion varchar,
    wide_body varchar,
    wing_span int,
    length int,
    weight int,
    capacity int,
    pay_load int,
    cruising_speed int,
    range_miles int,
    pressurized varchar
)

CREATE TABLE flight_leg (
    flight_id int,
    leg_number int,
    leg_flight int
) ### Response: SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'TORONTO' AND flight.from_airport = airport_service.airport_code