Can a set in MySQL be 0?
+1
A:
Sure, why not?
CREATE TABLE t_set (id INT NOT NULL PRIMARY KEY, value SET('one', 'two'));
INSERT
INTO t_set
VALUES (1, 1);
SELECT *
FROM t_set;
id value
---- ------
1 one
UPDATE t_set
SET value = 0;
SELECT *
FROM t_set;
id value
---- ------
1
Quassnoi
2009-04-01 13:43:17
+1
A:
A SET is a string object that can have zero or more values, each of which must be chosen from a list of allowed values specified when the table is created. SET column values that consist of multiple set members are specified with members separated by commas (“,”). A consequence of this is that SET member values should not themselves contain commas.
For example, a column specified as SET('one', 'two') NOT NULL can have any of these values:
'' 'one' 'two' 'one,two'
Anjisan
2009-04-01 13:45:17