Advertisements
Home > DB Concepts > DB Basics – Integrity Constraints in a Database (SQL Server)

DB Basics – Integrity Constraints in a Database (SQL Server)

November 23, 2010 Leave a comment Go to comments

 
Integrity constraints are used to ensure accuracy and consistency of data in a relational database. Data integrity allows to define certain data quality requirements that the data in the database needs to meet. If a user tries to insert data that doesn’t meet these requirements, the RDBMS will not allow so.
 

A Constraint is a property assigned to a column or the set of columns in a table that prevents certain types of inconsistent data values from being placed in the column(s). Constraints are used to enforce the data integrity. This ensures the accuracy and reliability of the data in the database.
 

CONSTRAINT = The threat or use of force to prevent, restrict, or dictate the action or thought of others.
 

–> There are 7 types of Constraints and they are grouped in to 4 types:

A. ENTITY INTEGRITY 1. Primary Key blog post video
2. Unique Key video
B. REFERENTIAL INTEGRITY 3. Foreign Key blog post video
C. DOMAIN INTEGRITY 4. NOT NULL blog post video
5. DEFAULT
6. CHECK
D. USER DEFINED INTEGRITY 7. RULES blog post video

 

–> Check the video with discussion on all these Constraints:

Integrity Constraints


Advertisements
  1. anvesh
    December 22, 2017 at 10:04 pm

    HI I seen your post but i have doubt if the employee table having any duplicates like if another employee might be refers one of the department it may not acceptable.
    check it once
    thank you

  1. March 27, 2016 at 10:56 pm
  2. November 3, 2015 at 10:20 pm
  3. October 9, 2015 at 3:02 pm
  4. July 7, 2015 at 2:33 pm
  5. February 8, 2011 at 11:26 am
  6. December 9, 2010 at 2:41 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: