okay, here’s one for you
let’s suppose you want a forum database, which will have forums, threads, and posts
each forum can have multiple threads, and each thread can have multiple posts
okay, starting with the forum, the most obvious natural key would be the forum name, and since we don’t want two forums with exactly the same name, that makes an excellent primary key, albeit somewhat long – let’s say VARCHAR(255) to cover the longest name
now we move to the threads – each thread belongs to one and only one forum, but here the thread name is not sufficiently unique to be the primary key, since it is quite conceivable for two different forums to have threads with the same name (e.g. the same “rules for this forum” name on a sticky thread in each forum)
so therefore the primary key of the threads table has to be a compound key consisting of the forum name and the thread name
now we move to the posts table, and i’m sure even you can see what’s coming next – further additional column(s) to go along with the forum name and thread name, additional columns which would make each post unique
now all i want to do is bring up the scenario of the user interface which allows someone to bookmark a particular post
what is the url for the post? well, obvioulsy, it’s not going to look anything like vBulletin’s urls, where you will see http://example.com/forums/showpost.php?p=4630669 or http://example.com/forums/showthread.php?t=685470
in fact, the only way to reference a particular row in any of the forums, threads, or posts tables, is with the rather unfortunately looooooooooooong urls consisting in some cases of multiple VARCHAR(255) values concatenated together
when we end up with unweildy primary keys coming out of our normalized, natural key database design like this, surrogate keys are a blessing
and in fact this argument holds for countless examples in real life, where surrogate keys are used
once again, i am going to call you out on something you said –
Also while I have seen contrived theoretical database designs where a surrogate key would be useful, I have never come across such a situation where one would be useful in any of the real world databases I have worked with over the last thirty or so years. (emphasis added)
either you have once again larded your comment with egregious hyperbole, or you have truly never worked with any real database of any real import