Instruction: Scores of users in specific tag.

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

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 PostFeedback (
    Id number,
    PostId number,
    IsAnonymous boolean,
    VoteTypeId number,
    CreationDate time
)

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

CREATE TABLE PostTypes (
    Id number,
    Name text
)

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

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

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 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 ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

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

CREATE TABLE FlagTypes (
    Id number,
    Name text,
    Description 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 PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    ContentLicense text
)

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

CREATE TABLE VoteTypes (
    Id number,
    Name text
)

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

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

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

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

CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

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

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

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

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

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 ReviewTasks (
    Id number,
    ReviewTaskTypeId number,
    CreationDate time,
    DeletionDate time,
    ReviewTaskStateId number,
    PostId number,
    SuggestedEditId number,
    CompletedByReviewTaskId number
)

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 PostTags (
    PostId number,
    TagId number
)

Response: WITH scorestags_cte AS (SELECT pt.TagId AS TagId, p.OwnerUserId AS uid, p.OwnerDisplayName AS udn, SUM(p.Score) AS sco, COUNT(p.Id) AS num FROM Posts AS p INNER JOIN Posts AS q ON q.Id = p.ParentId INNER JOIN PostTags AS pt ON q.Id = pt.PostId WHERE (p.CommunityOwnedDate IS NULL) GROUP BY pt.TagId, p.OwnerUserId, p.OwnerDisplayName) SELECT CAST('##MinScore##' AS INT), t.TagName, s.uid AS "user_link", s.udn, s.sco AS "score", s.num AS "count" FROM scorestags_cte AS s INNER JOIN Tags AS t ON s.TagId = t.Id WHERE t.TagName = '##TagName##' AND s.sco >= CAST('##MinScore##' AS INT) ORDER BY s.sco 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: Scores of users in specific tag. ### Input: CREATE TABLE Comments (
    Id number,
    PostId number,
    Score number,
    Text text,
    CreationDate time,
    UserDisplayName text,
    UserId number,
    ContentLicense text
)

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 PostFeedback (
    Id number,
    PostId number,
    IsAnonymous boolean,
    VoteTypeId number,
    CreationDate time
)

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

CREATE TABLE PostTypes (
    Id number,
    Name text
)

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

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

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 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 ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

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

CREATE TABLE FlagTypes (
    Id number,
    Name text,
    Description 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 PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    ContentLicense text
)

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

CREATE TABLE VoteTypes (
    Id number,
    Name text
)

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

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

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

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

CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

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

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

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

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

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 ReviewTasks (
    Id number,
    ReviewTaskTypeId number,
    CreationDate time,
    DeletionDate time,
    ReviewTaskStateId number,
    PostId number,
    SuggestedEditId number,
    CompletedByReviewTaskId number
)

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 PostTags (
    PostId number,
    TagId number
) ### Response: WITH scorestags_cte AS (SELECT pt.TagId AS TagId, p.OwnerUserId AS uid, p.OwnerDisplayName AS udn, SUM(p.Score) AS sco, COUNT(p.Id) AS num FROM Posts AS p INNER JOIN Posts AS q ON q.Id = p.ParentId INNER JOIN PostTags AS pt ON q.Id = pt.PostId WHERE (p.CommunityOwnedDate IS NULL) GROUP BY pt.TagId, p.OwnerUserId, p.OwnerDisplayName) SELECT CAST('##MinScore##' AS INT), t.TagName, s.uid AS "user_link", s.udn, s.sco AS "score", s.num AS "count" FROM scorestags_cte AS s INNER JOIN Tags AS t ON s.TagId = t.Id WHERE t.TagName = '##TagName##' AND s.sco >= CAST('##MinScore##' AS INT) ORDER BY s.sco DESC


Instruction: What is the population where the median household income is $87,832 and there are fewer than 64,886 households?

Input:
CREATE TABLE table_name_83 (
    population INTEGER,
    median_household_income VARCHAR,
    number_of_households VARCHAR
)

Response: SELECT AVG(population) FROM table_name_83 WHERE median_household_income = "$87,832" AND number_of_households < 64 OFFSET 886

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 population where the median household income is $87,832 and there are fewer than 64,886 households? ### Input: CREATE TABLE table_name_83 (
    population INTEGER,
    median_household_income VARCHAR,
    number_of_households VARCHAR
) ### Response: SELECT AVG(population) FROM table_name_83 WHERE median_household_income = "$87,832" AND number_of_households < 64 OFFSET 886


Instruction: provide the number of patients whose procedure icd9 code is 5771 and drug type is main?

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

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

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

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

Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "5771" AND prescriptions.drug_type = "MAIN"

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 the number of patients whose procedure icd9 code is 5771 and drug type is main? ### 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 diagnoses (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

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

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

CREATE TABLE procedures (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
) ### Response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "5771" AND prescriptions.drug_type = "MAIN"


Instruction: What is the rank of the player who got 58179 in yardage?

Input:
CREATE TABLE table_18686317_1 (
    rank VARCHAR,
    yardage VARCHAR
)

