Instruction: How many documents in different ending date? Return a line chart grouping by ending date.

Input:
CREATE TABLE Ref_Document_Types (
    Document_Type_Code CHAR(15),
    Document_Type_Name VARCHAR(255),
    Document_Type_Description VARCHAR(255)
)

CREATE TABLE All_Documents (
    Document_ID INTEGER,
    Date_Stored DATETIME,
    Document_Type_Code CHAR(15),
    Document_Name CHAR(255),
    Document_Description CHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Employees (
    Employee_ID INTEGER,
    Role_Code CHAR(15),
    Employee_Name VARCHAR(255),
    Gender_MFU CHAR(1),
    Date_of_Birth DATETIME,
    Other_Details VARCHAR(255)
)

CREATE TABLE Ref_Locations (
    Location_Code CHAR(15),
    Location_Name VARCHAR(255),
    Location_Description VARCHAR(255)
)

CREATE TABLE Ref_Calendar (
    Calendar_Date DATETIME,
    Day_Number INTEGER
)

CREATE TABLE Roles (
    Role_Code CHAR(15),
    Role_Name VARCHAR(255),
    Role_Description VARCHAR(255)
)

CREATE TABLE Documents_to_be_Destroyed (
    Document_ID INTEGER,
    Destruction_Authorised_by_Employee_ID INTEGER,
    Destroyed_by_Employee_ID INTEGER,
    Planned_Destruction_Date DATETIME,
    Actual_Destruction_Date DATETIME,
    Other_Details VARCHAR(255)
)

CREATE TABLE Document_Locations (
    Document_ID INTEGER,
    Location_Code CHAR(15),
    Date_in_Location_From DATETIME,
    Date_in_Locaton_To DATETIME
)

Response: SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations GROUP BY Date_in_Locaton_To

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 documents in different ending date? Return a line chart grouping by ending date. ### Input: CREATE TABLE Ref_Document_Types (
    Document_Type_Code CHAR(15),
    Document_Type_Name VARCHAR(255),
    Document_Type_Description VARCHAR(255)
)

CREATE TABLE All_Documents (
    Document_ID INTEGER,
    Date_Stored DATETIME,
    Document_Type_Code CHAR(15),
    Document_Name CHAR(255),
    Document_Description CHAR(255),
    Other_Details VARCHAR(255)
)

CREATE TABLE Employees (
    Employee_ID INTEGER,
    Role_Code CHAR(15),
    Employee_Name VARCHAR(255),
    Gender_MFU CHAR(1),
    Date_of_Birth DATETIME,
    Other_Details VARCHAR(255)
)

CREATE TABLE Ref_Locations (
    Location_Code CHAR(15),
    Location_Name VARCHAR(255),
    Location_Description VARCHAR(255)
)

CREATE TABLE Ref_Calendar (
    Calendar_Date DATETIME,
    Day_Number INTEGER
)

CREATE TABLE Roles (
    Role_Code CHAR(15),
    Role_Name VARCHAR(255),
    Role_Description VARCHAR(255)
)

CREATE TABLE Documents_to_be_Destroyed (
    Document_ID INTEGER,
    Destruction_Authorised_by_Employee_ID INTEGER,
    Destroyed_by_Employee_ID INTEGER,
    Planned_Destruction_Date DATETIME,
    Actual_Destruction_Date DATETIME,
    Other_Details VARCHAR(255)
)

CREATE TABLE Document_Locations (
    Document_ID INTEGER,
    Location_Code CHAR(15),
    Date_in_Location_From DATETIME,
    Date_in_Locaton_To DATETIME
) ### Response: SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations GROUP BY Date_in_Locaton_To


Instruction: What is the sum of all total medals with more than 2 bronze medals and more than 1 gold medal for the United States?

Input:
CREATE TABLE table_name_27 (
    total INTEGER,
    gold VARCHAR,
    bronze VARCHAR,
    nation VARCHAR
)

Response: SELECT SUM(total) FROM table_name_27 WHERE bronze > 2 AND nation = "united states" AND gold > 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 is the sum of all total medals with more than 2 bronze medals and more than 1 gold medal for the United States? ### Input: CREATE TABLE table_name_27 (
    total INTEGER,
    gold VARCHAR,
    bronze VARCHAR,
    nation VARCHAR
) ### Response: SELECT SUM(total) FROM table_name_27 WHERE bronze > 2 AND nation = "united states" AND gold > 1


Instruction: What was the winning score of the Buy.com Siouxland Open?

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

Response: SELECT "Winning score" FROM table_70472 WHERE "Tournament" = 'buy.com siouxland open'

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 winning score of the Buy.com Siouxland Open? ### Input: CREATE TABLE table_70472 (
    "Date" text,
    "Tournament" text,
    "Winning score" text,
    "Margin of victory" text,
    "Runner(s)-up" text
) ### Response: SELECT "Winning score" FROM table_70472 WHERE "Tournament" = 'buy.com siouxland open'


Instruction: Provide me the number of patients born before 1846 who have an abnormal lab test status.

Input:
CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

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

CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
)

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

Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1846" AND lab.flag = "abnormal"

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: Provide me the number of patients born before 1846 who have an abnormal lab test status. ### Input: CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

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

CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
)

CREATE TABLE procedures (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
) ### Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1846" AND lab.flag = "abnormal"


Instruction: What is Country, when Previous Team (League) is 'Kingston Frontenacs ( OHL )', and when Player is 'Anthony Stewart Category:Articles with hCards'?

Input:
CREATE TABLE table_59768 (
    "Year" real,
    "Pick" text,
    "Player" text,
    "Position" text,
    "Country" text,
    "Previous team (League)" text
)

Response: SELECT "Country" FROM table_59768 WHERE "Previous team (League)" = 'kingston frontenacs ( ohl )' AND "Player" = 'anthony stewart category:articles with hcards'

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 Country, when Previous Team (League) is 'Kingston Frontenacs ( OHL )', and when Player is 'Anthony Stewart Category:Articles with hCards'? ### Input: CREATE TABLE table_59768 (
    "Year" real,
    "Pick" text,
    "Player" text,
    "Position" text,
    "Country" text,
    "Previous team (League)" text
) ### Response: SELECT "Country" FROM table_59768 WHERE "Previous team (League)" = 'kingston frontenacs ( ohl )' AND "Player" = 'anthony stewart category:articles with hcards'


Instruction: Find the title and star rating of the movie that got the least rating star for each reviewer.

Input:
CREATE TABLE rating (
    rid number,
    mid number,
    stars number,
    ratingdate time
)

CREATE TABLE reviewer (
    rid number,
    name text
)

CREATE TABLE movie (
    mid number,
    title text,
    year number,
    director text
)

Response: SELECT T2.title, T1.rid, T1.stars, MIN(T1.stars) FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid GROUP BY T1.rid

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 title and star rating of the movie that got the least rating star for each reviewer. ### Input: CREATE TABLE rating (
    rid number,
    mid number,
    stars number,
    ratingdate time
)

