Oracle constraints and Indexes

Source: Internet
Author: User

Oracle constraints and index constraints www.2cto.com constraints include: not null, unique, primary key, foreign key, check not null (non-null). If not null is defined on the column, when inserting data, you must provide the data unique (unique) for the column. When a unique constraint is defined, the value of this column cannot be repeated, but it can be a nullprimary key (primary key) it is used to uniquely represent the data of rows in the table. When the primary key constraint is defined, this column cannot be repeated and cannot be null. note: A table can have only one primary key at most, but multiple unqiue constraints are allowed. ========================================================== ==================== Index ------------------------------------------------------------------ create index name on table name (column name) composite index create index name on table name (column name 1, column name 2); create index name on table name (column name 2, column name 1 ); the SQL scan is performed from the back to the back, so the principle of using the index with the most excluded data is as follows: 1. creating an index on a large table makes sense. 2. create an index in the where clause or on a column frequently referenced in the connection condition. 3. the index level should not exceed four layers.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.