Fixed the SQL statements to use the correct database