Stating the Obvious约束应明确声明
数据中存在隐含约束是一种不良设计。尽可能多地定义约束。
主键是必不可少的。备用键(alternate key)可以标志数据及各种唯一性约束。通过外键(Foreign key)可关联到主表(master table),从而保证数据一致性,所以外键是全面表达数据模型内涵不可或缺的。
约束有两个主要作用:
-
有助于保证数据完整性(integrity)
-
为DBMS核心
数据语义属于DBMS,别放在应用程序中。
Stating the Obvious约束应明确声明
数据中存在隐含约束是一种不良设计。尽可能多地定义约束。
主键是必不可少的。备用键(alternate key)可以标志数据及各种唯一性约束。通过外键(Foreign key)可关联到主表(master table),从而保证数据一致性,所以外键是全面表达数据模型内涵不可或缺的。
约束有两个主要作用:
数据语义属于DBMS,别放在应用程序中。