![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
On net wrote: On 18/08/2011 09:25, On net wrote: On 17/08/2011 16:06, On net wrote: So, if I have my person fred blogs, and three possible unique keys (Key1, Key2 and Key3), any one of which uniquely identifies the person, how do I build my primary key to your satisfaction without needing to supply values for all keys, but just one or more of the unique keys. I am really hoping someone is going to tell me how I can do this. Fred is still waiting and I haven't even written the application! I'd like to add that Roy is not the only person allowed to suggest the right way to do this. Yes, please let's all pile in. I'll just note that I need to know more about the problem though. You won't like my suggest based on what I know so far. Basically I see three entirely independent table with no common key. There's something missing. |
#2
| |||
| |||
|
|
Here is my two-pen-worth. Long ago I helped design a schema for a Patient Information database for the Health Service. We had much the same problems with people not having all of their information and had to devise a way where we could hang all of their hospital stay information on their record when we couldn't uniquely identify them. The answer was to generate a sequence number for each one - then it didn't matter if some of the other details were missing. We used the sequence number as the major key to all tables containing supplementary data. In general, the information sent to the DOH was anonymised so we didn't need to include any of the potentialy missing information - it was just held on the database as a reference. Nothing stops you doing a full table search on any column - they don't have to be keys. After all, if you have a 3 part unique key which can all be nullable, as soon as you have one person with none of the information, that is unique and no-one else with that lack can be added. Theory is all very well, but in the real world, it's a practical solution that everyone needs. |
|
Thats all from me! Lin *Internet * *paul (AT) ipauland (DOT) com* *Sent by: info-ingres-bounces (AT) kettleriver...ting (DOT) com* 18/08/2011 12:11 Please respond to info-ingres (AT) kettleriverconsulting (DOT) com To info-ingres (AT) kettleriverconsulting (DOT) com cc Subject Re: [Info-Ingres] Invitation to a quarrel On 18/08/2011 11:24, Roy Hann wrote: On net wrote: On 18/08/2011 09:25, On net wrote: On 17/08/2011 16:06, On net wrote: So, if I have my person fred blogs, and three possible unique keys (Key1, Key2 and Key3), any one of which uniquely identifies the person, how do I build my primary key to your satisfaction without needing to supply values for all keys, but just one or more of the unique keys. I am really hoping someone is going to tell me how I can do this. Fred is still waiting and I haven't even written the application! I'd like to add that Roy is not the only person allowed to suggest the right way to do this. Yes, please let's all pile in. I'll just note that I need to know more about the problem though. You won't like my suggest based on what I know so far. Basically I see three entirely independent table with no common key. There's something missing. Well what I have in mind is something like a vagrant hostel, or government benefit agency. They come across people all the time who may have unique forms of identification, but it can take multiple forms. Because we started off talking about primary keys composed of unique nullable columns I have avoided even mentioning creation of an artificial key as a solution, because it's not relevant to the discussion. For the purpose of running my government benefit system, claimants must provide a name (non-unique), and one or more of three forms of unique ID (Key1, Key2, Key3). Having a primary key made from three unique and nullable keys( Key1, Key2 and Key3) is the natural solution. _______________________________________________ Info-Ingres mailing list Info-Ingres (AT) kettleriverconsulting (DOT) com http://ext-cando.kettleriverconsulti...fo/info-ingres __________________________________________________ _________ This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited. Please refer to http://www.bnpparibas.co.uk/en/infor...de=ECAS-845C5H for additional disclosures. _______________________________________________ Info-Ingres mailing list Info-Ingres (AT) kettleriverconsulting (DOT) com http://ext-cando.kettleriverconsulti...fo/info-ingres |
#3
| |||
| |||
|
|
Generally the creation of an artificial key (universally popular amongst developers) solves some ills but creates others and puts Roy off his tea. |
#4
| |||
| |||
|
|
Paul Andrews wrote: Generally the creation of an artificial key (universally popular amongst developers) solves some ills but creates others and puts Roy off his tea. I'm just back in the office and see my name being invoked, so I'll quickly respond to this one! You will evidently be surprised to hear that I am perfectly OK with synthetic keys (artificial keys that are visible to the users) and surrogate keys (artificial keys that invisible to the users). I just ask that they not be used when there is already a reliable (i.e. unique, stable, concise, familiar) natural key that works. If there is no such natural key then by all means introduce an artificial one. As an aside, ALL keys are artificial keys at some level. My passport number number is an artificial key as far as the issuing authority is concerned; it is a natural key to my airline. Likewise my driver's licence number is artificial to the licensing authority but natural to the police. And so on. PS: FOREIGN KEY (fk) REFERENCES table ON UPDATE CASCADE is our friend... :-) -- Roy |
#5
| |||
| |||
|
|
I've always wondered how people migrate data between databases when it's held together by artifical keys that may not be unique between databases or |
#6
| |||
| |||
|
|
Having a primary key made from three unique and nullable keys( Key1, Key2 and Key3) is the natural solution. |
|
..those "fields" belong in three different tables, within which each of them is a key.. |
#7
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |