How to set value range to a column in mysql?
I want to set a value range to a column of a table.
Example For the decimal decimal, This decimal column should allow to insert or update the value between开发者_如何学编程 0 to 30.
Thanks in advance...!
As MySQL still doesn't support check constraints, the only way to do this in MySQL is a trigger (for update and insert) that checks the new value of the column and throws an error if the value is outside the valid range.
look for ENUM and SET Constraints http://dev.mysql.com/doc/refman/5.6/en/constraint-enum.html
精彩评论