我有一张product桌子:
ProdId(PK)
Prod1
Prod2
Prod3
Prod4
和Certification表:
Certification(PK):
Cert1
Cert2
Cert3
我需要对ProdwithCert关系(伪表)建模如下:
ProdwithCertId(PK) ProdwithCert
ProdwithCert1 "Prod1 with Cert1"
ProdwithCert2 "Prod1 with Cert1, Cert2"
ProdwithCert3 "Prod1 with Cert1, Cert2, Cert3"
ProdwithCert4 "Prod2 with Cert1, Cert2"
ProdwithCert5 "Prod2 with Cert1, Cert2, Cert3"
以下是约束:
- 不能有重复项,例如上表,
ProdwithCert6 - "Prod2 with Cert1, Cert2, Cert3"是不允许的 Product至少有一个Certification
如何ProdwithCert在 SQL Server 2005 中正确建模关系?
谢谢