CREATE TABLE reviewer (
    rid number,
    name text
)

CREATE TABLE movie (
    mid number,
    title text,
    year number,
    director text
) ### Response: SELECT T2.title, T1.rid, T1.stars, MIN(T1.stars) FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid GROUP BY T1.rid


Instruction: List roles that have more than one employee. List the role description and number of employees.

Input:
CREATE TABLE ref_document_status (
    document_status_code text,
    document_status_description text
)

CREATE TABLE circulation_history (
    document_id number,
    draft_number number,
    copy_number number,
    employee_id number
)

CREATE TABLE documents (
    document_id number,
    document_status_code text,
    document_type_code text,
    shipping_agent_code text,
    receipt_date time,
    receipt_number text,
    other_details text
)

CREATE TABLE documents_mailed (
    document_id number,
    mailed_to_address_id number,
    mailing_date time
)

CREATE TABLE document_drafts (
    document_id number,
    draft_number number,
    draft_details text
)

CREATE TABLE roles (
    role_code text,
    role_description text
)

CREATE TABLE ref_shipping_agents (
    shipping_agent_code text,
    shipping_agent_name text,
    shipping_agent_description text
)

CREATE TABLE ref_document_types (
    document_type_code text,
    document_type_description text
)

CREATE TABLE addresses (
    address_id number,
    address_details text
)

CREATE TABLE employees (
    employee_id number,
    role_code text,
    employee_name text,
    other_details text
)

CREATE TABLE draft_copies (
    document_id number,
    draft_number number,
    copy_number number
)

Response: SELECT roles.role_description, COUNT(employees.employee_id) FROM roles JOIN employees ON employees.role_code = roles.role_code GROUP BY employees.role_code HAVING COUNT(employees.employee_id) > 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 roles that have more than one employee. List the role description and number of employees. ### Input: CREATE TABLE ref_document_status (
    document_status_code text,
    document_status_description text
)

CREATE TABLE circulation_history (
    document_id number,
    draft_number number,
    copy_number number,
    employee_id number
)

CREATE TABLE documents (
    document_id number,
    document_status_code text,
    document_type_code text,
    shipping_agent_code text,
    receipt_date time,
    receipt_number text,
    other_details text
)

CREATE TABLE documents_mailed (
    document_id number,
    mailed_to_address_id number,
    mailing_date time
)

CREATE TABLE document_drafts (
    document_id number,
    draft_number number,
    draft_details text
)

CREATE TABLE roles (
    role_code text,
    role_description text
)

CREATE TABLE ref_shipping_agents (
    shipping_agent_code text,
    shipping_agent_name text,
    shipping_agent_description text
)

CREATE TABLE ref_document_types (
    document_type_code text,
    document_type_description text
)

CREATE TABLE addresses (
    address_id number,
    address_details text
)

CREATE TABLE employees (
    employee_id number,
    role_code text,
    employee_name text,
    other_details text
)

CREATE TABLE draft_copies (
    document_id number,
    draft_number number,
    copy_number number
) ### Response: SELECT roles.role_description, COUNT(employees.employee_id) FROM roles JOIN employees ON employees.role_code = roles.role_code GROUP BY employees.role_code HAVING COUNT(employees.employee_id) > 1


Instruction: What nations participated in 2007?

Input:
CREATE TABLE table_66466 (
    "Sport" text,
    "Body" text,
    "Year" text,
    "Event type" text,
    "Location" text,
    "Nations" text
)

Response: SELECT "Nations" FROM table_66466 WHERE "Year" = '2007'

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 nations participated in 2007? ### Input: CREATE TABLE table_66466 (
    "Sport" text,
    "Body" text,
    "Year" text,
    "Event type" text,
    "Location" text,
    "Nations" text
) ### Response: SELECT "Nations" FROM table_66466 WHERE "Year" = '2007'


Instruction: How many tourists visited the country that had 2.5 million tourists in 2011?

Input:
CREATE TABLE table_34550 (
    "Rank" real,
    "Country" text,
    "International tourist arrivals (2012)" text,
    "International tourist arrivals (2011)" text,
    "Change (2011 to 2012)" text,
    "Change (2010 to 2011)" text
)

Response: SELECT "International tourist arrivals (2012)" FROM table_34550 WHERE "International tourist arrivals (2011)" = '2.5 million'

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 tourists visited the country that had 2.5 million tourists in 2011? ### Input: CREATE TABLE table_34550 (
    "Rank" real,
    "Country" text,
    "International tourist arrivals (2012)" text,
    "International tourist arrivals (2011)" text,
    "Change (2011 to 2012)" text,
    "Change (2010 to 2011)" text
) ### Response: SELECT "International tourist arrivals (2012)" FROM table_34550 WHERE "International tourist arrivals (2011)" = '2.5 million'


Instruction: What stage did team Carrera Jeans-Tassoni have when Mario Cipollini won and Claudio Chiappucci had the points?

Input:
CREATE TABLE table_11219 (
    "Stage" text,
    "Winner" text,
    "General classification" text,
    "Points classification" text,
    "Trofeo Fast Team" text
)

Response: SELECT "Stage" FROM table_11219 WHERE "Trofeo Fast Team" = 'carrera jeans-tassoni' AND "Winner" = 'mario cipollini' AND "Points classification" = 'claudio chiappucci'

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 stage did team Carrera Jeans-Tassoni have when Mario Cipollini won and Claudio Chiappucci had the points? ### Input: CREATE TABLE table_11219 (
    "Stage" text,
    "Winner" text,
    "General classification" text,
    "Points classification" text,
    "Trofeo Fast Team" text
) ### Response: SELECT "Stage" FROM table_11219 WHERE "Trofeo Fast Team" = 'carrera jeans-tassoni' AND "Winner" = 'mario cipollini' AND "Points classification" = 'claudio chiappucci'


Instruction: Name the replaced by for august 9

Input:
CREATE TABLE table_27597 (
    "Team" text,
    "Outgoing manager" text,
    "Manner of departure" text,
    "Date of vacancy" text,
    "Position in table" text,
    "Replaced by" text,
    "Date of appointment" text
)

Response: SELECT "Replaced by" FROM table_27597 WHERE "Date of vacancy" = 'August 9' AND "Date of appointment" = 'August 9'

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 the replaced by for august 9 ### Input: CREATE TABLE table_27597 (
    "Team" text,
    "Outgoing manager" text,
    "Manner of departure" text,
    "Date of vacancy" text,
    "Position in table" text,
    "Replaced by" text,
    "Date of appointment" text
) ### Response: SELECT "Replaced by" FROM table_27597 WHERE "Date of vacancy" = 'August 9' AND "Date of appointment" = 'August 9'


Instruction: What venue was on 27 May 2000?

Input:
CREATE TABLE table_name_81 (
    venue VARCHAR,
    date VARCHAR
)

Response: SELECT venue FROM table_name_81 WHERE date = "27 may 2000"

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 venue was on 27 May 2000? ### Input: CREATE TABLE table_name_81 (
    venue VARCHAR,
    date VARCHAR
) ### Response: SELECT venue FROM table_name_81 WHERE date = "27 may 2000"


