Question of the Day Twenty-Three

Let us continue our question of the day series with day twenty-three.

What is a constraint?

A constraint is simply a rule associated with a column in a table that any data entered must follow.  Some examples are the unique constraint which ensures that no two records possess the same value for the column in question.  Another commonly used constraint is the primary key constraint which provides a unique identifier for each row in a table.  It is similar to the unique constraint but the key difference is that the unique constraint just means that ONE column is unique whereas a primary key can include up to a combination of 16 columns to make it unique.  There is also the NOT NULL constraint which essentially means that the column cannot be left blank.



About SQLGator

Microsoft Data Platform MVP, Florida Gator, Star Wars fanatic and is there anything else...oh yeah PS4! I am a geek and SQL Server Business Intelligence Consultant, there are other technologies greater than these? Not so fast my friend! I also love to travel to new and exotic places.

Posted on August 25, 2012, in SQL Schoolhouse and tagged . Bookmark the permalink. Leave a comment.

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

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

%d bloggers like this: