View previous topic :: View next topic
|
Author |
Message |
sant532
New User
Joined: 02 Jun 2008 Posts: 48 Location: India
|
|
|
|
can anybody give me the reason why a table is defined without a key |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
part of the composite key is nullable (you would still have a unique index) |
|
Back to top |
|
|
sant532
New User
Joined: 02 Jun 2008 Posts: 48 Location: India
|
|
|
|
can you give me some more information |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you show the create for the table/indexes you are confused about.
Someone then may have a more specific reply. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Sant532,
Quote: |
can anybody give me the reason why a table is defined without a key |
Reason Number 1 : it must be a de-normalized table
Reason Number 2 : During designing season they would have decided "we should forget about normalization!".
When you talk about normalization, you will be automatically talking about keys also.
Sushanth |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
if you have a natural/business key , but some columns are nullable.
F.e.:
Suppose you have a parameter table with defaults on different levels.
like this table : where you keep runstats-profiles :
Code: |
Db TS PART Runstats_profile
NULL NULL NULL "table(all) index(all) "
data1 NULL NULL "TABLE(all) index(all) keycard"
data1 TS1 NULL "TABLE(all) index(all) SAMPLE 25"
data1 TS2 1 "TABLE(all) index(all) SAMPLE 10" |
The unique key is DB,TS,PART
DB2 does not allow to define a Primary key on Nullable columns.
So to keep codd happy you could define a system generated key, but it is useless in the application.
so you might as well define the table without PK. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
As an extra comment on my previous post :
to keep Codd really happy, we should have defined 4 tables :
- System_defaults
- Database_defaults
- Tablespace_defaults
- tablepart_defaults |
|
Back to top |
|
|
pardhasaradhireddy
New User
Joined: 20 May 2008 Posts: 8 Location: Hyderabad
|
|
|
|
thank you very much Guyc for your information |
|
Back to top |
|
|
|