f**d 发帖数: 1952 | 1 请教三个Key的property, 下面这样说对么? 谢谢!
Property Parent & Child Table Child Table Logical Key
Primary Key Foreign Key
Data Type Number or text Same as it in the Number or text
parent table
Field Size Varies by problem Same as it in the Varies by
parent table problem
Indexed yes yes yes
property |
s**********o 发帖数: 14359 | |
f**d 发帖数: 1952 | 3 重新排了排,不好排啊。
【在 s**********o 的大作中提到】 : 很烂看不清楚
|
y****9 发帖数: 144 | 4 Don't know what is "logical key"
PK columns - unique and not null, have index by definition
FK columns - not null, index is not necessary but most case should be
indexed for performance reason
Data type - not limited to number or string, can be DATE type for example
text
【在 f**d 的大作中提到】 : 请教三个Key的property, 下面这样说对么? 谢谢! : Property Parent & Child Table Child Table Logical Key : Primary Key Foreign Key : Data Type Number or text Same as it in the Number or text : parent table : Field Size Varies by problem Same as it in the Varies by : parent table problem : Indexed yes yes yes : property
|
f**d 发帖数: 1952 | 5 Thanks a lot.
【在 y****9 的大作中提到】 : Don't know what is "logical key" : PK columns - unique and not null, have index by definition : FK columns - not null, index is not necessary but most case should be : indexed for performance reason : Data type - not limited to number or string, can be DATE type for example : : text :
|
y****9 发帖数: 144 | 6
>>> FK columns - not null <<<
CORRECTION ( at least in Oracle):
FK - could be NULL.
FK can reference PK or UK (unique key) of the parant table. UK allows NULL.
PK is unique + NOT NULL. Even when FK references to PK, it sill allows NULLs
【在 y****9 的大作中提到】 : Don't know what is "logical key" : PK columns - unique and not null, have index by definition : FK columns - not null, index is not necessary but most case should be : indexed for performance reason : Data type - not limited to number or string, can be DATE type for example : : text :
|
y****9 发帖数: 144 | 7 BTW I am supporting a DR testing tonight. I have encountered a problem when
enabling a FK constraint. I found this FK references to a UK of parent table
. During troubleshooting, I realized that I am wrong by saying " FK not null
".
.
NULLs
【在 y****9 的大作中提到】 : : >>> FK columns - not null <<< : CORRECTION ( at least in Oracle): : FK - could be NULL. : FK can reference PK or UK (unique key) of the parant table. UK allows NULL. : PK is unique + NOT NULL. Even when FK references to PK, it sill allows NULLs
|
P********R 发帖数: 1691 | 8 学习了, 谢谢!
when
table
null
【在 y****9 的大作中提到】 : BTW I am supporting a DR testing tonight. I have encountered a problem when : enabling a FK constraint. I found this FK references to a UK of parent table : . During troubleshooting, I realized that I am wrong by saying " FK not null : ". : : . : NULLs
|