Looking for values containing the first set member : Set « Data Types « MySQL Tutorial

MySQL Tutorial
1. Introduction
2. Select Query
3. Database
4. Table
5. Table Join
6. Subquery
7. Insert Update Delete
8. Logic Operator
9. View
10. Data Types
11. Procedure Function
12. Cursor
13. Trigger
14. Date Time Functions
15. Comparison Functions Operators
16. Aggregate Functions
17. Cast Functions Operators
18. Control Flow Functions
19. Encryption Compression Functions
20. Information Functions
21. Math Numeric Functions
22. Miscellaneous Functions
23. String Functions
24. Regular Expressions
25. Data Dictionary
26. MySQL Utilities
27. Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
MySQL Tutorial » Data Types » Set 
10. 19. 7. Looking for values containing the first set member
mysql>
mysql> CREATE TABLE myset (col SET('a''b''c''d'));
Query OK, rows affected (0.05 sec)

mysql> INSERT INTO myset (colVALUES ('a,d'),
    ->                                ('d,a'),
    ->                                ('a,d,a'),
    ->                                ('a,d,d'),
    ->                                ('d,a,d');
Query OK, rows affected (0.00 sec)
Records: 5  Duplicates: 0  Warnings: 0

mysql> SELECT col FROM myset;
+------+
| col  |
+------+
| a,d  |
| a,d  |
| a,d  |
| a,d  |
| a,d  |
+------+
rows in set (0.00 sec)

mysql>
mysql> SELECT FROM myset WHERE col & 1;
+------+
| col  |
+------+
| a,d  |
| a,d  |
| a,d  |
| a,d  |
| a,d  |
+------+
rows in set (0.00 sec)

mysql>
mysql> drop table myset;
Query OK, rows affected (0.00 sec)
10. 19. Set
10. 19. 1. SET Type
10. 19. 2. SET column type
10. 19. 3. Using the SET type
10. 19. 4. If you set a SET column to an unsupported value, the value is ignored and a warning is issued
10. 19. 5. Search for SET values using the FIND_IN_SET() function
10. 19. 6. Search for SET values using the LIKE operator
10. 19. 7. Looking for values containing the first set member
10. 19. 8. MySQL stores SET and ENUM as numbers
10. 19. 9. Looking for an exact match in a set column
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.