CREATE TABLE setTest( attrib SET('bold','italic','underline') ); INSERT INTO setTest (attrib) VALUES ('bold'); INSERT INTO setTest (attrib) VALUES ('bold,italic'); INSERT INTO setTest (attrib) VALUES ('bold,italic,underline');
You can copy the code above and paste it into mysql, and you will find that SET is actually a collection. You can save every combined attribute that you declare.
CREATE TABLE enumTest( color ENUM('red','green','blue') ); INSERT INTO enumTest (color) VALUES ('red'); INSERT INTO enumTest (color) VALUES ('gray'); INSERT INTO enumTest (color) VALUES ('red,green');
You can also copy the code above. And you will find that each ENUM can actually be stored only once. And you will find that the results of the last two lines will be empty.
Winbobob May 14 '15 at 1:18 2015-05-14 01:18
source share