MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
partition_set.inc
1 --echo ---- Partitioning and set data type
2 
3 eval create table t1 (a set('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine=$engine
4 partition by key (a) (
5 partition pa1 max_rows=20 min_rows=2,
6 partition pa2 max_rows=30 min_rows=3,
7 partition pa3 max_rows=30 min_rows=4,
8 partition pa4 max_rows=40 min_rows=2);
9 show create table t1;
10 insert into t1 values ('A,B'),('C,D'),('E,L'),('G,H,K');
11 select * from t1 order by a;
12 select * from t1 where a='A,B';
13 update t1 set a='A,B,C' where a='E,L';
14 select * from t1 order by a;
15 delete from t1 where a='A,B';
16 select * from t1 order by a;
17 drop table t1;
18 
19 eval create table t2 (a set (
20 '1','2','3','4','5','6','7','8','9','0',
21 'A','B','C','D','E','F','G','H','I','J','K','L',
22 'M','N','O','P','Q','R','S','T','U','V','W','X',
23 'Y','Z'
24 ) not null, primary key(a)) engine=$engine
25 partition by key (a) partitions 27;
26 show create table t2;
27 insert into t2 values ('A'),('B'),('C'),('D'),('E'),('F'),('G'),('H'),('I'),('K'),('L'),('M'),('N'),('O'),('P'),('Q'),('S'),('T'),('U'),('V'),('X'),('Y'),('Z');
28 insert into t2 values ('A,B'),('B,C'),('C,D'),('D,E'),('E,F'),('F,G'),('G,H'),('H,I'),('I,J'),('K,L'),('L,M'),('M,N'),('N,O'),('O,P'),('P,Q'),('Q,R'),('S,T'),('T,U'),('U,V'),('V,W'),('X,Y'),('Y,Z'),('Z,A');
29 insert into t2 values ('A,B,C'),('B,C,D'),('C,D,E'),('D,E,F'),('E,F,G'),('F,G,H'),('G,H,I'),('H,I,J'),('I,J,K'),('K,L,M'),('L,M,N'),('M,N,O'),('N,O,P'),('O,P,Q'),('P,Q,R'),('Q,R,S'),('S,T,U'),('T,U,V'),('U,V,W'),('V,W,X'),('X,Y,Z'),('Y,Z,A'),('Z,A,B');
30 insert into t2 values ('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'),('0');
31 insert into t2 values ('1,2'),('2,3'),('3,4'),('4,5'),('5,6'),('6,7'),('7,8'),('8,9'),('9,0'),('0,1');
32 insert into t2 values ('1,2,3'),('2,3,4'),('3,4,5'),('4,5,6'),('5,6,7'),('6,7,8'),('7,8,9'),('8,9,0'),('9,0,1'),('0,1,2');
33 select count(*) from t2;
34 select * from t2 order by a;
35 drop table t2;