Updated code for SQL TASK