update database query tips