Response: SELECT rank FROM table_18686317_1 WHERE yardage = 58179

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 rank of the player who got 58179 in yardage? ### Input: CREATE TABLE table_18686317_1 (
    rank VARCHAR,
    yardage VARCHAR
) ### Response: SELECT rank FROM table_18686317_1 WHERE yardage = 58179


Instruction: What is the name of the course that has the most student enrollment?

Input:
CREATE TABLE Courses (
    course_name VARCHAR,
    course_id VARCHAR
)

CREATE TABLE Student_Course_Enrolment (
    course_id VARCHAR
)

Response: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the name of the course that has the most student enrollment? ### Input: CREATE TABLE Courses (
    course_name VARCHAR,
    course_id VARCHAR
)

CREATE TABLE Student_Course_Enrolment (
    course_id VARCHAR
) ### Response: SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1


Instruction: What is the largest amount of wins that was before the 2007 season, as well as the Team being silverstone motorsport academy?

Input:
CREATE TABLE table_39196 (
    "Season" real,
    "Series" text,
    "Team" text,
    "Races" real,
    "Wins" real,
    "Poles" real,
    "Podiums" real
)

Response: SELECT MAX("Wins") FROM table_39196 WHERE "Season" < '2007' AND "Team" = 'silverstone motorsport academy'

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 largest amount of wins that was before the 2007 season, as well as the Team being silverstone motorsport academy? ### Input: CREATE TABLE table_39196 (
    "Season" real,
    "Series" text,
    "Team" text,
    "Races" real,
    "Wins" real,
    "Poles" real,
    "Podiums" real
) ### Response: SELECT MAX("Wins") FROM table_39196 WHERE "Season" < '2007' AND "Team" = 'silverstone motorsport academy'


Instruction: What away team has 7 as the tie no.?

Input:
CREATE TABLE table_name_38 (
    away_team VARCHAR,
    tie_no VARCHAR
)

Response: SELECT away_team FROM table_name_38 WHERE tie_no = "7"

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 away team has 7 as the tie no.? ### Input: CREATE TABLE table_name_38 (
    away_team VARCHAR,
    tie_no VARCHAR
) ### Response: SELECT away_team FROM table_name_38 WHERE tie_no = "7"


Instruction: male or female ages >= 3.5 years and <= 18 years on day of sepsis recognition

Input:
CREATE TABLE table_train_71 (
    "id" int,
    "gender" string,
    "language" string,
    "intention_to_arterial_catheter" bool,
    "renal_disease" bool,
    "sepsis" bool,
    "allergy_to_hydroxyethyl_starch" bool,
    "age" float,
    "NOUSE" float
)

Response: SELECT * FROM table_train_71 WHERE (gender = 'male' OR gender = 'female') AND (age >= 3.5 AND age <= 18) AND sepsis = 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: male or female ages >= 3.5 years and <= 18 years on day of sepsis recognition ### Input: CREATE TABLE table_train_71 (
    "id" int,
    "gender" string,
    "language" string,
    "intention_to_arterial_catheter" bool,
    "renal_disease" bool,
    "sepsis" bool,
    "allergy_to_hydroxyethyl_starch" bool,
    "age" float,
    "NOUSE" float
) ### Response: SELECT * FROM table_train_71 WHERE (gender = 'male' OR gender = 'female') AND (age >= 3.5 AND age <= 18) AND sepsis = 1


Instruction: Which year has a Round of 17?

Input:
CREATE TABLE table_67049 (
    "Quarter" text,
    "Score" text,
    "Club" text,
    "Opponent" text,
    "Year" text,
    "Round" text,
    "Venue" text
)

Response: SELECT "Year" FROM table_67049 WHERE "Round" = '17'

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 has a Round of 17? ### Input: CREATE TABLE table_67049 (
    "Quarter" text,
    "Score" text,
    "Club" text,
    "Opponent" text,
    "Year" text,
    "Round" text,
    "Venue" text
) ### Response: SELECT "Year" FROM table_67049 WHERE "Round" = '17'


Instruction: how many license plates were issued before 1960 ?

Input:
CREATE TABLE table_203_379 (
    id number,
    "first issued" text,
    "design" text,
    "slogan" text,
    "serial format" text,
    "serials issued" text,
    "notes" text
)

Response: SELECT COUNT(*) FROM table_203_379 WHERE "first issued" < 1960

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 license plates were issued before 1960 ? ### Input: CREATE TABLE table_203_379 (
    id number,
    "first issued" text,
    "design" text,
    "slogan" text,
    "serial format" text,
    "serials issued" text,
    "notes" text
) ### Response: SELECT COUNT(*) FROM table_203_379 WHERE "first issued" < 1960


Instruction: when was patient 035-24054's ventric #1 output for the last time on the current intensive care unit visit?

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

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

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

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

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

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

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

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

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

Response: SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-24054') AND patient.unitdischargetime IS NULL) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'ventric #1' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: when was patient 035-24054's ventric #1 output for the last time on the current intensive care unit visit? ### Input: CREATE TABLE cost (
    costid number,
    uniquepid text,
    patienthealthsystemstayid number,
    eventtype text,
    eventid number,
    chargetime time,
    cost number
)

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

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

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

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

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

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

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

