Postgres Constraints for Newbies
One of the things that makes Postgres so awesome for software development is the incredibly useful system of constraints. Constraints are a way to tell Postgres which kinds of data can be inserted into tables, columns, or rows. As an application developer, you're going to build in this logic to your application as well and that's great.
https://blog.crunchydata.com/blog/postgres-constraints-for-newbies