It is completely legal for two different people named "John Smith" to study in the same year on the same university. The table should have had unique person IDs in the first place. There is no reliable way to recreate them.