CREATE TABLE 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
) ### Response: SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-24054') AND patient.unitdischargetime IS NULL) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'ventric #1' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1


Instruction: Which runner-up placed in a year prior to 2006 and whose Champion was Elon?

Input:
CREATE TABLE table_name_66 (
    runner_up VARCHAR,
    year VARCHAR,
    champion VARCHAR
)

Response: SELECT runner_up FROM table_name_66 WHERE year < 2006 AND champion = "elon"

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 runner-up placed in a year prior to 2006 and whose Champion was Elon? ### Input: CREATE TABLE table_name_66 (
    runner_up VARCHAR,
    year VARCHAR,
    champion VARCHAR
) ### Response: SELECT runner_up FROM table_name_66 WHERE year < 2006 AND champion = "elon"


Instruction: Which Touchdowns is the lowest one that has Points of 5, and a Field goals larger than 0?

Input:
CREATE TABLE table_name_81 (
    touchdowns INTEGER,
    points VARCHAR,
    field_goals VARCHAR
)

Response: SELECT MIN(touchdowns) FROM table_name_81 WHERE points = 5 AND field_goals > 0

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 Touchdowns is the lowest one that has Points of 5, and a Field goals larger than 0? ### Input: CREATE TABLE table_name_81 (
    touchdowns INTEGER,
    points VARCHAR,
    field_goals VARCHAR
) ### Response: SELECT MIN(touchdowns) FROM table_name_81 WHERE points = 5 AND field_goals > 0


Instruction: give me the number of patients whose admission location is transfer from hosp/extram and procedure icd9 code is 5781?

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

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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.icd9_code = "5781"

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 admission location is transfer from hosp/extram and procedure icd9 code is 5781? ### Input: 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
)

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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.icd9_code = "5781"


Instruction: i'm interested in a flight from DALLAS to WASHINGTON and i'm also interested in going to BALTIMORE

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

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

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

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

CREATE TABLE days (
    days_code varchar,
    day_name varchar
)

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

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

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

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

CREATE TABLE code_description (
    code varchar,
    description text
)

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

CREATE TABLE equipment_sequence (
    aircraft_code_sequence varchar,
    aircraft_code varchar
)

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

CREATE TABLE compartment_class (
    compartment varchar,
    class_type varchar
)

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

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

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

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

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

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

CREATE TABLE flight_fare (
    flight_id int,
    fare_id int
)

CREATE TABLE month (
    month_number int,
    month_name text
)

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

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

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

Response: SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight WHERE ((flight.to_airport = AIRPORT_SERVICE_1.airport_code AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON') OR (flight.to_airport = AIRPORT_SERVICE_2.airport_code AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'BALTIMORE')) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: i'm interested in a flight from DALLAS to WASHINGTON and i'm also interested in going to BALTIMORE ### Input: CREATE TABLE airline (
    airline_code varchar,
    airline_name text,
    note text
)

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

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

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

CREATE TABLE days (
    days_code varchar,
    day_name varchar
)

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

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

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

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

CREATE TABLE code_description (
    code varchar,
    description text
)

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

CREATE TABLE equipment_sequence (
    aircraft_code_sequence varchar,
    aircraft_code varchar
)

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

CREATE TABLE compartment_class (
    compartment varchar,
    class_type varchar
)

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

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

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

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

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

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

CREATE TABLE flight_fare (
    flight_id int,
    fare_id int
)

CREATE TABLE month (
    month_number int,
    month_name text
)

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

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

CREATE TABLE aircraft (
    aircraft_code varchar,
    aircraft_description varchar,
    manufacturer varchar,
    basic_type varchar,
    engines int,
    propulsion varchar,
    wide_body varchar,
    wing_span int,
    length int,
    weight int,
    capacity int,
    pay_load int,
    cruising_speed int,
    range_miles int,
    pressurized varchar
) ### Response: SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight WHERE ((flight.to_airport = AIRPORT_SERVICE_1.airport_code AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON') OR (flight.to_airport = AIRPORT_SERVICE_2.airport_code AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'BALTIMORE')) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code


Instruction: what is religion of subject id 26746?

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

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

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

Response: SELECT demographic.religion FROM demographic WHERE demographic.subject_id = "26746"

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 religion of subject id 26746? ### 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 procedures (
    subject_id text,
    hadm_id text,
    icd9_code text,
    short_title text,
    long_title text
)

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

CREATE TABLE 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
) ### Response: SELECT demographic.religion FROM demographic WHERE demographic.subject_id = "26746"


Instruction: who is the constructor when the laps is more than 72 and the driver is eddie irvine?

Input:
CREATE TABLE table_name_33 (
    constructor VARCHAR,
    laps VARCHAR,
    driver VARCHAR
)

Response: SELECT constructor FROM table_name_33 WHERE laps > 72 AND driver = "eddie irvine"

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: who is the constructor when the laps is more than 72 and the driver is eddie irvine? ### Input: CREATE TABLE table_name_33 (
    constructor VARCHAR,
    laps VARCHAR,
    driver VARCHAR
) ### Response: SELECT constructor FROM table_name_33 WHERE laps > 72 AND driver = "eddie irvine"


