RDBMS 中的复合键
rdbmsdatabasemysql更新于 2026/3/2 2:52:17
具有两个或更多属性的主键称为复合键。它是两个或更多列的组合。
一个示例可以是 −

这里我们的复合键是 OrderID 和 ProductID −
| {OrderID, ProductID} |
Let us see another example −
<Student>
| StudentID | StudentEnrollNo | StudentMarks | StudentPercentage |
| S001 | 0721722 | 570 | 90 |
| S002 | 0721790 | 490 | 80 |
| S003 | 0721766 | 440 | 86 |
上面我们的复合键是StudentID 和StudentEnrollNo ,该表有两个属性作为主键。
因此,由两个或多个属性组成的主键称为复合键。
相关文章
有用资源
mysql 参考教程 - 该教程包含有关 mysql 的更多信息:/mysql/