database - Would you ever create a relationship on a natural ID or use an internal ID and emulate the natural ID relationship? -
possible duplicate:
surrogate vs. natural/business keys
if given 2 tables, level1 [id, title, number] level2 [id, fkid???, title, number]
a user of system understands level2 related level1 based on level1's number, question is, make relationship based on internal id , "emulate" relationship "number" or use "number" field , done it?
the 2 standard reasons relating on database id rather natural id are:
- it's difficult guarantee natural id never change under circumstance
- generally natural id takes more space , not efficient index database id (though of course not hard , fast - depends on data constituting natural id). using database id, can avoid duplication of business data.
Comments
Post a Comment