Instruction: has patient 029-584 ever had a medication prescribed the last year?

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

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

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

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

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

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

Response: SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-584')) AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')

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: has patient 029-584 ever had a medication prescribed the last year? ### Input: CREATE TABLE intakeoutput (
    intakeoutputid number,
    patientunitstayid number,
    cellpath text,
    celllabel text,
    cellvaluenumeric number,
    intakeoutputtime time
)

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

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

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

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

CREATE TABLE vitalperiodic (
    vitalperiodicid number,
    patientunitstayid number,
    temperature number,
    sao2 number,
    heartrate number,
    respiration number,
    systemicsystolic number,
    systemicdiastolic number,
    systemicmean number,
    observationtime 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 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
) ### Response: SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-584')) AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')


Instruction: What is Socket, when Part Number(s) is au80610003495aa?

Input:
CREATE TABLE table_9828 (
    "Model number" text,
    "sSpec number" text,
    "Frequency" text,
    "GPU frequency" text,
    "L2 cache" text,
    "I/O bus" text,
    "Memory" text,
    "Voltage" text,
    "Socket" text,
    "Release date" text,
    "Part number(s)" text
)

Response: SELECT "Socket" FROM table_9828 WHERE "Part number(s)" = 'au80610003495aa'

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 Socket, when Part Number(s) is au80610003495aa? ### Input: CREATE TABLE table_9828 (
    "Model number" text,
    "sSpec number" text,
    "Frequency" text,
    "GPU frequency" text,
    "L2 cache" text,
    "I/O bus" text,
    "Memory" text,
    "Voltage" text,
    "Socket" text,
    "Release date" text,
    "Part number(s)" text
) ### Response: SELECT "Socket" FROM table_9828 WHERE "Part number(s)" = 'au80610003495aa'


Instruction: how many hours have passed since the patient 95057 was admitted to the hospital?

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

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 microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name 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 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 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 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 outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value number
)

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

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

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto 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 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 patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

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

Response: SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 95057 AND admissions.dischtime IS NULL

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 hours have passed since the patient 95057 was admitted to the hospital? ### Input: CREATE TABLE d_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title text
)

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 microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name 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 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 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 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 outputevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    value number
)

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

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

CREATE TABLE d_items (
    row_id number,
    itemid number,
    label text,
    linksto 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 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 patients (
    row_id number,
    subject_id number,
    gender text,
    dob time,
    dod time
)

CREATE TABLE inputevents_cv (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    charttime time,
    itemid number,
    amount number
) ### Response: SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 95057 AND admissions.dischtime IS NULL


Instruction: how many of the patients aged below 76 had migraine unspecified w/o ntrc mgrn?

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 diagnoses (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE 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 INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "76" AND diagnoses.short_title = "Migrne unsp wo ntrc mgrn"

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 of the patients aged below 76 had migraine unspecified w/o ntrc mgrn? ### 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 diagnoses (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE 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 INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "76" AND diagnoses.short_title = "Migrne unsp wo ntrc mgrn"


Instruction: Which To par has a Year of 1994?

Input:
CREATE TABLE table_name_24 (
    to_par VARCHAR,
    year VARCHAR
)

Response: SELECT to_par FROM table_name_24 WHERE year = 1994

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 To par has a Year of 1994? ### Input: CREATE TABLE table_name_24 (
    to_par VARCHAR,
    year VARCHAR
) ### Response: SELECT to_par FROM table_name_24 WHERE year = 1994


Instruction: Draw a bar chart about the distribution of meter_700 and ID , and rank meter_700 in desc order.

Input:
CREATE TABLE stadium (
    ID int,
    name text,
    Capacity int,
    City text,
    Country text,
    Opening_year int
)

CREATE TABLE event (
    ID int,
    Name text,
    Stadium_ID int,
    Year text
)

CREATE TABLE swimmer (
    ID int,
    name text,
    Nationality text,
    meter_100 real,
    meter_200 text,
    meter_300 text,
    meter_400 text,
    meter_500 text,
    meter_600 text,
    meter_700 text,
    Time text
)

CREATE TABLE record (
    ID int,
    Result text,
    Swimmer_ID int,
    Event_ID int
)

Response: SELECT meter_700, ID FROM swimmer ORDER BY meter_700 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: Draw a bar chart about the distribution of meter_700 and ID , and rank meter_700 in desc order. ### Input: CREATE TABLE stadium (
    ID int,
    name text,
    Capacity int,
    City text,
    Country text,
    Opening_year int
)

CREATE TABLE event (
    ID int,
    Name text,
    Stadium_ID int,
    Year text
)

CREATE TABLE swimmer (
    ID int,
    name text,
    Nationality text,
    meter_100 real,
    meter_200 text,
    meter_300 text,
    meter_400 text,
    meter_500 text,
    meter_600 text,
    meter_700 text,
    Time text
)

CREATE TABLE record (
    ID int,
    Result text,
    Swimmer_ID int,
    Event_ID int
) ### Response: SELECT meter_700, ID FROM swimmer ORDER BY meter_700 DESC


Instruction: Which year was the peter jackson classic?

Input:
CREATE TABLE table_name_36 (
    year VARCHAR,
    championship VARCHAR
)

Response: SELECT year FROM table_name_36 WHERE championship = "peter jackson classic"

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 year was the peter jackson classic? ### Input: CREATE TABLE table_name_36 (
    year VARCHAR,
    championship VARCHAR
) ### Response: SELECT year FROM table_name_36 WHERE championship = "peter jackson classic"


Instruction: TOTAL number of SUCCESSFUL questions.

Input:
CREATE TABLE PostNotices (
    Id number,
    PostId number,
    PostNoticeTypeId number,
    CreationDate time,
    DeletionDate time,
    ExpiryDate time,
    Body text,
    OwnerUserId number,
    DeletionUserId number
)

CREATE TABLE PostTypes (
    Id number,
    Name text
)

CREATE TABLE SuggestedEditVotes (
    Id number,
    SuggestedEditId number,
    UserId number,
    VoteTypeId number,
    CreationDate time,
    TargetUserId number,
    TargetRepChange number
)

CREATE TABLE PostFeedback (
    Id number,
    PostId number,
    IsAnonymous boolean,
    VoteTypeId number,
    CreationDate time
)

CREATE TABLE ReviewTaskStates (
    Id number,
    Name text,
    Description text
)

CREATE TABLE Tags (
    Id number,
    TagName text,
    Count number,
    ExcerptPostId number,
    WikiPostId number
)

