Hello guys I'm just a newbie so sorry for my question :)
I already tried using char, tinyint, bool and CHECK constraint.
Here's my CHECK constraint:
CHECK (user_type>=0 AND user_type<=1)
But still I can insert values more than 1, all I want is just 1s and 0s. I'll use it as type of my users. Although I can validate this in front-end level, I still want do it in a database itself.
Thanks in advance :)
use set or enum as the colum type. then define the values (eg: 1,0) :)
The CHECK clause is parsed but ignored by all storage engines. (Source)
If you really want to do it you can create a table containing the values 0 and 1 and set up a foreign key constraint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With