在关系数据库中,如何在二级存储设备和GUI中内部表示键。

时间:2021-01-04 16:52:54

Database keys are primary, candidate, and foreign. I have researched all about what these are and what relational database does. But i'm not sure about this one. There's so many answers but i cannot figure which one will be correct. Thanks.

数据库键是主键,候选键和外键键。我已经研究了所有这些以及关系数据库的作用。但我不确定这个。有这么多的答案,但我无法确定哪一个是正确的。谢谢。

1 个解决方案

#1


0  

  • Primary Key Primary key is a set of one or more fields/columns of a table that uniquely identify a record in database table. It can not accept null, duplicate values. Only one Candidate Key can be Primary Key.
  • 主键主键是表的一个或多个字段/列的集合,用于唯一标识数据库表中的记录。它不能接受null,重复的值。只有一个候选键可以是主键。
  • Candidate Key A Candidate Key is a set of one or more fields/columns that can identify a record uniquely in a table. There can be multiple Candidate Keys in one table. Each Candidate Key can work as Primary Key. Example: In below diagram ID, RollNo and EnrollNo are Candidate Keys since all these three fields can be work as Primary Key.
  • 候选键候选键是一组一个或多个字段/列,可以在表中唯一地标识记录。一个表中可以有多个候选键。每个候选键都可以作为主键。示例:在下图ID中,RollNo和EnrollNo是候选键,因为所有这三个字段都可用作主键。

在关系数据库中,如何在二级存储设备和GUI中内部表示键。

  • Foreign Key Foreign Key is a field in database table that is Primary key in another table. It can accept multiple null, duplicate values. For more help refer the article Difference between primary key and foreign key. Example : We can have a DeptID column in the Employee table which is pointing to DeptID column in a department table where it a primary key.

    外键外键是数据库表中的一个字段,它是另一个表中的主键。它可以接受多个null,重复的值。有关更多帮助,请参阅主键和外键之间的区别。示例:我们可以在Employee表中有一个DeptID列,该列指向department表中的DeptID列,该列是主键。

  • Composite/Compound Key Composite Key is a combination of more than one fields/columns of a table. It can be a Candidate key, Primary key.

    复合/复合键复合键是表的多个字段/列的组合。它可以是候选键,主键。

  • Unique Key Uniquekey is a set of one or more fields/columns of a table that uniquely identify a record in database table. It is like Primary key but it can accept only one null value and it can not have duplicate values. For more help refer the article Difference between primary key and unique key.
  • 唯一键唯一键是表的一个或多个字段/列的集合,用于唯一标识数据库表中的记录。它类似于主键,但它只能接受一个空值,并且不能具有重复值。有关更多帮助,请参阅主键和唯一键之间的区别。

For more refference: SQL keys

有关更多参考:SQL键

#1


0  

  • Primary Key Primary key is a set of one or more fields/columns of a table that uniquely identify a record in database table. It can not accept null, duplicate values. Only one Candidate Key can be Primary Key.
  • 主键主键是表的一个或多个字段/列的集合,用于唯一标识数据库表中的记录。它不能接受null,重复的值。只有一个候选键可以是主键。
  • Candidate Key A Candidate Key is a set of one or more fields/columns that can identify a record uniquely in a table. There can be multiple Candidate Keys in one table. Each Candidate Key can work as Primary Key. Example: In below diagram ID, RollNo and EnrollNo are Candidate Keys since all these three fields can be work as Primary Key.
  • 候选键候选键是一组一个或多个字段/列,可以在表中唯一地标识记录。一个表中可以有多个候选键。每个候选键都可以作为主键。示例:在下图ID中,RollNo和EnrollNo是候选键,因为所有这三个字段都可用作主键。

在关系数据库中,如何在二级存储设备和GUI中内部表示键。

  • Foreign Key Foreign Key is a field in database table that is Primary key in another table. It can accept multiple null, duplicate values. For more help refer the article Difference between primary key and foreign key. Example : We can have a DeptID column in the Employee table which is pointing to DeptID column in a department table where it a primary key.

    外键外键是数据库表中的一个字段,它是另一个表中的主键。它可以接受多个null,重复的值。有关更多帮助,请参阅主键和外键之间的区别。示例:我们可以在Employee表中有一个DeptID列,该列指向department表中的DeptID列,该列是主键。

  • Composite/Compound Key Composite Key is a combination of more than one fields/columns of a table. It can be a Candidate key, Primary key.

    复合/复合键复合键是表的多个字段/列的组合。它可以是候选键,主键。

  • Unique Key Uniquekey is a set of one or more fields/columns of a table that uniquely identify a record in database table. It is like Primary key but it can accept only one null value and it can not have duplicate values. For more help refer the article Difference between primary key and unique key.
  • 唯一键唯一键是表的一个或多个字段/列的集合,用于唯一标识数据库表中的记录。它类似于主键,但它只能接受一个空值,并且不能具有重复值。有关更多帮助,请参阅主键和唯一键之间的区别。

For more refference: SQL keys

有关更多参考:SQL键