开发者

define 'enum' and 'set' columns in mysql with same values

开发者 https://www.devze.com 2023-01-18 16:57 出处:网络
is there a way to define an column of type \'enum\' and then define another column in the same table of type \'set\' with the same values of the \'enum\' ?

is there a way to define an column of type 'enum' and then define another column in the same table of type 'set' with the same values of the 'enum' ?

for example we have an 'enu开发者_如何转开发m' with values "one", "two", "three", we define the first column in the table with that enum type. Then I need to define the second column in the table with the 'SET' of "one", "two" and "three".

I hope I made myself clear on that...


You could rather do something like:

CREATE TABLE foo(bar VARCHAR(10),
                 CHECK(bar IN ('value1', 'value2'))
                );
0

精彩评论

暂无评论...
验证码 换一张
取 消