CREATE TABLE Posts (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE SuggestedEdits (
    Id number,
    PostId number,
    CreationDate time,
    ApprovalDate time,
    RejectionDate time,
    OwnerUserId number,
    Comment text,
    Text text,
    Title text,
    Tags text,
    RevisionGUID other
)

CREATE TABLE Users (
    Id number,
    Reputation number,
    CreationDate time,
    DisplayName text,
    LastAccessDate time,
    WebsiteUrl text,
    Location text,
    AboutMe text,
    Views number,
    UpVotes number,
    DownVotes number,
    ProfileImageUrl text,
    EmailHash text,
    AccountId number
)

CREATE TABLE Badges (
    Id number,
    UserId number,
    Name text,
    Date time,
    Class number,
    TagBased boolean
)

CREATE TABLE ReviewTasks (
    Id number,
    ReviewTaskTypeId number,
    CreationDate time,
    DeletionDate time,
    ReviewTaskStateId number,
    PostId number,
    SuggestedEditId number,
    CompletedByReviewTaskId number
)

CREATE TABLE PostTags (
    PostId number,
    TagId number
)

CREATE TABLE PostLinks (
    Id number,
    CreationDate time,
    PostId number,
    RelatedPostId number,
    LinkTypeId number
)

CREATE TABLE PostNoticeTypes (
    Id number,
    ClassId number,
    Name text,
    Body text,
    IsHidden boolean,
    Predefined boolean,
    PostNoticeDurationId number
)

CREATE TABLE ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

CREATE TABLE TagSynonyms (
    Id number,
    SourceTagName text,
    TargetTagName text,
    CreationDate time,
    OwnerUserId number,
    AutoRenameCount number,
    LastAutoRename time,
    Score number,
    ApprovedByUserId number,
    ApprovalDate time
)

CREATE TABLE CloseReasonTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    ContentLicense text
)

CREATE TABLE Comments (
    Id number,
    PostId number,
    Score number,
    Text text,
    CreationDate time,
    UserDisplayName text,
    UserId number,
    ContentLicense text
)

CREATE TABLE VoteTypes (
    Id number,
    Name text
)

CREATE TABLE PostsWithDeleted (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE FlagTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE ReviewTaskResultTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE CloseAsOffTopicReasonTypes (
    Id number,
    IsUniversal boolean,
    InputTitle text,
    MarkdownInputGuidance text,
    MarkdownPostOwnerGuidance text,
    MarkdownPrivilegedUserGuidance text,
    MarkdownConcensusDescription text,
    CreationDate time,
    CreationModeratorId number,
    ApprovalDate time,
    ApprovalModeratorId number,
    DeactivationDate time,
    DeactivationModeratorId number
)

CREATE TABLE ReviewRejectionReasons (
    Id number,
    Name text,
    Description text,
    PostTypeId number
)

CREATE TABLE Votes (
    Id number,
    PostId number,
    VoteTypeId number,
    UserId number,
    CreationDate time,
    BountyAmount number
)

CREATE TABLE PendingFlags (
    Id number,
    FlagTypeId number,
    PostId number,
    CreationDate time,
    CloseReasonTypeId number,
    CloseAsOffTopicReasonTypeId number,
    DuplicateOfQuestionId number,
    BelongsOnBaseHostAddress text
)

CREATE TABLE ReviewTaskTypes (
    Id number,
    Name text,
    Description text
)

Response: SELECT COUNT(DISTINCT p.Id) FROM Posts AS p WHERE p.PostTypeId = 1 AND NOT p.AcceptedAnswerId IS NULL

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: TOTAL number of SUCCESSFUL questions. ### Input: CREATE TABLE PostNotices (
    Id number,
    PostId number,
    PostNoticeTypeId number,
    CreationDate time,
    DeletionDate time,
    ExpiryDate time,
    Body text,
    OwnerUserId number,
    DeletionUserId number
)

CREATE TABLE PostTypes (
    Id number,
    Name text
)

CREATE TABLE SuggestedEditVotes (
    Id number,
    SuggestedEditId number,
    UserId number,
    VoteTypeId number,
    CreationDate time,
    TargetUserId number,
    TargetRepChange number
)

CREATE TABLE PostFeedback (
    Id number,
    PostId number,
    IsAnonymous boolean,
    VoteTypeId number,
    CreationDate time
)

CREATE TABLE ReviewTaskStates (
    Id number,
    Name text,
    Description text
)

CREATE TABLE Tags (
    Id number,
    TagName text,
    Count number,
    ExcerptPostId number,
    WikiPostId number
)

CREATE TABLE Posts (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE SuggestedEdits (
    Id number,
    PostId number,
    CreationDate time,
    ApprovalDate time,
    RejectionDate time,
    OwnerUserId number,
    Comment text,
    Text text,
    Title text,
    Tags text,
    RevisionGUID other
)

CREATE TABLE Users (
    Id number,
    Reputation number,
    CreationDate time,
    DisplayName text,
    LastAccessDate time,
    WebsiteUrl text,
    Location text,
    AboutMe text,
    Views number,
    UpVotes number,
    DownVotes number,
    ProfileImageUrl text,
    EmailHash text,
    AccountId number
)

CREATE TABLE Badges (
    Id number,
    UserId number,
    Name text,
    Date time,
    Class number,
    TagBased boolean
)

CREATE TABLE ReviewTasks (
    Id number,
    ReviewTaskTypeId number,
    CreationDate time,
    DeletionDate time,
    ReviewTaskStateId number,
    PostId number,
    SuggestedEditId number,
    CompletedByReviewTaskId number
)

CREATE TABLE PostTags (
    PostId number,
    TagId number
)

CREATE TABLE PostLinks (
    Id number,
    CreationDate time,
    PostId number,
    RelatedPostId number,
    LinkTypeId number
)

CREATE TABLE PostNoticeTypes (
    Id number,
    ClassId number,
    Name text,
    Body text,
    IsHidden boolean,
    Predefined boolean,
    PostNoticeDurationId number
)

CREATE TABLE ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

CREATE TABLE TagSynonyms (
    Id number,
    SourceTagName text,
    TargetTagName text,
    CreationDate time,
    OwnerUserId number,
    AutoRenameCount number,
    LastAutoRename time,
    Score number,
    ApprovedByUserId number,
    ApprovalDate time
)

CREATE TABLE CloseReasonTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    ContentLicense text
)

CREATE TABLE Comments (
    Id number,
    PostId number,
    Score number,
    Text text,
    CreationDate time,
    UserDisplayName text,
    UserId number,
    ContentLicense text
)

CREATE TABLE VoteTypes (
    Id number,
    Name text
)

