On the choice of datatypes
I have been wondering for a while, why there are so many databases where all well known best practises for good data modelling are thrown overboard and the wrong data types are used.
I see questions on why an ORDER BY doesn’t sort values propertly, or how to convert arbitrary character values to proper DATE or TIMESTAMP values on a nearly daily basis in various online forums. Or even worse: data is stored as comma-separated list of values in a VARCHAR column and suddenly finding things gets really messy.
Typically when those questions show up in a forum or StackOverflow someone leaves a comment saying that doing that is a really bad idea.
And more often than not the answer to those comments is “I didn’t design this database. I have to live with it and can’t change it”.
Why are the people who make those bad choices never forced to actually use the mess they are responsible for?
I wish all those short-sighted “database designers” would heed Ned Stark’s motto: “The man who passes the sentence should swing the sword”.
For bad choices in database design this would be: “Whoever does stupid things, should be forced to work with them for eternity”.
If that was the case, I wonder how often we would see those bad choices then.