Home » SQL & PL/SQL » SQL & PL/SQL » How to design table for this particular requirement
How to design table for this particular requirement [message #241438] Tue, 29 May 2007 10:27 Go to next message
mcavishal
Messages: 3
Registered: May 2007
Junior Member
I have five columns in a table.The combination of values for this five columns will be unique.

I also need to update this fields from JSP.
I read somewhere that updating primary key is aganist the ethics of DB design.

Can someone suggest how to design table for this particular requirement so that i can also update the fields and didn't voilate the ethics also.

Please help...
Re: How to design table for this particular requirement [message #241443 is a reply to message #241438] Tue, 29 May 2007 11:02 Go to previous messageGo to next message
Michel Cadot
Messages: 64122
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Create a unique constraint.

Regards
Michel
Re: How to design table for this particular requirement [message #241450 is a reply to message #241443] Tue, 29 May 2007 11:29 Go to previous messageGo to next message
mcavishal
Messages: 3
Registered: May 2007
Junior Member
Hi Michel
Thanks for the reply.Can you please confirm that creating unique key is best option or I can go for composite key.
One more thing Do i need to keep one extra column as primary key which will act as tracker of the row which needs to be updated.

The only concern from my side is that the fields sholud be updateable.

Regards...
Re: How to design table for this particular requirement [message #241453 is a reply to message #241450] Tue, 29 May 2007 11:53 Go to previous message
Michel Cadot
Messages: 64122
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Unique key means that the list of columns you named in it contains unique values. It does not mean there is only one column.
In your case, all 5 columns constitute the unique key.
This is the best option as this is the one that fits all your requirements: unicity and updatability.

Yes, if you want to track the row you can add a column to act as a primary key. This may be a number column set with a sequence value.

Regards
Michel
Previous Topic: Dropping a Datafile and Deleting its References
Next Topic: Logginng/Nologging in User_Indexes Table
Goto Forum:
  


Current Time: Wed Dec 07 04:52:50 CST 2016

Total time taken to generate the page: 0.17468 seconds