Sql updating primary key value baltimore singles speed dating

The implication is that you want to avoid keys with business meaning because business meaning changes.

sql updating primary key value-77

Otherwise, they serve very different purposes and each is governed by its own set of rules.

That said, they can often be related to each other in very important ways, but they still remain separate entities.

This article overviews strategies for assigning primary keys to a table within a relational database.

In particular, it focuses on the issue of when to use natural keys and when to use surrogate keys.

The reality is that natural and surrogate keys each have their advantages and disadvantages, and that no strategy is perfect for all situations.

In other words, you need to know what you're doing if you want to get it right.Similarly, the Address ID column is part of the primary key of Customer Has Address as well as a foreign key to the Address table to maintain the relationship with rows of Address. However, the disadvantage of natural keys is that because they have business meaning they are effectively coupled to your business: you may need to rework your key when your business requirements change.For example, if your users decide to make Customer Number alphanumeric instead of numeric then in addition to updating the schema for the Customer table (which is unavoidable) you would have to change every single table where Customer Number is used as a foreign key. First, they aren't coupled to your business and therefore will be easier to maintain (assuming you pick a good implementation strategy).The implication is that you might still need to implement alternate keys for searching, editing, and so on.The fundamental issue is that keys are a significant source of coupling within a relational schema, and as a result they are difficult to change.Some people will tell you that you should always use natural keys and others will tell you that you should always use surrogate keys.

Tags: , ,