SQL Server Designer Implementation constraints

Source: Internet
Author: User

I. INTRODUCTION to CONSTRAINT Types

Second, create a data table

Iii. creating PRIMARY KEY constraints and non-null constraints

Iv. Creating a UNIQUE constraint

Select any column, right--index/Key

Click Add to generate Ix_employees*,

Type is set to "unique key",

Then select the columns you want to constrain,

Finally, the index name is modified.

Five, check the constraints

Case One

Case Two

Vi. Default Constraints

Seven, FOREIGN KEY constraints

Viii. Effects of restraint

Department table

Employee table

CHECK constraints

Non-null constraint

Unique constraint

FOREIGN KEY constraints

FOREIGN KEY constraints

Nine, Cascade Delete

When you delete the primary key table data, the foreign key table data associated with it is also deleted.

Delete data from department table Depid to 1

The Employee table foreign key Empdeptid 1 has also been deleted.

SQL Server Designer Implementation constraints

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.