由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 请教三个Key的property,
相关主题
How to replace 0 with empty?难。想了一天了。大牛请进。
indexing就是设置primary key吗?两个列联合作Primary Key,还需要单独建index吗?
better way to compare nullable columns?Join optimization
have a simple question. Please help me!怎样解决 Index for NULL value
一个奇怪的问题About INSERT IGNORE
How to get other columns after UNION?问一个关于SQL的问题
请问sql 有条件性的select columns请帮我看看,什么地方错了?
Urgent help needed, pleasetemp table problem
相关话题的讨论汇总
话题: key话题: table话题: property话题: fk话题: parent
进入Database版参与讨论
1 (共1页)
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
2
很烂看不清楚
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

1 (共1页)
进入Database版参与讨论
相关主题
temp table problem一个奇怪的问题
问题:如何设计以下DBHow to get other columns after UNION?
请问:IS NULL和 = NULL的区别请问sql 有条件性的select columns
问一个SQL Server的问题Urgent help needed, please
How to replace 0 with empty?难。想了一天了。大牛请进。
indexing就是设置primary key吗?两个列联合作Primary Key,还需要单独建index吗?
better way to compare nullable columns?Join optimization
have a simple question. Please help me!怎样解决 Index for NULL value
相关话题的讨论汇总
话题: key话题: table话题: property话题: fk话题: parent