We have a rather antiquated database that contains a large number of individuals along with a number of achievements that they have completed. There has historically been little done to discourage duplicated individual data so we've ended up in a situation where our data is quite dirty. A massively simplified version of this can be found here.
We're now redesigning the schema and user interface. We will be providing the user with a tool to merge their individuals together. In the provided example, Dave and David are clearly the same person and has achieved 4 achievements in total.
Given that users make mistakes and that there are a lot more tables involved than in the example, I'm looking for a schema design that facilitates easy merging of data, and notably, un-merging of data if (when!) the user inevitably makes a mistake.
Linked lists of some sort appear to be a solution but aren't exactly efficient for this use case. Are there any other concepts that might lend themselves to this situation? Any specific design patterns that might be appropriate?
Edit: As SQLFiddle is being rather flaky today here's the create/insert/select sql that was on sqlfiddle:
CREATE TABLE individual
(`individual_id` int, `forename` varchar(50), `surname` varchar(50))
;
CREATE TABLE achievement
(`achievement_id` int, `name` varchar(50), `description` varchar(50))
;
CREATE TABLE individual_achievement
(`individual_id` int,`achievement_id` int)
;
INSERT INTO individual
(`individual_id`, `forename`, `surname`)
VALUES
(1, 'Dave', 'Deane'),
(2, 'David', 'Deane')
;
INSERT INTO achievement
(`achievement_id`, `name`, `description`)
VALUES
(1, 'unit_1', 'Unit 1'),
(2, 'unit_2', 'Unit 2'),
(3, 'unit_3', 'Unit 3'),
(4, 'unit_4', 'Unit 4')
;
INSERT INTO individual_achievement
(`individual_id`,`achievement_id`)
VALUES
(1, 1),
(1, 3),
(2, 2),
(2, 4)
;
select * from individual i
join individual_achievement ai using (individual_id)
join achievement a using (achievement_id)
Edit 2: Just found this very similar question, hoping in 4 years there might other solutions too.