-- Language PostgreSQL
        -- Tables: 
             -- Table: all star 
columns : [['player id', 'text'], ['year', 'number'], ['game num', 'number'], ['game id', 'text'], ['team id', 'text'], ['league id', 'text'], ['gp', 'number'], ['starting pos', 'number']]

 -- Table: appearances 
columns : [['year', 'number'], ['team id', 'text'], ['league id', 'text'], ['player id', 'text'], ['g all', 'number'], ['gs', 'number'], ['g batting', 'number'], ['g defense', 'number'], ['g p', 'number'], ['g c', 'number'], ['g 1b', 'number'], ['g 2b', 'number'], ['g 3b', 'number'], ['g ss', 'number'], ['g lf', 'number'], ['g cf', 'number'], ['g rf', 'number'], ['g of', 'number'], ['g dh', 'number'], ['g ph', 'number'], ['g pr', 'number']]

 -- Table: manager award 
columns : [['player id', 'text'], ['award id', 'text'], ['year', 'number'], ['league id', 'text'], ['tie', 'text'], ['notes', 'number']]

 -- Table: player award 
columns : [['player id', 'text'], ['award id', 'text'], ['year', 'number'], ['league id', 'text'], ['tie', 'text'], ['notes', 'text']]

 -- Table: manager award vote 
columns : [['award id', 'text'], ['year', 'number'], ['league id', 'text'], ['player id', 'text'], ['points won', 'number'], ['points max', 'number'], ['votes first', 'number']]

 -- Table: player award vote 
columns : [['award id', 'text'], ['year', 'number'], ['league id', 'text'], ['player id', 'text'], ['points won', 'number'], ['points max', 'number'], ['votes first', 'number']]

 -- Table: batting 
columns : [['player id', 'text'], ['year', 'number'], ['stint', 'number'], ['team id', 'text'], ['league id', 'text'], ['g', 'number'], ['ab', 'number'], ['r', 'number'], ['h', 'number'], ['double', 'number'], ['triple', 'number'], ['hr', 'number'], ['rbi', 'number'], ['sb', 'number'], ['cs', 'number'], ['bb', 'number'], ['so', 'number'], ['ibb', 'number'], ['hbp', 'number'], ['sh', 'number'], ['sf', 'number'], ['g idp', 'number']]

 -- Table: batting postseason 
columns : [['year', 'number'], ['round', 'text'], ['player id', 'text'], ['team id', 'text'], ['league id', 'text'], ['g', 'number'], ['ab', 'number'], ['r', 'number'], ['h', 'number'], ['double', 'number'], ['triple', 'number'], ['hr', 'number'], ['rbi', 'number'], ['sb', 'number'], ['cs', 'number'], ['bb', 'number'], ['so', 'number'], ['ibb', 'number'], ['hbp', 'number'], ['sh', 'number'], ['sf', 'number'], ['g idp', 'number']]

 -- Table: player college 
columns : [['player id', 'text'], ['college id', 'text'], ['year', 'number']]

 -- Table: fielding 
columns : [['player id', 'text'], ['year', 'number'], ['stint', 'number'], ['team id', 'text'], ['league id', 'text'], ['pos', 'text'], ['g', 'number'], ['gs', 'number'], ['inn outs', 'number'], ['po', 'number'], ['a', 'number'], ['e', 'number'], ['dp', 'number'], ['pb', 'number'], ['wp', 'number'], ['sb', 'number'], ['cs', 'number'], ['zr', 'number']]

 -- Table: fielding outfield 
columns : [['player id', 'text'], ['year', 'number'], ['stint', 'number'], ['glf', 'number'], ['gcf', 'number'], ['grf', 'number']]

 -- Table: fielding postseason 
columns : [['player id', 'text'], ['year', 'number'], ['team id', 'text'], ['league id', 'text'], ['round', 'text'], ['pos', 'text'], ['g', 'number'], ['gs', 'number'], ['inn outs', 'number'], ['po', 'number'], ['a', 'number'], ['e', 'number'], ['dp', 'number'], ['tp', 'number'], ['pb', 'number'], ['sb', 'number'], ['cs', 'number']]

 -- Table: hall of fame 
columns : [['player id', 'text'], ['yearid', 'number'], ['votedby', 'text'], ['ballots', 'number'], ['needed', 'number'], ['votes', 'number'], ['inducted', 'text'], ['category', 'text'], ['needed note', 'text']]

 -- Table: home game 
columns : [['year', 'number'], ['league id', 'text'], ['team id', 'text'], ['park id', 'text'], ['span first', 'text'], ['span last', 'text'], ['games', 'number'], ['openings', 'number'], ['attendance', 'number']]

 -- Table: manager 
columns : [['player id', 'text'], ['year', 'number'], ['team id', 'text'], ['league id', 'text'], ['inseason', 'number'], ['g', 'number'], ['w', 'number'], ['l', 'number'], ['rank', 'number'], ['plyr mgr', 'text']]

 -- Table: manager half 