Instruction: What is the average total for teams with under 34 bronzes, 0 silver, and under 14 gold?

Input:
CREATE TABLE table_name_88 (
    total INTEGER,
    silver VARCHAR,
    bronze VARCHAR,
    gold VARCHAR
)

Response: SELECT AVG(total) FROM table_name_88 WHERE bronze < 34 AND gold < 14 AND silver < 0

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 average total for teams with under 34 bronzes, 0 silver, and under 14 gold? ### Input: CREATE TABLE table_name_88 (
    total INTEGER,
    silver VARCHAR,
    bronze VARCHAR,
    gold VARCHAR
) ### Response: SELECT AVG(total) FROM table_name_88 WHERE bronze < 34 AND gold < 14 AND silver < 0


Instruction: What are the highest points with a Chassis of gordini t16, and a Year smaller than 1954?

Input:
CREATE TABLE table_15405 (
    "Year" real,
    "Team" text,
    "Chassis" text,
    "Engine" text,
    "Points" real
)

Response: SELECT MAX("Points") FROM table_15405 WHERE "Chassis" = 'gordini t16' AND "Year" < '1954'

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 highest points with a Chassis of gordini t16, and a Year smaller than 1954? ### Input: CREATE TABLE table_15405 (
    "Year" real,
    "Team" text,
    "Chassis" text,
    "Engine" text,
    "Points" real
) ### Response: SELECT MAX("Points") FROM table_15405 WHERE "Chassis" = 'gordini t16' AND "Year" < '1954'


Instruction: Who wrote the episodes with 7.70 u.s. viewers (million) ?

Input:
CREATE TABLE table_29318 (
    "No. in series" real,
    "No. in season" real,
    "Title" text,
    "Directed by" text,
    "Written by" text,
    "Original air date" text,
    "Production code" text,
    "U.S. viewers (million)" text
)

Response: SELECT "Written by" FROM table_29318 WHERE "U.S. viewers (million)" = '7.70'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who wrote the episodes with 7.70 u.s. viewers (million) ? ### Input: CREATE TABLE table_29318 (
    "No. in series" real,
    "No. in season" real,
    "Title" text,
    "Directed by" text,
    "Written by" text,
    "Original air date" text,
    "Production code" text,
    "U.S. viewers (million)" text
) ### Response: SELECT "Written by" FROM table_29318 WHERE "U.S. viewers (million)" = '7.70'


Instruction: calculate the total number of patients diagnosed with other b-complex deficiencies

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 prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

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

CREATE TABLE 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.long_title = "Other B-complex deficiencies"

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: calculate the total number of patients diagnosed with other b-complex deficiencies ### 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 prescriptions (
    subject_id text,
    hadm_id text,
    icustay_id text,
    drug_type text,
    drug text,
    formulary_drug_cd text,
    route text,
    drug_dose text
)

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

CREATE TABLE 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.long_title = "Other B-complex deficiencies"


Instruction: What super g was before 1998, had 2 giant slaloms and 24 downhills?

Input:
CREATE TABLE table_68185 (
    "Season" real,
    "Overall" text,
    "Slalom" text,
    "Giant Slalom" text,
    "Super G" text,
    "Downhill" text,
    "Combined" text
)

Response: SELECT "Super G" FROM table_68185 WHERE "Season" < '1998' AND "Giant Slalom" = '2' AND "Downhill" = '24'

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 super g was before 1998, had 2 giant slaloms and 24 downhills? ### Input: CREATE TABLE table_68185 (
    "Season" real,
    "Overall" text,
    "Slalom" text,
    "Giant Slalom" text,
    "Super G" text,
    "Downhill" text,
    "Combined" text
) ### Response: SELECT "Super G" FROM table_68185 WHERE "Season" < '1998' AND "Giant Slalom" = '2' AND "Downhill" = '24'


Instruction: Which pick's round was 5 when Kellen Davis was a player?

Input:
CREATE TABLE table_name_40 (
    pick VARCHAR,
    round VARCHAR,
    player VARCHAR
)

Response: SELECT pick FROM table_name_40 WHERE round = "5" AND player = "kellen davis"

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 pick's round was 5 when Kellen Davis was a player? ### Input: CREATE TABLE table_name_40 (
    pick VARCHAR,
    round VARCHAR,
    player VARCHAR
) ### Response: SELECT pick FROM table_name_40 WHERE round = "5" AND player = "kellen davis"


Instruction: What is the name of the episode that was written by Michael Rauch?

Input:
CREATE TABLE table_23117208_5 (
    title VARCHAR,
    written_by VARCHAR
)

Response: SELECT title FROM table_23117208_5 WHERE written_by = "Michael Rauch"

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 name of the episode that was written by Michael Rauch? ### Input: CREATE TABLE table_23117208_5 (
    title VARCHAR,
    written_by VARCHAR
) ### Response: SELECT title FROM table_23117208_5 WHERE written_by = "Michael Rauch"


Instruction: What was the away team score when the home team was Carlton?

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

