Updated delete query and primary key

by Shigang