Update query.sql - Added missing field validation