CREATE TABLE PostsWithDeleted (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE FlagTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE ReviewTaskResultTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE CloseAsOffTopicReasonTypes (
    Id number,
    IsUniversal boolean,
    InputTitle text,
    MarkdownInputGuidance text,
    MarkdownPostOwnerGuidance text,
    MarkdownPrivilegedUserGuidance text,
    MarkdownConcensusDescription text,
    CreationDate time,
    CreationModeratorId number,
    ApprovalDate time,
    ApprovalModeratorId number,
    DeactivationDate time,
    DeactivationModeratorId number
)

CREATE TABLE ReviewRejectionReasons (
    Id number,
    Name text,
    Description text,
    PostTypeId number
)

CREATE TABLE Votes (
    Id number,
    PostId number,
    VoteTypeId number,
    UserId number,
    CreationDate time,
    BountyAmount number
)

CREATE TABLE PendingFlags (
    Id number,
    FlagTypeId number,
    PostId number,
    CreationDate time,
    CloseReasonTypeId number,
    CloseAsOffTopicReasonTypeId number,
    DuplicateOfQuestionId number,
    BelongsOnBaseHostAddress text
)

CREATE TABLE ReviewTaskTypes (
    Id number,
    Name text,
    Description text
) ### Response: SELECT COUNT(DISTINCT p.Id) FROM Posts AS p WHERE p.PostTypeId = 1 AND NOT p.AcceptedAnswerId IS NULL


Instruction: when did patient 19040 first get a procedure on their first hospital visit?

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 procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19040 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) ORDER BY procedures_icd.charttime 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 did patient 19040 first get a procedure on their first hospital visit? ### 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 procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19040 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) ORDER BY procedures_icd.charttime LIMIT 1


Instruction: what are the procedures that are the top four most commonly received?

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

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

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

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

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

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

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

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

Response: SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 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 are the procedures that are the top four most commonly received? ### Input: CREATE TABLE patient (
    uniquepid text,
    patienthealthsystemstayid number,
    patientunitstayid number,
    gender text,
    age text,
    ethnicity text,
    hospitalid number,
    wardid number,
    admissionheight number,
    admissionweight number,
    dischargeweight number,
    hospitaladmittime time,
    hospitaladmitsource text,
    unitadmittime time,
    unitdischargetime time,
    hospitaldischargetime time,
    hospitaldischargestatus text
)

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

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

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

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

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

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

CREATE TABLE allergy (
    allergyid number,
    patientunitstayid number,
    drugname text,
    allergyname text,
    allergytime time
) ### Response: SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4


Instruction: what is the number of patients whose gender is f and primary disease is st elevated myocardial infarction\cardiac cath?

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

CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

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

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

Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH"

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 number of patients whose gender is f and primary disease is st elevated myocardial infarction\cardiac cath? ### Input: CREATE TABLE procedures (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

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

CREATE TABLE 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
) ### Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH"


Instruction: give me the number of patients whose diagnoses short title is enterococcus group d?

Input:
CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

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

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

CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
)

Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Enterococcus group d"

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: give me the number of patients whose diagnoses short title is enterococcus group d? ### Input: CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

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

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

CREATE TABLE lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE demographic (
    subject_id text,
    hadm_id text,
    name text,
    marital_status text,
    age text,
    dob text,
    gender text,
    language text,
    religion text,
    admission_type text,
    days_stay text,
    insurance text,
    ethnicity text,
    expire_flag text,
    admission_location text,
    discharge_location text,
    diagnosis text,
    dod text,
    dob_year text,
    dod_year text,
    admittime text,
    dischtime text,
    admityear text
) ### Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Enterococcus group d"


Instruction: What district has a constituency of 60?

Input:
CREATE TABLE table_name_27 (
    district VARCHAR,
    constituency_number VARCHAR
)

Response: SELECT district FROM table_name_27 WHERE constituency_number = "60"

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 district has a constituency of 60? ### Input: CREATE TABLE table_name_27 (
    district VARCHAR,
    constituency_number VARCHAR
) ### Response: SELECT district FROM table_name_27 WHERE constituency_number = "60"


Instruction: When were there less than 1 point with a cosworth v8 engine in jolly club switzerland?

Input:
CREATE TABLE table_14553 (
    "Year" real,
    "Entrant" text,
    "Chassis" text,
    "Engine" text,
    "Points" real
)

Response: SELECT "Year" FROM table_14553 WHERE "Points" < '1' AND "Engine" = 'cosworth v8' AND "Entrant" = 'jolly club switzerland'

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 were there less than 1 point with a cosworth v8 engine in jolly club switzerland? ### Input: CREATE TABLE table_14553 (
    "Year" real,
    "Entrant" text,
    "Chassis" text,
    "Engine" text,
    "Points" real
) ### Response: SELECT "Year" FROM table_14553 WHERE "Points" < '1' AND "Engine" = 'cosworth v8' AND "Entrant" = 'jolly club switzerland'


Instruction: For the flyers, what's the minimum capacity?

Input:
CREATE TABLE table_20718 (
    "Institution" text,
    "Location" text,
    "Team Nickname" text,
    "Joined TSCHL" real,
    "Home Arena" text,
    "Capacity" real,
    "Team Website" text
)

Response: SELECT MIN("Capacity") FROM table_20718 WHERE "Team Nickname" = 'Flyers'

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 the flyers, what's the minimum capacity? ### Input: CREATE TABLE table_20718 (
    "Institution" text,
    "Location" text,
    "Team Nickname" text,
    "Joined TSCHL" real,
    "Home Arena" text,
    "Capacity" real,
    "Team Website" text
) ### Response: SELECT MIN("Capacity") FROM table_20718 WHERE "Team Nickname" = 'Flyers'


Instruction: give the number of patients who are born before 2180 with a ivpca drug route.

Input:
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 lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

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

Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2180" AND prescriptions.route = "IVPCA"

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: give the number of patients who are born before 2180 with a ivpca drug route. ### Input: 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 lab (
    subject_id text,
    hadm_id text,
    itemid text,
    charttime text,
    flag text,
    value_unit text,
    label text,
    fluid text
)

CREATE TABLE prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

CREATE TABLE 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
) ### Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2180" AND prescriptions.route = "IVPCA"


Instruction: You can return a bar chart with employees' first names and their salaries, display by the y axis from high to low.

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

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

CREATE TABLE locations (
    LOCATION_ID decimal(4,0),
    STREET_ADDRESS varchar(40),
    POSTAL_CODE varchar(12),
    CITY varchar(30),
    STATE_PROVINCE varchar(25),
    COUNTRY_ID varchar(2)
)

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

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

Response: SELECT FIRST_NAME, SALARY FROM employees ORDER BY SALARY 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: You can return a bar chart with employees' first names and their salaries, display by the y axis from high to low. ### Input: CREATE TABLE countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
)

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

CREATE TABLE locations (
    LOCATION_ID decimal(4,0),
    STREET_ADDRESS varchar(40),
    POSTAL_CODE varchar(12),
    CITY varchar(30),
    STATE_PROVINCE varchar(25),
    COUNTRY_ID varchar(2)
)

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

CREATE TABLE 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)
) ### Response: SELECT FIRST_NAME, SALARY FROM employees ORDER BY SALARY DESC


Instruction: Name the scores for chris ramsey and carol vorderman

Input:
CREATE TABLE table_23292220_17 (
    scores VARCHAR,
    seans_team VARCHAR
)

Response: SELECT scores FROM table_23292220_17 WHERE seans_team = "Chris Ramsey and Carol Vorderman"

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 the scores for chris ramsey and carol vorderman ### Input: CREATE TABLE table_23292220_17 (
    scores VARCHAR,
    seans_team VARCHAR
) ### Response: SELECT scores FROM table_23292220_17 WHERE seans_team = "Chris Ramsey and Carol Vorderman"


