1、SQL Constraint

Integrity Constraints are used to apply business rules for the database tables.

The constraints available in SQL are Foreign Key, Not Null, Unique, Check.

Constraints can be defined in two ways
1) The constraints can be specified immediately after the column definition. This is called column-level definition.
2) The constraints can be specified after all the columns are defined. This is called table-level definition.

2、SQL Index

Index in sql is created on existing tables to retrieve the rows quickly.

When there are thousands of records in a table, retrieving information will take a long time. Therefore indexes are created on columns which are accessed frequently, so that the information can be retrieved quickly. Indexes can be created on a single column or a group of columns. When a index is created, it first sorts the data and then it assigns a ROWID for each row.

Syntax to create Index:

CREATE INDEX index_name
ON table_name (column_name1,column_name2...);

SQL Constraint/Index的更多相关文章

  1. SQL CREATE INDEX 语句

    CREATE INDEX 语句用于在表中创建索引. 在不读取整个表的情况下,索引使数据库应用程序可以更快地查找数据. 索引 您可以在表中创建索引,以便更加快速高效地查询数据. 用户无法看到索引,它们只 ...

  2. SQL DROP INDEX 语句

    SQL DROP INDEX 语句 我们可以使用 DROP INDEX 命令删除表格中的索引. 用于 Microsoft SQLJet (以及 Microsoft Access) 的语法: DROP ...

  3. SQL-W3School-高级:SQL CREATE INDEX 语句

    ylbtech-SQL-W3School-高级:SQL CREATE INDEX 语句 1.返回顶部 1. CREATE INDEX 语句用于在表中创建索引. 在不读取整个表的情况下,索引使数据库应用 ...

  4. The include feature of SQL Server Index

    1. Why we need the index 'include' feature? For SQLServer , the length of all the index key have a l ...

  5. substring 在C#,Javascript,SQL 中index开始值

    substring函数index参数在三个平台的开始值: 平台 index参数开始值 C# 0 Javascript 0 SQL 1

  6. SQL CREATE INDEX

    n relational database, Index will be the important mechanism for boosting performance. Index is impo ...

  7. [SQL Server]Index/deadlock

    http://www.cnblogs.com/tintown/archive/2005/04/24/144272.html http://coolshell.cn/ http://blogs.msdn ...

  8. SQL Server Index详解

    最近在进行数据库调优,对索引的使用和其内部的运转一知半解.在园子里看到一篇相关文章非常好.留下印记以便日常查找. http://www.cnblogs.com/xwdreamer/archive/20 ...

  9. 转:Sql Server中的表访问方式Table Scan, Index Scan, Index Seek

    0.参考文献 Table Scan, Index Scan, Index Seek SQL SERVER – Index Seek vs. Index Scan – Diffefence and Us ...

随机推荐

  1. NPOI导出Excel示例

    摘要:使用开源程序NPOI导出Excel示例.NPOI首页地址:http://npoi.codeplex.com/,NPOI示例博客:http://tonyqus.sinaapp.com/. 示例编写 ...

  2. mysql服务的启动和停止 net stop mysql net start mysql

    第一招.mysql服务的启动和停止 net stop mysql net start mysql 第二招.登陆mysql 语法如下: mysql -u用户名-p用户密码 键入命令mysql -uroo ...

  3. Parse error: syntax error, unexpected T_PUBLIC in 问题解决

    class 类中 public function _getInfo($sn){        $title = '';        $_array = explode('~', $sn);      ...

  4. cdoj 383 japan 树状数组

    Japan Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/383 Descrip ...

  5. memcpy内存拷贝及优化策略图解

    一般内存拷贝与优化 代码实现 #include<iostream> usingnamespace std; //不安全的内存拷贝(当源内存地址与目标内存地址重叠时会产生错误) void h ...

  6. 用csc命令行手动编译cs文件

    一般初学c#时,用记事本写代码,然后用命令行执行csc命令行可以编译cs文件.方法有两种 1:配置环境,一劳永逸 一般来说在C:\Windows\Microsoft.NET\Framework\v4. ...

  7. 会话跟踪session cookie

    会话跟踪 会话(Session)跟踪是Web程序中常用的技术,用来跟踪用户的整个会话.常用的会话跟踪技术Cookie与Session.Cookie通过在客户端记录信息确定用户身份,Session通过在 ...

  8. interactive_timeout

    [mysqld] interactive_timeout  交互式连接 会话1 [root@localhost ~]# mysql -umysql -p Enter password: Welcome ...

  9. Jordan Lecture Note-3: 梯度投影法

    Jordan Lecture Note-3:梯度投影法 在这一节,我们介绍如何用梯度投影法来解如下的优化问题: \begin{align} \mathop{\min}&\quad f(x)\n ...

  10. Mysql数据库导出压缩并保存到指定位置备份脚本

    #!/bin/bashbackdir=/home/shaowei/dbbakdbuser='dbusername'dbpass='dbpasswd'dblist=$(ls -p /var/lib/my ...