modified view creation scripts to use ansi standard sql extract functions (compatible with both psql and mysql)