Why are constraints applied in the database rather than the code?
Because:


I want all the data in the database to be subject to the same constraints, not just the new data to be subject to the constraints in the version of the code that's running today.
I want declarative constraints, not programmatic constraints.
Data in the database often outlives the code that's written to interact with it today. And that data -- not the code -- is the organisation's asset.
My code becomes much simpler when I know that all data is subject to rigorous constraints. I no longer have to consider special cases which I know that the database guarantees to be impossible.


Just some reasons that are important to me.