Response: SELECT "Away team score" FROM table_32413 WHERE "Home team" = 'carlton'

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 away team score when the home team was Carlton? ### Input: CREATE TABLE table_32413 (
    "Home team" text,
    "Home team score" text,
    "Away team" text,
    "Away team score" text,
    "Venue" text,
    "Crowd" real,
    "Date" text
) ### Response: SELECT "Away team score" FROM table_32413 WHERE "Home team" = 'carlton'


Instruction: What is every 5-year peak when Emanuel Lasker, 2847 is the 10-year peak?

Input:
CREATE TABLE table_21323 (
    "Rank" real,
    "1-year peak" text,
    "5-year peak" text,
    "10-year peak" text,
    "15-year peak" text,
    "20-year peak" text
)

Response: SELECT "5-year peak" FROM table_21323 WHERE "10-year peak" = 'Emanuel Lasker, 2847'

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is every 5-year peak when Emanuel Lasker, 2847 is the 10-year peak? ### Input: CREATE TABLE table_21323 (
    "Rank" real,
    "1-year peak" text,
    "5-year peak" text,
    "10-year peak" text,
    "15-year peak" text,
    "20-year peak" text
) ### Response: SELECT "5-year peak" FROM table_21323 WHERE "10-year peak" = 'Emanuel Lasker, 2847'


Instruction: List people who signed up during private beta.

Input:
CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

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

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

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

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

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 ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

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

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

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

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

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

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

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 PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    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 VoteTypes (
    Id number,
    Name text
)

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 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 PostNotices (
    Id number,
    PostId number,
    PostNoticeTypeId number,
    CreationDate time,
    DeletionDate time,
    ExpiryDate time,
    Body text,
    OwnerUserId number,
    DeletionUserId number
)

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 CloseReasonTypes (
    Id number,
    Name text,
    Description 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 PostTags (
    PostId number,
    TagId number
)

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

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

CREATE TABLE PostTypes (
    Id number,
    Name text
)

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

Response: SELECT u.Id AS "user_link", u.Id, u.CreationDate FROM Users AS u WHERE u.CreationDate < '2011-08-30 00:00:00.00'

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 people who signed up during private beta. ### Input: CREATE TABLE PostHistoryTypes (
    Id number,
    Name text
)

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

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

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

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

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 ReviewTaskResults (
    Id number,
    ReviewTaskId number,
    ReviewTaskResultTypeId number,
    CreationDate time,
    RejectionReasonId number,
    Comment text
)

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

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

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

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

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

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

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 PostHistory (
    Id number,
    PostHistoryTypeId number,
    PostId number,
    RevisionGUID other,
    CreationDate time,
    UserId number,
    UserDisplayName text,
    Comment text,
    Text text,
    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 VoteTypes (
    Id number,
    Name text
)

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 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 PostNotices (
    Id number,
    PostId number,
    PostNoticeTypeId number,
    CreationDate time,
    DeletionDate time,
    ExpiryDate time,
    Body text,
    OwnerUserId number,
    DeletionUserId number
)

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 CloseReasonTypes (
    Id number,
    Name text,
    Description 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 PostTags (
    PostId number,
    TagId number
)

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

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

CREATE TABLE PostTypes (
    Id number,
    Name text
)

CREATE TABLE Badges (
    Id number,
    UserId number,
    Name text,
    Date time,
    Class number,
    TagBased boolean
) ### Response: SELECT u.Id AS "user_link", u.Id, u.CreationDate FROM Users AS u WHERE u.CreationDate < '2011-08-30 00:00:00.00'


Instruction: how old is each student and how many students are each age?

Input:
CREATE TABLE Has_Allergy (
    StuID INTEGER,
    Allergy VARCHAR(20)
)

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

CREATE TABLE Allergy_Type (
    Allergy VARCHAR(20),
    AllergyType VARCHAR(20)
)

Response: SELECT Age, COUNT(*) FROM Student GROUP BY Age

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 old is each student and how many students are each age? ### Input: CREATE TABLE Has_Allergy (
    StuID INTEGER,
    Allergy VARCHAR(20)
)

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

CREATE TABLE Allergy_Type (
    Allergy VARCHAR(20),
    AllergyType VARCHAR(20)
) ### Response: SELECT Age, COUNT(*) FROM Student GROUP BY Age


Instruction: For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, show me the trend about department_id over hire_date with a line chart, show by the x-axis in desc.

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

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

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

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

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

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

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

Response: SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE DESC

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, show me the trend about department_id over hire_date with a line chart, show by the x-axis in desc. ### Input: CREATE TABLE countries (
    COUNTRY_ID varchar(2),
    COUNTRY_NAME varchar(40),
    REGION_ID decimal(10,0)
)

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

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

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

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

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

CREATE TABLE jobs (
    JOB_ID varchar(10),
    JOB_TITLE varchar(35),
    MIN_SALARY decimal(6,0),
    MAX_SALARY decimal(6,0)
) ### Response: SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE DESC


Instruction: What is the total number of Games, when Rank is less than 4, and when Rebounds is less than 102?

