sql for tables created
added small changes to support file input redirection.