Updated SQL and database