• autoexcrement (4/18/2013)


    Thanks for weighing in. My concern is just that if I create a "master" record in "people" and use their "real name" in that table, what's to prevent that name being duplicated in the "names" table? etc. The suggestion to eliminate names completely from the "people" table solves that issue, but yeah, that would make it more difficult to manage that table and see who's who on a day to day basis--at least for the likes of me! :)[/quote

    Well, one option is to have a reference from the people table to the name table to indicate the real name; then each entry in the people table has a reference to the corresponding real name (if it's an AKA entry) or a null reference (if it is the real name entry). Then the thing you look at on a day to day basis to manage real people is

    select people.*, names.name from people inner join names on names.nameID = people.realnameID

    Another option is to have the names table have a reference to the people table and a bit to indicate whether it's a real name, and then the thing you look at day to day is

    select people.*, names.name from people inner join names on names.nameIDidRealName=1 and people.personID = names.personID

    there are a few other options too. Of course whatever option you chose it would make sense to create a view, perhaps called PeopleWithRealName (for the two options above, the two select statements are the selects that define that view) and you might want either to give that view INSTEAD OF triggers for update and delete and insert or to ensure that changes to the view (and any changes to the two underlying tables that change the view) are encapsulated in stored procedures, so that either changes can't be achieved except through those stored procedures or changes invoke the triggers.

    Tom