super-key: Any key that has more columns than necessary to uniquely identify each row in the table is called a super-key (think of it as a super-set).

candidate key: if the key has the minimum amount of columns necessary to uniquely identify each row then it is called a minimal super-key. A minimal super-key is also known as a candidate key, and there must be one or more candidate keys in a table.

foreign key: While unique and primary keys both enforce uniqueness on the column(s) of one table, foreign keys define a relationship between two tables. A foreign key identifies a column or group of columns in one (referencing) table that refers to a column or group of columns in another (referenced) table

Can a table have multiple unique, foreign, and/or primary keys?

A table can have multiple unique and foreign keys. However, a table can have only one primary key.

Can a unique key have NULL values? Can a primary key have NULL values?

Unique key columns are allowed to hold NULL values. The values in a primary key column, however, can never be NULL.

Can a foreign key reference a non-primary key?

Yes, a foreign key can actually reference a key that is not the primary key of a table. But, a foreign key must reference a unique key.

Can a foreign key contain null values?

Yes, a foreign key can hold NULL values. Because foreign keys can reference unique, non-primary keys – which can hold NULL values – this means that foreign keys can themselves hold NULL values as well.

natural key: A natural key is a key composed of columns that actually have a logical relationship to other columns within a table.

simple key: In a database table, a simple key is just a single attribute (which is just a column) that can uniquely identify a row. So, any single column in a table that can uniquely identify a row is a simple key. The reason it’s called a simple key is because of the fact that it is simple in the sense that it’s just composed of one column (as opposed to multiple columns) and that’s it.

secondary key: A given table may have more than just one choice for a primary key. Basically, there may be another column (or combination of columns for a multi-column primary key) that qualify as primary keys. Any combination of column(s) that may qualify to be a primary key are known as candidate keys. This is because they are considered candidates for the primary key. And the options that are not selected to be the primary key are known as secondary keys.

最新文章

  1. 谈一谈php://filter的妙用
  2. webconfig 文件加密处理
  3. Centos7 安装codeblock( 转载)
  4. Python学习笔记——文件
  5. Android开发-API指南-<uses-library>
  6. php.curl详解
  7. hadoop2.1.0和hadoop2.2.0编译安装教程
  8. [AngualrJS + Webpack] Production Source Maps
  9. 使用脚本管理IIS
  10. hdu 4090 GemAnd Prince
  11. ADPCM编码和解码
  12. access restriction
  13. Erlang gen_server进程花样作死
  14. jmeter利用自身代理录制电脑脚本(一)
  15. 轻量级.Net Core服务注册工具CodeDi发布啦
  16. platform怎么实现数据数据和驱动分离
  17. 使用C# (.NET Core) 实现迭代器设计模式 (Iterator Pattern)
  18. vue面试
  19. mac那些事儿
  20. Logback中文文档(一):介绍

热门文章

  1. Git的提交忽略文件
  2. 【温故知新】——Bootstrap响应式知识点复习
  3. 转载:JAVA中获取项目文件路径
  4. Ubuntu系统经常使用操作指令说明
  5. 拿wordpress站的一个小技巧
  6. (Caffe)基本类Blob,Layer,Net(一)
  7. 调用android系统相机拍照并保存
  8. 详细解析用Squid实现反向代理的方法
  9. 在tomcat中用jndi配置数据源启动java web程序
  10. servletRequest 常用操作