database queries skeleton