updated version of the database sql statements