. .

    @Mail.ru -

5.11: SET MySQL

» PHP » MySQL » SET

SET , , , . SET, , , (,). SET .

, , SET(one, two) NOT NULL , :


n
two
one, two

SET 64 .

MySQL SET , , . SET , , , . , SET :

mysql> SELECT set_col+0 FROM tbl_name;

SET, , , .

, SET (, b, c, d). (. 5.5):

5.5. set

SET
a 1 0001
b 2 0010
c 4 0100
d 8 1000

9 ( 1001), SET ( , d) , , d.

, , SET, , , . , . , , , .

, SET (, ܻ, , d), , d, d, d, , , d, d , d .

SET . , . NULL .

SELECT SET, LIKE FIND_IN_SET():

mysql> SELECT * FROM tbl_name WHERE set_col LIKE "%value%";
mysql> SELECT * FROM tbl_name WHERE FIND_IN_SET("value",set_col)>0;

:

mysql> SELECT * FROM tbl_name WHERE set_col = "val1,val2";
mysql> SELECT * FROM tbl_name WHERE set_col & 1;;

. , .

SET, SHOW COLUMNS FROM table_name LIKE set_column_name .