Input:
CREATE TABLE table_40605 (
    "Rank" real,
    "Name" text,
    "Team" text,
    "Games" real,
    "Rebounds" real
)

Response: SELECT COUNT("Games") FROM table_40605 WHERE "Rank" < '4' AND "Rebounds" < '102'

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 total number of Games, when Rank is less than 4, and when Rebounds is less than 102? ### Input: CREATE TABLE table_40605 (
    "Rank" real,
    "Name" text,
    "Team" text,
    "Games" real,
    "Rebounds" real
) ### Response: SELECT COUNT("Games") FROM table_40605 WHERE "Rank" < '4' AND "Rebounds" < '102'


Instruction: Which Pictorials has a 20 Questions of eva longoria?

Input:
CREATE TABLE table_39930 (
    "Date" text,
    "Centerfold model" text,
    "Interview subject" text,
    "20 Questions" text,
    "Pictorials" text
)

Response: SELECT "Pictorials" FROM table_39930 WHERE "20 Questions" = 'eva longoria'

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 Pictorials has a 20 Questions of eva longoria? ### Input: CREATE TABLE table_39930 (
    "Date" text,
    "Centerfold model" text,
    "Interview subject" text,
    "20 Questions" text,
    "Pictorials" text
) ### Response: SELECT "Pictorials" FROM table_39930 WHERE "20 Questions" = 'eva longoria'


Instruction: What is the nomination title used for the original film, Monsieur Hawarden?

Input:
CREATE TABLE table_name_18 (
    film_title_used_in_nomination VARCHAR,
    original_title VARCHAR
)

Response: SELECT film_title_used_in_nomination FROM table_name_18 WHERE original_title = "monsieur hawarden"

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 nomination title used for the original film, Monsieur Hawarden? ### Input: CREATE TABLE table_name_18 (
    film_title_used_in_nomination VARCHAR,
    original_title VARCHAR
) ### Response: SELECT film_title_used_in_nomination FROM table_name_18 WHERE original_title = "monsieur hawarden"


Instruction: What was the net capacity with a gross capacity of 1,126 mw, and a Unit of tianwan-4?

Input:
CREATE TABLE table_name_74 (
    net_capacity VARCHAR,
    gross_capacity VARCHAR,
    unit VARCHAR
)

Response: SELECT net_capacity FROM table_name_74 WHERE gross_capacity = "1,126 mw" AND unit = "tianwan-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 was the net capacity with a gross capacity of 1,126 mw, and a Unit of tianwan-4? ### Input: CREATE TABLE table_name_74 (
    net_capacity VARCHAR,
    gross_capacity VARCHAR,
    unit VARCHAR
) ### Response: SELECT net_capacity FROM table_name_74 WHERE gross_capacity = "1,126 mw" AND unit = "tianwan-4"


Instruction: Name the 10:30 for 8:00 of charmed

Input:
CREATE TABLE table_5084 (
    "7:00" text,
    "7:30" text,
    "8:00" text,
    "8:30" text,
    "9:00" text,
    "10:00" text,
    "10:30" text
)

Response: SELECT "10:30" FROM table_5084 WHERE "8:00" = 'charmed'

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 10:30 for 8:00 of charmed ### Input: CREATE TABLE table_5084 (
    "7:00" text,
    "7:30" text,
    "8:00" text,
    "8:30" text,
    "9:00" text,
    "10:00" text,
    "10:30" text
) ### Response: SELECT "10:30" FROM table_5084 WHERE "8:00" = 'charmed'


Instruction: what was the last winner 's album name ?

Input:
CREATE TABLE table_204_655 (
    id number,
    "year" number,
    "winner" text,
    "album" text,
    "other finalists" text
)

Response: SELECT "album" FROM table_204_655 ORDER BY "year" DESC LIMIT 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the last winner 's album name ? ### Input: CREATE TABLE table_204_655 (
    id number,
    "year" number,
    "winner" text,
    "album" text,
    "other finalists" text
) ### Response: SELECT "album" FROM table_204_655 ORDER BY "year" DESC LIMIT 1


Instruction: How many Silver medals were won in total by all those with more than 3 bronze and exactly 16 gold?

Input:
CREATE TABLE table_80452 (
    "Rank" real,
    "Nation" text,
    "Gold" real,
    "Silver" real,
    "Bronze" real,
    "Total" real
)

Response: SELECT SUM("Silver") FROM table_80452 WHERE "Bronze" > '3' AND "Gold" = '16'

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 Silver medals were won in total by all those with more than 3 bronze and exactly 16 gold? ### Input: CREATE TABLE table_80452 (
    "Rank" real,
    "Nation" text,
    "Gold" real,
    "Silver" real,
    "Bronze" real,
    "Total" real
) ### Response: SELECT SUM("Silver") FROM table_80452 WHERE "Bronze" > '3' AND "Gold" = '16'


Instruction: Name the memory for frequency of 1.6 ghz

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

