Managing Constraints

How do you manage constraints in a database? First, you must understand the relationship between tables in your database. What are the dependencies? What columns depend on other columns? Can a column contain a NULL value, or must it contain data? Is there a list of allowed values for each column? How are the tables accessed by an application?

You should spend a lot of time upfront in the design phase of your database to ensure that you have a good, sound structure. Once you have created your database, you must understand how the tables are related and know what constraints there are in the database. If you do not know what all of the constraints are in your database (and you probably won't if your database is very big), you ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.