Posted on: 2016-01-08 What should validate your data - your application code, or your database? If you said "both", your answer is correct and you are entitled to feel smug for 1.5 seconds. And... stop. While application code can generally produce friendlier user errors, only the database knows what data it has right now - even if the application code ran a SELECT a few milliseconds ago, there may