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.

Database: key的更多相关文章

  1. Activation error occured while trying to get instance of type Database,key ""之Oracle

    我在发布web项目时好几次好遇到这个问题,查看了别人的说法,感觉还是不能解决,后来发现在发布时bin里面有dll没有打包到发布文件的bin目录中,而这些dll又是在连接Oracle(我选择的Oracl ...

  2. StackExchange.Redis帮助类解决方案RedisRepository封装(字符串类型数据操作)

    本文版权归博客园和作者本人共同所有,转载和爬虫请注明原文链接 http://www.cnblogs.com/tdws/tag/NoSql/ 目录 一.基础配置封装 二.String字符串类型数据操作封 ...

  3. PHP+Mysql+easyui点击左侧tree菜单对应表名右侧动态生成datagrid加载表单数据(二)

    关于tree菜单生成,参考我的另一篇博文地址tree 菜单 实现功能:点击左侧tree菜单中的table,右侧通过datagrid加载出该表对用的所有数据 难点:获取该表的所有列名,动态生成datag ...

  4. Java基础常见英语词汇

    Java基础常见英语词汇(共70个) ['ɔbdʒekt] ['ɔ:rientid]导向的                             ['prəʊɡræmɪŋ]编程 OO: object ...

  5. IT软件开发常用英语词汇

    Aabstract 抽象的abstract base class (ABC)抽象基类abstract class 抽象类abstraction 抽象.抽象物.抽象性access 存取.访问access ...

  6. Leveldb Advanced

    [Slice] The return value of the it->key() and it->value() is a simple structure that contains ...

  7. SpringDataMongoDB介绍(一)-入门

    SpringDataMongoDB介绍(一)-入门 本文介绍如何应用SpringDataMongoDB操作实体和数据库,本文只介绍最基本的例子,复杂的例子在后面的文章中介绍. SpringDataMo ...

  8. CRUD生成器DBuilder设计与实现

    源码位于github:https://github.com/lvyahui8/dbuilder.git .文中图片如果太小看不清楚,请右键点击“在新标签页中打开”即可看到原图 有兴趣还可以加QQ群交流 ...

  9. The 10 Most Important Security Controls Missing in JavaEE--reference

    JavaEE has some excellent built-in security mechanisms, but they don’t come close to covering all th ...

随机推荐

  1. 【DQ冰淇淋】—— Babylon 冰淇淋三维互动营销项目总结

    前言:在学习过Babylon.js基础之后,我上手的第一个网页端3D效果制作项目就是‘DQ冰淇淋’.这个小项目应用到了Babylon最基础的知识,既可以选味道,选点心,也可以旋转.倒置冰淇淋,互动起来 ...

  2. 转:使用Fabric自动化你的任务

    转:http://www.cnblogs.com/holbrook/archive/2012/03/05/2380398.html fabric是什么? Fabric是一个Python库,可以通过SS ...

  3. Solidworks如何制作动画1

    1点击窗口下方的"运动算例1"可以弹出动画的面板,右击该"运动算例1"还可以对这个动画窗口重命名等操作. 2 我们从最简单的动画开始,假设图示装配体,想要把它从 ...

  4. rsync一些常用的命令

    渗透测试的时候会遇到RSYNC 匿名访问 在对一些大型互联网进行测试的时候经常会遇到rsync. 什么是Rsync Rsync(remote synchronize)是一个远程数据同步工具,可通过LA ...

  5. 自己定义字体之BMFont的使用

    ***************************************转载请注明出处:http://blog.csdn.net/lttree************************** ...

  6. Ubuntu下安装和编译ffmpeg

    参考:http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu   1.安装依赖包 sudo apt-get update sudo apt-get -y ...

  7. u-boot-2014-04 网络不通解决一例

    不久前我移植了u-boot-214-04到Tq2440的板子上,基本功能都有了,网卡也可以使用了.有一天打算把u-boot-2010-06也也一直到tq2440上,移植完后发现u-boot-214-0 ...

  8. 深入Asyncio(一)入门介绍

    介绍 Asyncio试图解决什么问题? 对于IO负载,有且仅有两个理由使用基于asyncio的并发而不是基于多线程的并发: 1. Asyncio为抢占式多任务(线程)提供了一个更安全的替代方案,避免了 ...

  9. 认识 service worker

    离线缓存可以提升用户体验,可以节省网络资源,但是,浏览器对资源缓存和自定义网络请求的控制一直不够完善,service worker 的出现就是为了解决这些问题 它可以解决目前离线应用的问题,同时也可以 ...

  10. YII框架学习(二)

    YII框架的增删改查 例:一个新闻表的增删改查: (1)首先使用gii工具生成控制器和模型 (2)控制器 <?php class NewsController extends Controlle ...