开发者

parent with mandatory children in MySQL Workbench

I created the following db in MySQL:

create table parent1 (
    parent_id int,

    constraint pk_parent1 primary key (parent_id)
);
create table child1 (
    child_id int,
    parent_id int not null,

    constraint pk_child1 primary key (child_id),
    constraint fk_child1_parent1 foreign key (parent_id)
        references parent1(parent_id)
);

If I reverse engineer the model in MySQL Workbench, it chooses the parent to be mandatory in the relationship (--|<). I know MySQL has to choose for either mandatory or optional, but mandatory seems the illogical choice for me as this is (1) much more difficult to implement in SQL and (2) less common than a parent with optional children.

  1. Why does Workbench choose for this interpretation?
  2. Is there a configuration setting in Workbench to force parent with optiona开发者_Go百科l children?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