Database query update