Response: SELECT "Memory" FROM table_21021 WHERE "Frequency" = '1.6 GHz'

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 memory for frequency of 1.6 ghz ### Input: CREATE TABLE table_21021 (
    "Model number" text,
    "sSpec number" text,
    "Frequency" text,
    "GPU frequency" text,
    "L2 cache" text,
    "I/O bus" text,
    "Memory" text,
    "Voltage" text,
    "TDP" text,
    "Socket" text,
    "Release date" text,
    "Part number(s)" text,
    "Release price ( USD )" text
) ### Response: SELECT "Memory" FROM table_21021 WHERE "Frequency" = '1.6 GHz'


Instruction: what is the name of procedure patient 51200 has been given two times last month?

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

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

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

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

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 chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

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 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 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 labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom 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_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title 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 transfers (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    eventtype text,
    careunit text,
    wardid number,
    intime time,
    outtime time
)

Response: SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51200) AND DATETIME(procedures_icd.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the name of procedure patient 51200 has been given two times last month? ### Input: CREATE TABLE microbiologyevents (
    row_id number,
    subject_id number,
    hadm_id number,
    charttime time,
    spec_type_desc text,
    org_name text
)

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

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

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

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 chartevents (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom text
)

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 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 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 labevents (
    row_id number,
    subject_id number,
    hadm_id number,
    itemid number,
    charttime time,
    valuenum number,
    valueuom 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_icd_diagnoses (
    row_id number,
    icd9_code text,
    short_title text,
    long_title 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 transfers (
    row_id number,
    subject_id number,
    hadm_id number,
    icustay_id number,
    eventtype text,
    careunit text,
    wardid number,
    intime time,
    outtime time
) ### Response: SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51200) AND DATETIME(procedures_icd.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)


Instruction: What is the Competition for Season 2002 03, and the Opponent was zenit st. petersburg?

Input:
CREATE TABLE table_name_86 (
    competition VARCHAR,
    season VARCHAR,
    opponent VARCHAR
)

Response: SELECT competition FROM table_name_86 WHERE season = "2002–03" AND opponent = "zenit st. petersburg"

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 Competition for Season 2002 03, and the Opponent was zenit st. petersburg? ### Input: CREATE TABLE table_name_86 (
    competition VARCHAR,
    season VARCHAR,
    opponent VARCHAR
) ### Response: SELECT competition FROM table_name_86 WHERE season = "2002–03" AND opponent = "zenit st. petersburg"


Instruction: Which Name has Apparent Magnitude smaller than 11.4, and R.A. (J2000) of 04h17m35.8s?

Input:
CREATE TABLE table_name_75 (
    name VARCHAR,
    apparent_magnitude VARCHAR,
    ra___j2000__ VARCHAR
)

Response: SELECT name FROM table_name_75 WHERE apparent_magnitude < 11.4 AND ra___j2000__ = "04h17m35.8s"

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 Name has Apparent Magnitude smaller than 11.4, and R.A. (J2000) of 04h17m35.8s? ### Input: CREATE TABLE table_name_75 (
    name VARCHAR,
    apparent_magnitude VARCHAR,
    ra___j2000__ VARCHAR
) ### Response: SELECT name FROM table_name_75 WHERE apparent_magnitude < 11.4 AND ra___j2000__ = "04h17m35.8s"


Instruction: What is the sum of the area values for districts having density over 462 and websites of http://krishna.nic.in/?

Input:
CREATE TABLE table_name_19 (
    area__km²_ INTEGER,
    density___km²_ VARCHAR,
    official_website VARCHAR
)

Response: SELECT SUM(area__km²_) FROM table_name_19 WHERE density___km²_ > 462 AND official_website = "http://krishna.nic.in/"

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 the area values for districts having density over 462 and websites of http://krishna.nic.in/? ### Input: CREATE TABLE table_name_19 (
    area__km²_ INTEGER,
    density___km²_ VARCHAR,
    official_website VARCHAR
) ### Response: SELECT SUM(area__km²_) FROM table_name_19 WHERE density___km²_ > 462 AND official_website = "http://krishna.nic.in/"


Instruction: Which Wins have a Win % smaller than 0.8270000000000001, and a Name of rick mirer, and Ties smaller than 1?

Input:
CREATE TABLE table_name_17 (
    wins INTEGER,
    ties VARCHAR,
    win__percentage VARCHAR,
    name VARCHAR
)

Response: SELECT SUM(wins) FROM table_name_17 WHERE win__percentage < 0.8270000000000001 AND name = "rick mirer" AND ties < 1

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which Wins have a Win % smaller than 0.8270000000000001, and a Name of rick mirer, and Ties smaller than 1? ### Input: CREATE TABLE table_name_17 (
    wins INTEGER,
    ties VARCHAR,
    win__percentage VARCHAR,
    name VARCHAR
) ### Response: SELECT SUM(wins) FROM table_name_17 WHERE win__percentage < 0.8270000000000001 AND name = "rick mirer" AND ties < 1


Instruction: What is the long-term capital gain rate when the long-term gain on commercial buildings is 25% and long term gain on collectibles is 28% while short-term capital gain rate is 33%?

Input:
CREATE TABLE table_55784 (
    "Ordinary income rate" text,
    "Long-term capital gain rate" text,
    "Short-term capital gain rate" text,
    "Long-term gain on commercial buildings*" text,
    "Long-term gain on collectibles" text
)

