content_image/832484.jpg
mysql> INSERT INTO myset (col) VALUES (’a,d,d,s’); Query OK, 1 row affected, 1 warning (0.03 sec) 

mysql> SHOW WARNINGS; 

<img src='content_image/832484.jpg'>

1 row in set (0.04 sec) 

mysql> SELECT col FROM myset; +------+ | col | +------+ | a,d | | a,d | | a,d | | a,d | | a,d | | a,d | +------+ 

6 rows in set (0.01 sec) 

If strict SQL mode is enabled, attempts to insert invalid SET  values result in an error. 

SET  values are sorted numerically. NULL  values sort before non- NULL SET  values. 

Functions such as SUM()  or AVG()  that expect a numeric argument cast the argument to a number if necessary. For SET  values, the cast operation causes the numeric value to be used. 

Normally, you search for SET  values using the FIND_IN_SET()  function or the LIKE  operator: 

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

The first statement finds rows where set_col  contains the value  set member. The second is similar, but not the same: It finds rows where set_col  contains value  anywhere, even as a substring of another set member. 

The following statements also are permitted: 

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

The first of these statements looks for values containing the first set member. The second looks for an exact match. Be careful with comparisons of the second type. Comparing set values to ’ val1 , val2 ’ returns different results than comparing values to ’ val2 , val1 ’ . You should specify the values in the same order they are listed in the column definition. 

To determine all possible values for a SET  column, use SHOW COLUMNS FROM tbl_name  LIKE set_col  and parse the SET  definition in the Type  column of the output. 

In the C API, SET  values are returned as strings. For information about using result set metadata to distinguish them from other strings, see C API Basic Data Structures. 

## 11.4 Spatial Data Types 

The Open Geospatial Consortium (OGC) is an international consortium of more than 250 companies, agencies, and universities participating in the development of publicly available conceptual solutions that can be useful with all kinds of applications that manage spatial data. 

