Summary

Today we talked about creating and managing constraints in a relational database. A constraint is an object created in the database that places rules on data stored in columns, and enforces these rules to protect your data. For example, if you try to insert data into a table column and the data does not follow the rules specified by the constraint, the database will not allow the violating data to be stored in the column.

We also talked about several different types of constraints. One was the primary key, which is a combination of one or more columns that make every row of data in a table unique. The unique constraint also ensures uniqueness of data in a table just like the primary key constraint. You can only have one primary key constraint ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.