Start here. This is the direct spoken answer to practice first.
Why this question matters
Application validation can explain a rule before a write, but it cannot protect the data from races or from every other writer. Database constraints are the final guard for invariants the database can express reliably.
Application validation gives users early, specific feedback, while database constraints protect truth under concurrency and from every writer. I validate required values, formats, ranges, and known business rules in the application, then use NOT NULL, foreign keys, unique constraints, and check constraints for invariants the database can enforce. The two layers complement each other rather than compete.