Primary key conflict-a table can have two primary keys.

Source: Internet
Author: User

Primary key conflict-a table can have two primary keys. A new primary key statement can have two primary keys in the table: primary key for table xs 'is not unique: first, the two fields are converted into the primary key, which is inaccurate.
Strictly speaking, because the two fields you select constitute the primary key, that is, "student ID + course number"
The combination is a primary key. This combination cannot be repeated and cannot be empty at the same time, rather than "student ID"
"Course number" is a primary key. If you do not believe it, you can view the tb system table. In the table www.2cto.com, you can add a primary key for the existing primary key: Statement example: alter table AC04_blbc drop primary key;
Alter table AC04_blbc modify sbxz VARCHAR (8) not null,
Add constraint PK_AC04_blbc primary key (AAE002, AAC001, AAE041, sbxz );
Author chen11-1

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.