SQL (iii)-PRIMARY key, foreign key, and index

Source: Internet
Author: User

Reprint Source:

Http://www.doc88.com/p-538467175318.html

1. Primary key

(1) Meaning: can determine the unique identification of a record.

(2) Primary key design principle: The primary key should be non-meaningful to the user; The primary key should be single-column, improve the efficiency of connection and filtering; The primary key should not be updated; The primary key should not contain dynamically changing data such as timestamps, create/Modify time columns, or primary keys should be generated automatically.

(3) View mode: Use Navicat Premium Connection database, select the table, right--design table, select Indexes, there is a unique identity is the primary key.

2. Foreign key

Used to associate with another table. If column A is a column of table 1 and is the primary key of table 2, then column A is the foreign key of table 1.

3. Index

SQL (iii)-PRIMARY key, foreign key, and index

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.