1
create table USERS (  
    PK_USER int not null auto_increment primary key,  
    EMAIL varchar(100) not null,  
    PASSWORD char(40) not null  
);  

create table CIRCLES (  
    PK_CIRCLE int not null auto_increment primary key,   
    CIRCLE varchar(45),  
    FK_CREATOR int,  
    foreign key(FK_CREADOR) references USERS(PK_USER)     
);  

create table MEMBERS (  
    FK_MEMBERS int,  
    FK_CIRCLES int,  
    foreign key(FK_MEMBER) references USERS(PK_USER),  
    foreign key(FK_CIRCLE) references CIRCLES(PK_CIRCLE)  
);  

有这个双重参考是正确的PK_USER吗?(参考 USERS=USUARIOS,MEMBERS=MIEMBROS,CIRCLES=CIRCULOS,CREATOR=CREADOR)

4

1 回答 1

0

据我所知,他们正在扮演两个不同的角色:

  1. 在 CIRCULOS 中,您正在跟踪 WHO 提供了实体
  2. 在 MIEMBROS 中,您正在跟踪 «membership» 关系(多对多关系)

所以:只要这些是你的意图,你就可以了:)

于 2013-07-22T15:24:01.773 回答