Tuesday, September 13, 2005

Multiple Column on Primary Key

Some People might known about this topic, specialy if you one of DBA or DB Architect.
Its common used on Client/Server Technology, or Datawarehouse.

The purpose of Multiple Column on Primary Key Definition is Referential Integrity.
We can adopt this integrity into many table through foreign key mechanism, and it is help alot.

But, when you decided to used a web based application, you might face unflexiblity if you try to use this method. Unflexible huh ? yes, because a web based application always mention every single record with one unique id, based on a single column primary key. Thats why its not flexible for web based developer view.

Lets assume, If we decided to use a single column primary key, we might have a de-normalize problem. The DB Design might "not good" enough. Next, when soft.developer try to create their own query, they might face an "unnecessary column" in join command, since the term of "single column" in this case is not a subtitute column rather than an added column.

On the other side, If we keep moving with a Multiple Column on Primary Key, it will put an extra effort on an application for web developer when they define the CRUD (Create, Replace, Update and Delete) page.

So, how to solve this problem ?

For now, I choose a Multiple Column on Primary Key Design. It still made me satisfy.

No comments: