The Home Depot interview question

Removing duplicate record using query