Instruction: What is the number of games for the season with 10 ties?

Input:
CREATE TABLE table_name_86 (
    games VARCHAR,
    tied VARCHAR
)

Response: SELECT games FROM table_name_86 WHERE tied = 10

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 number of games for the season with 10 ties? ### Input: CREATE TABLE table_name_86 (
    games VARCHAR,
    tied VARCHAR
) ### Response: SELECT games FROM table_name_86 WHERE tied = 10


Instruction: What year did she place 8th in the junior race?

Input:
CREATE TABLE table_name_9 (
    year VARCHAR,
    event VARCHAR,
    position VARCHAR
)

Response: SELECT year FROM table_name_9 WHERE event = "junior race" AND position = "8th"

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 did she place 8th in the junior race? ### Input: CREATE TABLE table_name_9 (
    year VARCHAR,
    event VARCHAR,
    position VARCHAR
) ### Response: SELECT year FROM table_name_9 WHERE event = "junior race" AND position = "8th"


Instruction: A bar chart for what are the number of the descriptions of the categories that products with product descriptions that contain the letter t are in?, and rank y-axis in ascending order.

Input:
CREATE TABLE Ref_Characteristic_Types (
    characteristic_type_code VARCHAR(15),
    characteristic_type_description VARCHAR(80)
)

CREATE TABLE Products (
    product_id INTEGER,
    color_code VARCHAR(15),
    product_category_code VARCHAR(15),
    product_name VARCHAR(80),
    typical_buying_price VARCHAR(20),
    typical_selling_price VARCHAR(20),
    product_description VARCHAR(255),
    other_product_details VARCHAR(255)
)

CREATE TABLE Product_Characteristics (
    product_id INTEGER,
    characteristic_id INTEGER,
    product_characteristic_value VARCHAR(50)
)

CREATE TABLE Characteristics (
    characteristic_id INTEGER,
    characteristic_type_code VARCHAR(15),
    characteristic_data_type VARCHAR(10),
    characteristic_name VARCHAR(80),
    other_characteristic_details VARCHAR(255)
)

CREATE TABLE Ref_Colors (
    color_code VARCHAR(15),
    color_description VARCHAR(80)
)

CREATE TABLE Ref_Product_Categories (
    product_category_code VARCHAR(15),
    product_category_description VARCHAR(80),
    unit_of_measure VARCHAR(20)
)

Response: SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY COUNT(product_category_description)

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: A bar chart for what are the number of the descriptions of the categories that products with product descriptions that contain the letter t are in?, and rank y-axis in ascending order. ### Input: CREATE TABLE Ref_Characteristic_Types (
    characteristic_type_code VARCHAR(15),
    characteristic_type_description VARCHAR(80)
)

CREATE TABLE Products (
    product_id INTEGER,
    color_code VARCHAR(15),
    product_category_code VARCHAR(15),
    product_name VARCHAR(80),
    typical_buying_price VARCHAR(20),
    typical_selling_price VARCHAR(20),
    product_description VARCHAR(255),
    other_product_details VARCHAR(255)
)

CREATE TABLE Product_Characteristics (
    product_id INTEGER,
    characteristic_id INTEGER,
    product_characteristic_value VARCHAR(50)
)

CREATE TABLE Characteristics (
    characteristic_id INTEGER,
    characteristic_type_code VARCHAR(15),
    characteristic_data_type VARCHAR(10),
    characteristic_name VARCHAR(80),
    other_characteristic_details VARCHAR(255)
)

CREATE TABLE Ref_Colors (
    color_code VARCHAR(15),
    color_description VARCHAR(80)
)

CREATE TABLE Ref_Product_Categories (
    product_category_code VARCHAR(15),
    product_category_description VARCHAR(80),
    unit_of_measure VARCHAR(20)
) ### Response: SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY COUNT(product_category_description)


Instruction: What is the smallest Earnings that has a Money list rank of 6 and Starts smaller than 22?

Input:
CREATE TABLE table_56530 (
    "Year" text,
    "Starts" real,
    "Cuts made" real,
    "Wins" real,
    "Top 10" real,
    "Top 25" real,
    "Earnings ($)" real,
    "Money list rank" text
)

Response: SELECT MIN("Earnings ($)") FROM table_56530 WHERE "Money list rank" = '6' AND "Starts" < '22'

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 smallest Earnings that has a Money list rank of 6 and Starts smaller than 22? ### Input: CREATE TABLE table_56530 (
    "Year" text,
    "Starts" real,
    "Cuts made" real,
    "Wins" real,
    "Top 10" real,
    "Top 25" real,
    "Earnings ($)" real,
    "Money list rank" text
) ### Response: SELECT MIN("Earnings ($)") FROM table_56530 WHERE "Money list rank" = '6' AND "Starts" < '22'


Instruction: What year had 32 moves?

Input:
CREATE TABLE table_8509 (
    "White" text,
    "Black" text,
    "Year" real,
    "Result" text,
    "Moves" real,
    "Tournament" text,
    "Opening" text
)

Response: SELECT SUM("Year") FROM table_8509 WHERE "Moves" = '32'

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 had 32 moves? ### Input: CREATE TABLE table_8509 (
    "White" text,
    "Black" text,
    "Year" real,
    "Result" text,
    "Moves" real,
    "Tournament" text,
    "Opening" text
) ### Response: SELECT SUM("Year") FROM table_8509 WHERE "Moves" = '32'


Instruction: how long was the m1894 rifle 's barrel ?

Input:
CREATE TABLE table_204_343 (
    id number,
    "nation" text,
    "model" text,
    "length" text,
    "barrel length" text,
    "weight" text
)

Response: SELECT "barrel length" FROM table_204_343 WHERE "model" = 'm1894 rifle'

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 long was the m1894 rifle 's barrel ? ### Input: CREATE TABLE table_204_343 (
    id number,
    "nation" text,
    "model" text,
    "length" text,
    "barrel length" text,
    "weight" text
) ### Response: SELECT "barrel length" FROM table_204_343 WHERE "model" = 'm1894 rifle'


Instruction: How many Atts that have Yards of 43 and a Long larger than 43?

Input:
CREATE TABLE table_name_65 (
    att INTEGER,
    yards VARCHAR,
    long VARCHAR
)

Response: SELECT SUM(att) FROM table_name_65 WHERE yards = 43 AND long > 43

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 Atts that have Yards of 43 and a Long larger than 43? ### Input: CREATE TABLE table_name_65 (
    att INTEGER,
    yards VARCHAR,
    long VARCHAR
) ### Response: SELECT SUM(att) FROM table_name_65 WHERE yards = 43 AND long > 43


Instruction: How many times are listed for 31 May for the rider ranked 5?

Input:
CREATE TABLE table_25220821_4 (
    mon_31_may VARCHAR,
    rank VARCHAR
)

