什么是主键外键?
Posted yun---meng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了什么是主键外键?相关的知识,希望对你有一定的参考价值。
关系型数据库中的一条记录中有若干个属性,若其中某一个属性组(注意是组)能唯一标识一条记录,该属性组就可以成为一个主键 {主键唯一性}
比如 a.学生表(学号,姓名,性别,班级)
其中每个学生的学号是唯一的,学号就是一个主键
b.课程表(课程编号,课程名,学分)
其中课程编号是唯一的,课程编号就是一个主键
c.成绩表(学号,课程号,成绩)
成绩表中单一 一个属性无法唯一标识一条记录,学号和课程号的组合才可以唯一标识一条记录,所以学号和课程号的属性组是一个主键
外键 --- 成绩表中的学号不是成绩表的主键,但它和学生表中的学号相对应,并且学生表中的学号是主键,则称成绩表中的学号是学生表的外键
{同理 成绩表中的课程号是课程表的外键}
定义主键和外键主要是为了维护关系数据库的完整性,总结一下:
主键是能确定一条记录的唯一标识;
比如,一条记录包括身份正号,姓名,年龄。身份证号是唯一能确定你这个人的,其他都可能有重复,所以,身份证号是主键。
外键用于与另一张表的关联。是能确定另一张表记录的字段,用于保持数据的一致性。
比如,A表中的一个字段,是B表的主键,那他就可以是A表的外键。
!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6IjcwNzYtMTU5MzM4OTY5ODYwNSIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJsaW5lLWhlaWdodCI6MS4yNSwiYWxpZ24iOiJsZWZ0IiwiaW5kZW50IjowLCJ0ZXh0LWluZGVudCI6MCwiYmFjay1jb2xvciI6IiIsInBhZGRpbmciOiIifSwidHlwZSI6InBhcmFncmFwaCIsInJpY2hUZXh0Ijp7ImRhdGEiOlt7ImNoYXIiOiLlrpoiLCJzdHlsZXMiOnsiZm9udC1mYW1pbHkiOiJLYWlUaV9HQjIzMTIiLCJmb250LXNpemUiOjEyLCJiYWNrLWNvbG9yIjoiIzk5Y2NmZiJ9fSx7ImNoYXIiOiLkuYkiLCJzdHlsZXMiOn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6dHJ1ZSwia2VlcExpbmVCcmVhayI6dHJ1ZX19XQ==-->
以上是关于什么是主键外键?的主要内容,如果未能解决你的问题,请参考以下文章