数据库表可以包含多个主键吗? [英] Can a database table contains more than one primary key?

查看:753
本文介绍了数据库表可以包含多个主键吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据库表可以包含多个主键吗?

Can a database table contains more than one primary key?

是的,我在谈论RDBMS。

Yes, I am talking about RDBMS.

推荐答案

关系表的主键唯一地标识表中的每个记录。
因此,为了保持每个记录的唯一性,表不能有多个主键。
它可以是保证具有唯一性的普通属性(例如,一个人的表中的社会安全号,每人不超过一个记录),也可以由DBMS生成(例如,全局唯一标识符) ,或Microsoft SQL Server中的GUID)。主键可以包含单个属性,也可以包含多个属性。

The primary key of a relational table uniquely identifies each record in the table. So, in order to keep the uniqueness of each record, you cant have more than one primary key for the table. It can either be a normal attribute that is guaranteed to be unique (such as Social Security Number in a table with no more than one record per person) or it can be generated by the DBMS (such as a globally unique identifier, or GUID, in Microsoft SQL Server). Primary keys may consist of a single attribute or multiple attributes in combination.

这篇关于数据库表可以包含多个主键吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