Response: SELECT COUNT(mon_31_may) FROM table_25220821_4 WHERE rank = 5

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 times are listed for 31 May for the rider ranked 5? ### Input: CREATE TABLE table_25220821_4 (
    mon_31_may VARCHAR,
    rank VARCHAR
) ### Response: SELECT COUNT(mon_31_may) FROM table_25220821_4 WHERE rank = 5


Instruction: Plot how many name by grouped by name as a bar graph, and sort by the total number in descending.

Input:
CREATE TABLE train (
    id int,
    train_number int,
    name text,
    origin text,
    destination text,
    time text,
    interval text
)

CREATE TABLE weekly_weather (
    station_id int,
    day_of_week text,
    high_temperature int,
    low_temperature int,
    precipitation real,
    wind_speed_mph int
)

CREATE TABLE route (
    train_id int,
    station_id int
)

CREATE TABLE station (
    id int,
    network_name text,
    services text,
    local_authority text
)

Response: SELECT name, COUNT(name) FROM train GROUP BY name ORDER BY COUNT(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: Plot how many name by grouped by name as a bar graph, and sort by the total number in descending. ### Input: CREATE TABLE train (
    id int,
    train_number int,
    name text,
    origin text,
    destination text,
    time text,
    interval text
)

CREATE TABLE weekly_weather (
    station_id int,
    day_of_week text,
    high_temperature int,
    low_temperature int,
    precipitation real,
    wind_speed_mph int
)

CREATE TABLE route (
    train_id int,
    station_id int
)

CREATE TABLE station (
    id int,
    network_name text,
    services text,
    local_authority text
) ### Response: SELECT name, COUNT(name) FROM train GROUP BY name ORDER BY COUNT(name) DESC


Instruction: Which constructor has a Time/Retired of +37.311?

Input:
CREATE TABLE table_56316 (
    "Driver" text,
    "Constructor" text,
    "Laps" real,
    "Time/Retired" text,
    "Grid" real
)

Response: SELECT "Constructor" FROM table_56316 WHERE "Time/Retired" = '+37.311'

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 constructor has a Time/Retired of +37.311? ### Input: CREATE TABLE table_56316 (
    "Driver" text,
    "Constructor" text,
    "Laps" real,
    "Time/Retired" text,
    "Grid" real
) ### Response: SELECT "Constructor" FROM table_56316 WHERE "Time/Retired" = '+37.311'


Instruction: What is the 2007 result when the 2010 result was 2r, at the US Open?

Input:
CREATE TABLE table_name_91 (
    tournament VARCHAR
)

Response: SELECT 2007 FROM table_name_91 WHERE 2010 = "2r" AND tournament = "us open"

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 2007 result when the 2010 result was 2r, at the US Open? ### Input: CREATE TABLE table_name_91 (
    tournament VARCHAR
) ### Response: SELECT 2007 FROM table_name_91 WHERE 2010 = "2r" AND tournament = "us open"


Instruction: when does the train arriving at bourne at 11.45 departure

Input:
CREATE TABLE table_22277 (
    "Departure" text,
    "Going to" text,
    "Calling at" text,
    "Arrival" text,
    "Operator" text
)

Response: SELECT "Departure" FROM table_22277 WHERE "Going to" = 'Bourne' AND "Arrival" = '11.45'

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 does the train arriving at bourne at 11.45 departure ### Input: CREATE TABLE table_22277 (
    "Departure" text,
    "Going to" text,
    "Calling at" text,
    "Arrival" text,
    "Operator" text
) ### Response: SELECT "Departure" FROM table_22277 WHERE "Going to" = 'Bourne' AND "Arrival" = '11.45'


Instruction: Users with close-vote privileges ordered by last access date..

Input:
CREATE TABLE ReviewTaskTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE CloseReasonTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PostNotices (
    Id number,
    PostId number,
    PostNoticeTypeId number,
    CreationDate time,
    DeletionDate time,
    ExpiryDate time,
    Body text,
    OwnerUserId number,
    DeletionUserId number
)

CREATE TABLE TagSynonyms (
    Id number,
    SourceTagName text,
    TargetTagName text,
    CreationDate time,
    OwnerUserId number,
    AutoRenameCount number,
    LastAutoRename time,
    Score number,
    ApprovedByUserId number,
    ApprovalDate time
)

CREATE TABLE ReviewTaskStates (
    Id number,
    Name text,
    Description text
)

CREATE TABLE ReviewTaskResultTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE Badges (
    Id number,
    UserId number,
    Name text,
    Date time,
    Class number,
    TagBased boolean
)

CREATE TABLE PostsWithDeleted (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE Users (
    Id number,
    Reputation number,
    CreationDate time,
    DisplayName text,
    LastAccessDate time,
    WebsiteUrl text,
    Location text,
    AboutMe text,
    Views number,
    UpVotes number,
    DownVotes number,
    ProfileImageUrl text,
    EmailHash text,
    AccountId number
)

CREATE TABLE Comments (
    Id number,
    PostId number,
    Score number,
    Text text,
    CreationDate time,
    UserDisplayName text,
    UserId number,
    ContentLicense text
)

CREATE TABLE PendingFlags (
    Id number,
    FlagTypeId number,
    PostId number,
    CreationDate time,
    CloseReasonTypeId number,
    CloseAsOffTopicReasonTypeId number,
    DuplicateOfQuestionId number,
    BelongsOnBaseHostAddress text
)

CREATE TABLE PostTags (
    PostId number,
    TagId number
)

CREATE TABLE Tags (
    Id number,
    TagName text,
    Count number,
    ExcerptPostId number,
    WikiPostId number
)

CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

CREATE TABLE PostFeedback (
    Id number,
    PostId number,
    IsAnonymous boolean,
    VoteTypeId number,
    CreationDate time
)

CREATE TABLE Votes (
    Id number,
    PostId number,
    VoteTypeId number,
    UserId number,
    CreationDate time,
    BountyAmount number
)

CREATE TABLE ReviewTasks (
    Id number,
    ReviewTaskTypeId number,
    CreationDate time,
    DeletionDate time,
    ReviewTaskStateId number,
    PostId number,
    SuggestedEditId number,
    CompletedByReviewTaskId number
)

CREATE TABLE PostNoticeTypes (
    Id number,
    ClassId number,
    Name text,
    Body text,
    IsHidden boolean,
    Predefined boolean,
    PostNoticeDurationId number
)

CREATE TABLE SuggestedEditVotes (
    Id number,
    SuggestedEditId number,
    UserId number,
    VoteTypeId number,
    CreationDate time,
    TargetUserId number,
    TargetRepChange number
)

CREATE TABLE FlagTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PostLinks (
    Id number,
    CreationDate time,
    PostId number,
    RelatedPostId number,
    LinkTypeId number
)

CREATE TABLE Posts (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    ContentLicense text
)

CREATE TABLE VoteTypes (
    Id number,
    Name text
)

CREATE TABLE SuggestedEdits (
    Id number,
    PostId number,
    CreationDate time,
    ApprovalDate time,
    RejectionDate time,
    OwnerUserId number,
    Comment text,
    Text text,
    Title text,
    Tags text,
    RevisionGUID other
)

CREATE TABLE ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

CREATE TABLE PostTypes (
    Id number,
    Name text
)

CREATE TABLE CloseAsOffTopicReasonTypes (
    Id number,
    IsUniversal boolean,
    InputTitle text,
    MarkdownInputGuidance text,
    MarkdownPostOwnerGuidance text,
    MarkdownPrivilegedUserGuidance text,
    MarkdownConcensusDescription text,
    CreationDate time,
    CreationModeratorId number,
    ApprovalDate time,
    ApprovalModeratorId number,
    DeactivationDate time,
    DeactivationModeratorId number
)

CREATE TABLE ReviewRejectionReasons (
    Id number,
    Name text,
    Description text,
    PostTypeId number
)

Response: SELECT ROW_NUMBER() OVER (ORDER BY LastAccessDate DESC) AS " ", Id AS "user_link", LastAccessDate FROM Users WHERE Reputation > 3000 ORDER BY LastAccessDate 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: Users with close-vote privileges ordered by last access date.. ### Input: CREATE TABLE ReviewTaskTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE CloseReasonTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PostNotices (
    Id number,
    PostId number,
    PostNoticeTypeId number,
    CreationDate time,
    DeletionDate time,
    ExpiryDate time,
    Body text,
    OwnerUserId number,
    DeletionUserId number
)

