How do add a check constraint that a column contain 'y', 'n', or blank?
I'm new to MySQL and REGEX, so I'm eager to hear either how to do this, or if I should solve the problem a different way. As I move a database to MySQL, my thought is to avoid nulls to simplify selects.
I tried CONSTRAINT CHECK REGEXP [yn\s]. When I insert a space into the column, it tells me I violated the constraint. (Previously I tried [yn ], but that didn't work either.) I also haven't yet figured out how to enforce lowercase.
I read about ENUM, so perhaps that's a better way to handle this; though in a perfect world, I wouldn't add that complexity.
Or perhaps using nulls is just a better way to work in MySQL?
How should I handle a desire for yes/no/blank, or should I change my desire in a MySQL/node.js world?