SQL: database corrections