CREATE TABLE TagSynonyms (
    Id number,
    SourceTagName text,
    TargetTagName text,
    CreationDate time,
    OwnerUserId number,
    AutoRenameCount number,
    LastAutoRename time,
    Score number,
    ApprovedByUserId number,
    ApprovalDate time
)

CREATE TABLE ReviewTaskStates (
    Id number,
    Name text,
    Description text
)

CREATE TABLE ReviewTaskResultTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE Badges (
    Id number,
    UserId number,
    Name text,
    Date time,
    Class number,
    TagBased boolean
)

CREATE TABLE PostsWithDeleted (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE Users (
    Id number,
    Reputation number,
    CreationDate time,
    DisplayName text,
    LastAccessDate time,
    WebsiteUrl text,
    Location text,
    AboutMe text,
    Views number,
    UpVotes number,
    DownVotes number,
    ProfileImageUrl text,
    EmailHash text,
    AccountId number
)

CREATE TABLE Comments (
    Id number,
    PostId number,
    Score number,
    Text text,
    CreationDate time,
    UserDisplayName text,
    UserId number,
    ContentLicense text
)

CREATE TABLE PendingFlags (
    Id number,
    FlagTypeId number,
    PostId number,
    CreationDate time,
    CloseReasonTypeId number,
    CloseAsOffTopicReasonTypeId number,
    DuplicateOfQuestionId number,
    BelongsOnBaseHostAddress text
)

CREATE TABLE PostTags (
    PostId number,
    TagId number
)

CREATE TABLE Tags (
    Id number,
    TagName text,
    Count number,
    ExcerptPostId number,
    WikiPostId number
)

CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

CREATE TABLE PostFeedback (
    Id number,
    PostId number,
    IsAnonymous boolean,
    VoteTypeId number,
    CreationDate time
)

CREATE TABLE Votes (
    Id number,
    PostId number,
    VoteTypeId number,
    UserId number,
    CreationDate time,
    BountyAmount number
)

CREATE TABLE ReviewTasks (
    Id number,
    ReviewTaskTypeId number,
    CreationDate time,
    DeletionDate time,
    ReviewTaskStateId number,
    PostId number,
    SuggestedEditId number,
    CompletedByReviewTaskId number
)

CREATE TABLE PostNoticeTypes (
    Id number,
    ClassId number,
    Name text,
    Body text,
    IsHidden boolean,
    Predefined boolean,
    PostNoticeDurationId number
)

CREATE TABLE SuggestedEditVotes (
    Id number,
    SuggestedEditId number,
    UserId number,
    VoteTypeId number,
    CreationDate time,
    TargetUserId number,
    TargetRepChange number
)

CREATE TABLE FlagTypes (
    Id number,
    Name text,
    Description text
)

CREATE TABLE PostLinks (
    Id number,
    CreationDate time,
    PostId number,
    RelatedPostId number,
    LinkTypeId number
)

CREATE TABLE Posts (
    Id number,
    PostTypeId number,
    AcceptedAnswerId number,
    ParentId number,
    CreationDate time,
    DeletionDate time,
    Score number,
    ViewCount number,
    Body text,
    OwnerUserId number,
    OwnerDisplayName text,
    LastEditorUserId number,
    LastEditorDisplayName text,
    LastEditDate time,
    LastActivityDate time,
    Title text,
    Tags text,
    AnswerCount number,
    CommentCount number,
    FavoriteCount number,
    ClosedDate time,
    CommunityOwnedDate time,
    ContentLicense text
)

CREATE TABLE PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    ContentLicense text
)

CREATE TABLE VoteTypes (
    Id number,
    Name text
)

CREATE TABLE SuggestedEdits (
    Id number,
    PostId number,
    CreationDate time,
    ApprovalDate time,
    RejectionDate time,
    OwnerUserId number,
    Comment text,
    Text text,
    Title text,
    Tags text,
    RevisionGUID other
)

CREATE TABLE ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

CREATE TABLE PostTypes (
    Id number,
    Name text
)

CREATE TABLE CloseAsOffTopicReasonTypes (
    Id number,
    IsUniversal boolean,
    InputTitle text,
    MarkdownInputGuidance text,
    MarkdownPostOwnerGuidance text,
    MarkdownPrivilegedUserGuidance text,
    MarkdownConcensusDescription text,
    CreationDate time,
    CreationModeratorId number,
    ApprovalDate time,
    ApprovalModeratorId number,
    DeactivationDate time,
    DeactivationModeratorId number
)

CREATE TABLE ReviewRejectionReasons (
    Id number,
    Name text,
    Description text,
    PostTypeId number
) ### Response: SELECT ROW_NUMBER() OVER (ORDER BY LastAccessDate DESC) AS " ", Id AS "user_link", LastAccessDate FROM Users WHERE Reputation > 3000 ORDER BY LastAccessDate DESC


Instruction: Which Time/Retired has a Grid smaller than 3, and a Driver of mika h kkinen?

Input:
CREATE TABLE table_name_58 (
    time_retired VARCHAR,
    grid VARCHAR,
    driver VARCHAR
)

Response: SELECT time_retired FROM table_name_58 WHERE grid < 3 AND driver = "mika häkkinen"

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 Time/Retired has a Grid smaller than 3, and a Driver of mika h kkinen? ### Input: CREATE TABLE table_name_58 (
    time_retired VARCHAR,
    grid VARCHAR,
    driver VARCHAR
) ### Response: SELECT time_retired FROM table_name_58 WHERE grid < 3 AND driver = "mika häkkinen"