54
54
# Primary key as case-sensitive string with \0s.
55
55
# also make primary key be longer then max. index length of MyISAM.
56
alter table t1 add str1 char (100) not null,
57
add zeroval int not null default 0,
58
add str2 char (100) not null,
59
add str3 char (100) not null;
61
update t1 set str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A'));
63
alter table t1 add primary key (str1, zeroval, str2, str3);
65
explain select * from t1 where key1 < 5 or key2 > 197;
56
ALTER TABLE t1 ADD str1 CHAR (100) DEFAULT "catfood" NOT NULL,
57
ADD zeroval INT NOT NULL DEFAULT 0,
58
ADD str2 CHAR (100) DEFAULT "bird" NOT NULL,
59
ADD str3 CHAR (100) DEFAULT "dog" NOT NULL;
61
UPDATE t1 SET str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A'));
63
ALTER TABLE t1 ADD PRIMARY KEY (str1, zeroval, str2, str3);
65
EXPLAIN SELECT * FROM t1 WHERE key1 < 5 OR key2 > 197;
67
67
select * from t1 where key1 < 5 or key2 > 197;