Response: SELECT "Long-term capital gain rate" FROM table_55784 WHERE "Long-term gain on commercial buildings*" = '25%' AND "Long-term gain on collectibles" = '28%' AND "Short-term capital gain rate" = '33%'

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 long-term capital gain rate when the long-term gain on commercial buildings is 25% and long term gain on collectibles is 28% while short-term capital gain rate is 33%? ### Input: CREATE TABLE table_55784 (
    "Ordinary income rate" text,
    "Long-term capital gain rate" text,
    "Short-term capital gain rate" text,
    "Long-term gain on commercial buildings*" text,
    "Long-term gain on collectibles" text
) ### Response: SELECT "Long-term capital gain rate" FROM table_55784 WHERE "Long-term gain on commercial buildings*" = '25%' AND "Long-term gain on collectibles" = '28%' AND "Short-term capital gain rate" = '33%'


Instruction: What is the number of the player who attended Delta State?

Input:
CREATE TABLE table_20200 (
    "Player" text,
    "No." real,
    "Nationality" text,
    "Position" text,
    "Years in Orlando" text,
    "School/Club Team" text
)

Response: SELECT MAX("No.") FROM table_20200 WHERE "School/Club Team" = 'Delta State'

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 the player who attended Delta State? ### Input: CREATE TABLE table_20200 (
    "Player" text,
    "No." real,
    "Nationality" text,
    "Position" text,
    "Years in Orlando" text,
    "School/Club Team" text
) ### Response: SELECT MAX("No.") FROM table_20200 WHERE "School/Club Team" = 'Delta State'


Instruction: What is the to par of the player with more than $4,100 and a score of 69-67-72-70=278?

Input:
CREATE TABLE table_48568 (
    "Place" text,
    "Player" text,
    "Country" text,
    "Score" text,
    "To par" text,
    "Money ( $ )" real
)

Response: SELECT "To par" FROM table_48568 WHERE "Money ( $ )" > '4,100' AND "Score" = '69-67-72-70=278'

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 to par of the player with more than $4,100 and a score of 69-67-72-70=278? ### Input: CREATE TABLE table_48568 (
    "Place" text,
    "Player" text,
    "Country" text,
    "Score" text,
    "To par" text,
    "Money ( $ )" real
) ### Response: SELECT "To par" FROM table_48568 WHERE "Money ( $ )" > '4,100' AND "Score" = '69-67-72-70=278'


Instruction: Show name and distance for all aircrafts by a bar chart, list by the y axis in ascending please.

Input:
CREATE TABLE employee (
    eid number(9,0),
    name varchar2(30),
    salary number(10,2)
)

CREATE TABLE aircraft (
    aid number(9,0),
    name varchar2(30),
    distance number(6,0)
)

CREATE TABLE certificate (
    eid number(9,0),
    aid number(9,0)
)

CREATE TABLE flight (
    flno number(4,0),
    origin varchar2(20),
    destination varchar2(20),
    distance number(6,0),
    departure_date date,
    arrival_date date,
    price number(7,2),
    aid number(9,0)
)

Response: SELECT name, distance FROM aircraft ORDER BY distance

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show name and distance for all aircrafts by a bar chart, list by the y axis in ascending please. ### Input: CREATE TABLE employee (
    eid number(9,0),
    name varchar2(30),
    salary number(10,2)
)

CREATE TABLE aircraft (
    aid number(9,0),
    name varchar2(30),
    distance number(6,0)
)

CREATE TABLE certificate (
    eid number(9,0),
    aid number(9,0)
)

CREATE TABLE flight (
    flno number(4,0),
    origin varchar2(20),
    destination varchar2(20),
    distance number(6,0),
    departure_date date,
    arrival_date date,
    price number(7,2),
    aid number(9,0)
) ### Response: SELECT name, distance FROM aircraft ORDER BY distance


Instruction: Name the regions for usf45

Input:
CREATE TABLE table_21530474_1 (
    region_s_ VARCHAR,
    chassis_code VARCHAR
)

Response: SELECT region_s_ FROM table_21530474_1 WHERE chassis_code = "USF45"

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 regions for usf45 ### Input: CREATE TABLE table_21530474_1 (
    region_s_ VARCHAR,
    chassis_code VARCHAR
) ### Response: SELECT region_s_ FROM table_21530474_1 WHERE chassis_code = "USF45"


Instruction: How many laps for robin montgomerie-charrington, and a Grid smaller than 15?

Input:
CREATE TABLE table_name_18 (
    laps VARCHAR,
    driver VARCHAR,
    grid VARCHAR
)

Response: SELECT COUNT(laps) FROM table_name_18 WHERE driver = "robin montgomerie-charrington" AND grid < 15

Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many laps for robin montgomerie-charrington, and a Grid smaller than 15? ### Input: CREATE TABLE table_name_18 (
    laps VARCHAR,
    driver VARCHAR,
    grid VARCHAR
) ### Response: SELECT COUNT(laps) FROM table_name_18 WHERE driver = "robin montgomerie-charrington" AND grid < 15