powerdesigner如何创建外键

本文介绍如何在两个实体间建立正确的关系,通过设置外键来确保帖子与其作者之间的关联性。主要内容包括定义外键、设置必填属性以及创建实体间的引用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

先创建两个entity

因为是多个t主题(topic)对应一个作者(author)

所以topic要有个外键author_id参照author的id

那么双击topic,创建一个column author_id 并且在M上选对勾:意思是这个外键必须有值(帖子肯定是要有个作者发啊,不能是null)

Mandatory

When selected, indicates a column that must be assigned a not null value

 

然后点击reference,并连上2个entity

双击连接线,parent table即是author,而child table 是topic

Parent table

Specifies the parent table of the reference. This table contains the primary key, or alternate key, linked by the reference.

Child table

Specifies the child table of the reference. This table contains the foreign key linked by the reference

然后在joins里面把parent key 选为none,在指定外键列child table column

得到

如果praent key选为

那么你的外键就会是topic 主键加上author_id外键

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值