create the database functions