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 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.