Compound build parsing in SQL

Source: Internet
Author: User

Only one primary key per table
Unique keys/constraints can be multiple

A composite primary key refers to a compound unique, such as:
1 1
1 2
2 1
2 2

A single column is not the only one, but the combination is unique.

1  Create TableTable name (field name 1Int  not Null,2Field Name 2nvarchar( -) not Null Primary Key(field name 1, field Name 2),3 field Name 3 ......4 field name N ......) 5 To change the table structure after the table is built:6  7      CREATE TABLETable name (field name 1Int  not Null,8Field Name 2nvarchar( -) not Null9 field Name 3 ......Ten field name N ......) One     GO A   -     ALTER TABLETable name with NOCHECK ADD  -     CONSTRAINT [pk_ Table name] PRIMARY KEY  nonclustered  the      ( -           [Field Name 1], -           [Field Name 2] -      ) +     GO

Compound build parsing in SQL

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.