columns : [['player id', 'text'], ['year', 'number'], ['team id', 'text'], ['league id', 'text'], ['inseason', 'number'], ['half', 'number'], ['g', 'number'], ['w', 'number'], ['l', 'number'], ['rank', 'number']]

 -- Table: player 
columns : [['player id', 'text'], ['birth year', 'number'], ['birth month', 'number'], ['birth day', 'number'], ['birth country', 'text'], ['birth state', 'text'], ['birth city', 'text'], ['death year', 'number'], ['death month', 'number'], ['death day', 'number'], ['death country', 'text'], ['death state', 'text'], ['death city', 'text'], ['name first', 'text'], ['name last', 'text'], ['name given', 'text'], ['weight', 'number'], ['height', 'number'], ['bats', 'text'], ['throws', 'text'], ['debut', 'text'], ['final game', 'text'], ['retro id', 'text'], ['bbref id', 'text']]

 -- Table: park 
columns : [['park id', 'text'], ['park name', 'text'], ['park alias', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text']]

 -- Table: pitching 
columns : [['player id', 'text'], ['year', 'number'], ['stint', 'number'], ['team id', 'text'], ['league id', 'text'], ['w', 'number'], ['l', 'number'], ['g', 'number'], ['gs', 'number'], ['cg', 'number'], ['sho', 'number'], ['sv', 'number'], ['ipouts', 'number'], ['h', 'number'], ['er', 'number'], ['hr', 'number'], ['bb', 'number'], ['so', 'number'], ['baopp', 'number'], ['era', 'number'], ['ibb', 'number'], ['wp', 'number'], ['hbp', 'number'], ['bk', 'number'], ['bfp', 'number'], ['gf', 'number'], ['r', 'number'], ['sh', 'number'], ['sf', 'number'], ['g idp', 'number']]

 -- Table: pitching postseason 
columns : [['player id', 'text'], ['year', 'number'], ['round', 'text'], ['team id', 'text'], ['league id', 'text'], ['w', 'number'], ['l', 'number'], ['g', 'number'], ['gs', 'number'], ['cg', 'number'], ['sho', 'number'], ['sv', 'number'], ['ipouts', 'number'], ['h', 'number'], ['er', 'number'], ['hr', 'number'], ['bb', 'number'], ['so', 'number'], ['baopp', 'text'], ['era', 'number'], ['ibb', 'number'], ['wp', 'number'], ['hbp', 'number'], ['bk', 'number'], ['bfp', 'number'], ['gf', 'number'], ['r', 'number'], ['sh', 'number'], ['sf', 'number'], ['g idp', 'number']]

 -- Table: salary 
columns : [['year', 'number'], ['team id', 'text'], ['league id', 'text'], ['player id', 'text'], ['salary', 'number']]

 -- Table: college 
columns : [['college id', 'text'], ['name full', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text']]

 -- Table: postseason 
columns : [['year', 'number'], ['round', 'text'], ['team id winner', 'text'], ['league id winner', 'text'], ['team id loser', 'text'], ['league id loser', 'text'], ['wins', 'number'], ['losses', 'number'], ['ties', 'number']]

 -- Table: team 
columns : [['year', 'number'], ['league id', 'text'], ['team id', 'text'], ['franchise id', 'text'], ['div id', 'text'], ['rank', 'number'], ['g', 'number'], ['ghome', 'number'], ['w', 'number'], ['l', 'number'], ['div win', 'text'], ['wc win', 'text'], ['lg win', 'text'], ['ws win', 'text'], ['r', 'number'], ['ab', 'number'], ['h', 'number'], ['double', 'number'], ['triple', 'number'], ['hr', 'number'], ['bb', 'number'], ['so', 'number'], ['sb', 'number'], ['cs', 'number'], ['hbp', 'number'], ['sf', 'number'], ['ra', 'number'], ['er', 'number'], ['era', 'number'], ['cg', 'number'], ['sho', 'number'], ['sv', 'number'], ['ipouts', 'number'], ['ha', 'number'], ['hra', 'number'], ['bba', 'number'], ['soa', 'number'], ['e', 'number'], ['dp', 'number'], ['fp', 'number'], ['name', 'text'], ['park', 'text'], ['attendance', 'number'], ['bpf', 'number'], ['ppf', 'number'], ['team id br', 'text'], ['team id lahman45', 'text'], ['team id retro', 'text']]

 -- Table: team franchise 
columns : [['franchise id', 'text'], ['franchise name', 'text'], ['active', 'text'], ['na assoc', 'text']]

 -- Table: team half 
columns : [['year', 'number'], ['league id', 'text'], ['team id', 'text'], ['half', 'number'], ['div id', 'text'], ['div win', 'text'], ['rank', 'number'], ['g', 'number'], ['w', 'number'], ['l', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the number of team franchises that are active (have 'Y' as "active" information).
SQL: SELECT count(*) FROM team_franchise WHERE active = 'Y';