correct database queries