1
by brian
clean slate |
1 |
SET SESSION STORAGE_ENGINE = MEMORY;
|
2 |
drop table if exists t1,t2,t3,t4;
|
|
3 |
drop database if exists mysqltest;
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
4 |
create table t1 (id int not null auto_increment, code int not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=MyISAM;
|
1
by brian
clean slate |
5 |
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
|
6 |
select id, code, name from t1 order by id;
|
|
7 |
id code name
|
|
8 |
1 1 Tim
|
|
9 |
2 1 Monty
|
|
10 |
3 2 David
|
|
11 |
4 2 Erik
|
|
12 |
5 3 Sasha
|
|
13 |
6 3 Jeremy
|
|
14 |
7 4 Matt
|
|
15 |
update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
|
|
16 |
select id, code, name from t1 order by id;
|
|
17 |
id code name
|
|
18 |
2 1 Monty
|
|
19 |
3 2 David
|
|
20 |
4 2 Erik
|
|
21 |
5 3 Sasha
|
|
22 |
6 3 Jeremy
|
|
23 |
7 4 Matt
|
|
24 |
8 1 Sinisa
|
|
25 |
update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
|
|
26 |
select id, code, name from t1 order by id;
|
|
27 |
id code name
|
|
28 |
3 2 David
|
|
29 |
4 2 Erik
|
|
30 |
5 3 Sasha
|
|
31 |
6 3 Jeremy
|
|
32 |
7 4 Matt
|
|
33 |
8 1 Sinisa
|
|
34 |
12 1 Ralph
|
|
35 |
drop table t1;
|
|
36 |
CREATE TABLE t1 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
37 |
id int NOT NULL auto_increment,
|
38 |
parent_id int DEFAULT '0' NOT NULL,
|
|
39 |
level int DEFAULT '0' NOT NULL,
|
|
1
by brian
clean slate |
40 |
PRIMARY KEY (id),
|
41 |
KEY parent_id (parent_id),
|
|
42 |
KEY level (level)
|
|
43 |
) engine=MyISAM;
|
|
44 |
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
|
|
45 |
update t1 set parent_id=parent_id+100;
|
|
46 |
select * from t1 where parent_id=102;
|
|
47 |
id parent_id level
|
|
48 |
8 102 2
|
|
49 |
9 102 2
|
|
50 |
15 102 2
|
|
51 |
update t1 set id=id+1000;
|
|
52 |
update t1 set id=1024 where id=1009;
|
|
53 |
Got one of the listed errors
|
|
54 |
select * from t1;
|
|
55 |
id parent_id level
|
|
56 |
1001 100 0
|
|
57 |
1003 101 1
|
|
58 |
1004 101 1
|
|
59 |
1008 102 2
|
|
60 |
1009 102 2
|
|
61 |
1017 103 2
|
|
62 |
1022 104 2
|
|
63 |
1024 104 2
|
|
64 |
1028 105 2
|
|
65 |
1029 105 2
|
|
66 |
1030 105 2
|
|
67 |
1031 106 2
|
|
68 |
1032 106 2
|
|
69 |
1033 106 2
|
|
70 |
1203 107 2
|
|
71 |
1202 107 2
|
|
72 |
1020 103 2
|
|
73 |
1157 100 0
|
|
74 |
1193 105 2
|
|
75 |
1040 107 2
|
|
76 |
1002 101 1
|
|
77 |
1015 102 2
|
|
78 |
1006 101 1
|
|
79 |
1034 106 2
|
|
80 |
1035 106 2
|
|
81 |
1016 103 2
|
|
82 |
1007 101 1
|
|
83 |
1036 107 2
|
|
84 |
1018 103 2
|
|
85 |
1026 105 2
|
|
86 |
1027 105 2
|
|
87 |
1183 104 2
|
|
88 |
1038 107 2
|
|
89 |
1025 105 2
|
|
90 |
1037 107 2
|
|
91 |
1021 104 2
|
|
92 |
1019 103 2
|
|
93 |
1005 101 1
|
|
94 |
1179 105 2
|
|
95 |
update ignore t1 set id=id+1;
|
|
96 |
select * from t1;
|
|
97 |
id parent_id level
|
|
98 |
1001 100 0
|
|
99 |
1003 101 1
|
|
100 |
1004 101 1
|
|
101 |
1008 102 2
|
|
102 |
1010 102 2
|
|
103 |
1017 103 2
|
|
104 |
1023 104 2
|
|
105 |
1024 104 2
|
|
106 |
1028 105 2
|
|
107 |
1029 105 2
|
|
108 |
1030 105 2
|
|
109 |
1031 106 2
|
|
110 |
1032 106 2
|
|
111 |
1033 106 2
|
|
112 |
1204 107 2
|
|
113 |
1203 107 2
|
|
114 |
1020 103 2
|
|
115 |
1158 100 0
|
|
116 |
1194 105 2
|
|
117 |
1041 107 2
|
|
118 |
1002 101 1
|
|
119 |
1015 102 2
|
|
120 |
1006 101 1
|
|
121 |
1034 106 2
|
|
122 |
1035 106 2
|
|
123 |
1016 103 2
|
|
124 |
1007 101 1
|
|
125 |
1036 107 2
|
|
126 |
1018 103 2
|
|
127 |
1026 105 2
|
|
128 |
1027 105 2
|
|
129 |
1184 104 2
|
|
130 |
1039 107 2
|
|
131 |
1025 105 2
|
|
132 |
1038 107 2
|
|
133 |
1022 104 2
|
|
134 |
1019 103 2
|
|
135 |
1005 101 1
|
|
136 |
1180 105 2
|
|
137 |
update ignore t1 set id=1023 where id=1010;
|
|
138 |
select * from t1 where parent_id=102;
|
|
139 |
id parent_id level
|
|
140 |
1008 102 2
|
|
141 |
1010 102 2
|
|
142 |
1015 102 2
|
|
143 |
explain select level from t1 where level=1;
|
|
144 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
145 |
1 SIMPLE t1 ref level level 4 const # Using index
|
1
by brian
clean slate |
146 |
explain select level,id from t1 where level=1;
|
147 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
148 |
1 SIMPLE t1 ref level level 4 const #
|
1
by brian
clean slate |
149 |
explain select level,id,parent_id from t1 where level=1;
|
150 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
151 |
1 SIMPLE t1 ref level level 4 const #
|
1
by brian
clean slate |
152 |
select level,id from t1 where level=1;
|
153 |
level id
|
|
154 |
1 1003
|
|
155 |
1 1004
|
|
156 |
1 1002
|
|
157 |
1 1006
|
|
158 |
1 1007
|
|
159 |
1 1005
|
|
160 |
select level,id,parent_id from t1 where level=1;
|
|
161 |
level id parent_id
|
|
162 |
1 1003 101
|
|
163 |
1 1004 101
|
|
164 |
1 1002 101
|
|
165 |
1 1006 101
|
|
166 |
1 1007 101
|
|
167 |
1 1005 101
|
|
168 |
optimize table t1;
|
|
169 |
Table Op Msg_type Msg_text
|
|
170 |
test.t1 optimize status OK
|
|
171 |
show keys from t1;
|
|
172 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
|
|
173 |
t1 0 PRIMARY 1 id A # NULL NULL BTREE
|
|
174 |
t1 1 parent_id 1 parent_id A # NULL NULL BTREE
|
|
175 |
t1 1 level 1 level A # NULL NULL BTREE
|
|
176 |
drop table t1;
|
|
177 |
CREATE TABLE t1 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
178 |
gesuchnr int DEFAULT '0' NOT NULL,
|
179 |
benutzer_id int DEFAULT '0' NOT NULL,
|
|
1
by brian
clean slate |
180 |
PRIMARY KEY (gesuchnr,benutzer_id)
|
181 |
) engine=MyISAM;
|
|
182 |
replace into t1 (gesuchnr,benutzer_id) values (2,1);
|
|
183 |
replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
|
184 |
replace into t1 (gesuchnr,benutzer_id) values (1,1);
|
|
185 |
select * from t1;
|
|
186 |
gesuchnr benutzer_id
|
|
187 |
1 1
|
|
188 |
2 1
|
|
189 |
drop table t1;
|
|
190 |
create table t1 (a int) engine=MyISAM;
|
|
191 |
insert into t1 values (1), (2);
|
|
192 |
optimize table t1;
|
|
193 |
Table Op Msg_type Msg_text
|
|
194 |
test.t1 optimize status OK
|
|
195 |
delete from t1 where a = 1;
|
|
196 |
select * from t1;
|
|
197 |
a
|
|
198 |
2
|
|
199 |
check table t1;
|
|
200 |
Table Op Msg_type Msg_text
|
|
201 |
test.t1 check status OK
|
|
202 |
drop table t1;
|
|
203 |
create table t1 (a int,b varchar(20)) engine=MyISAM;
|
|
204 |
insert into t1 values (1,""), (2,"testing");
|
|
205 |
delete from t1 where a = 1;
|
|
206 |
select * from t1;
|
|
207 |
a b
|
|
208 |
2 testing
|
|
209 |
create index skr on t1 (a);
|
|
210 |
insert into t1 values (3,""), (4,"testing");
|
|
211 |
analyze table t1;
|
|
212 |
Table Op Msg_type Msg_text
|
|
213 |
test.t1 analyze status OK
|
|
214 |
show keys from t1;
|
|
215 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
|
|
216 |
t1 1 skr 1 a A # NULL NULL YES BTREE
|
|
217 |
drop table t1;
|
|
218 |
create table t1 (a int,b varchar(20),key(a)) engine=MyISAM;
|
|
219 |
insert into t1 values (1,""), (2,"testing");
|
|
220 |
select * from t1 where a = 1;
|
|
221 |
a b
|
|
222 |
1
|
|
223 |
drop table t1;
|
|
224 |
CREATE TABLE t1 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
225 |
user_id int DEFAULT '0' NOT NULL,
|
1
by brian
clean slate |
226 |
name varchar(100),
|
227 |
phone varchar(100),
|
|
228 |
ref_email varchar(100) DEFAULT '' NOT NULL,
|
|
229 |
detail varchar(200),
|
|
230 |
PRIMARY KEY (user_id,ref_email)
|
|
231 |
)engine=MyISAM;
|
|
232 |
INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
|
|
233 |
select * from t1 where user_id=10292;
|
|
234 |
user_id name phone ref_email detail
|
|
235 |
10292 sanjeev 29153373 sansh777@hotmail.com xxx
|
|
236 |
10292 shirish 2333604 shirish@yahoo.com ddsds
|
|
237 |
10292 sonali 323232 sonali@bolly.com filmstar
|
|
238 |
INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
|
|
239 |
select * from t1 where user_id=10292;
|
|
240 |
user_id name phone ref_email detail
|
|
241 |
10292 sanjeev 29153373 sansh777@hotmail.com xxx
|
|
242 |
10292 shirish 2333604 shirish@yahoo.com ddsds
|
|
243 |
10292 sonali 323232 sonali@bolly.com filmstar
|
|
244 |
select * from t1 where user_id>=10292;
|
|
245 |
user_id name phone ref_email detail
|
|
246 |
10292 sanjeev 29153373 sansh777@hotmail.com xxx
|
|
247 |
10292 shirish 2333604 shirish@yahoo.com ddsds
|
|
248 |
10292 sonali 323232 sonali@bolly.com filmstar
|
|
249 |
10293 shirish 2333604 shirish@yahoo.com ddsds
|
|
250 |
select * from t1 where user_id>10292;
|
|
251 |
user_id name phone ref_email detail
|
|
252 |
10293 shirish 2333604 shirish@yahoo.com ddsds
|
|
253 |
select * from t1 where user_id<10292;
|
|
254 |
user_id name phone ref_email detail
|
|
255 |
10291 sanjeev 29153373 sansh777@hotmail.com xxx
|
|
256 |
drop table t1;
|
|
257 |
CREATE TABLE t1 (a int not null, b int not null,c int not null,
|
|
258 |
key(a),primary key(a,b), unique(c),key(a),unique(b)) ENGINE = MyISAM;
|
|
259 |
show index from t1;
|
|
260 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
|
|
261 |
t1 0 PRIMARY 1 a A # NULL NULL BTREE
|
|
262 |
t1 0 PRIMARY 2 b A # NULL NULL BTREE
|
|
263 |
t1 0 c 1 c A # NULL NULL BTREE
|
|
264 |
t1 0 b 1 b A # NULL NULL BTREE
|
|
265 |
t1 1 a 1 a A # NULL NULL BTREE
|
|
266 |
t1 1 a_2 1 a A # NULL NULL BTREE
|
|
267 |
drop table t1;
|
|
268 |
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)) ENGINE = MEMORY;
|
|
269 |
alter table t1 engine=MyISAM;
|
|
270 |
insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
|
|
271 |
select * from t1;
|
|
272 |
col1 col2
|
|
273 |
1 1
|
|
274 |
5 2
|
|
275 |
2 3
|
|
276 |
3 4
|
|
277 |
4 4
|
|
278 |
update t1 set col2='7' where col1='4';
|
|
279 |
select * from t1;
|
|
280 |
col1 col2
|
|
281 |
1 1
|
|
282 |
5 2
|
|
283 |
2 3
|
|
284 |
3 4
|
|
285 |
4 7
|
|
286 |
alter table t1 add co3 int not null;
|
|
287 |
select * from t1;
|
|
288 |
col1 col2 co3
|
|
289 |
1 1 0
|
|
290 |
5 2 0
|
|
291 |
2 3 0
|
|
292 |
3 4 0
|
|
293 |
4 7 0
|
|
294 |
update t1 set col2='9' where col1='2';
|
|
295 |
select * from t1;
|
|
296 |
col1 col2 co3
|
|
297 |
1 1 0
|
|
298 |
5 2 0
|
|
299 |
2 9 0
|
|
300 |
3 4 0
|
|
301 |
4 7 0
|
|
302 |
drop table t1;
|
|
303 |
create table t1 (a int not null , b int, primary key (a)) engine = MyISAM;
|
|
304 |
create table t2 (a int not null , b int, primary key (a)) engine = MEMORY;
|
|
305 |
insert into t1 VALUES (1,3) , (2,3), (3,3);
|
|
306 |
select * from t1;
|
|
307 |
a b
|
|
308 |
1 3
|
|
309 |
2 3
|
|
310 |
3 3
|
|
311 |
insert into t2 select * from t1;
|
|
312 |
select * from t2;
|
|
313 |
a b
|
|
314 |
1 3
|
|
315 |
2 3
|
|
316 |
3 3
|
|
317 |
delete from t1 where b = 3;
|
|
318 |
select * from t1;
|
|
319 |
a b
|
|
320 |
insert into t1 select * from t2;
|
|
321 |
select * from t1;
|
|
322 |
a b
|
|
323 |
3 3
|
|
324 |
2 3
|
|
325 |
1 3
|
|
326 |
select * from t2;
|
|
327 |
a b
|
|
328 |
1 3
|
|
329 |
2 3
|
|
330 |
3 3
|
|
331 |
drop table t1,t2;
|
|
332 |
CREATE TABLE t1 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
333 |
id int NOT NULL auto_increment,
|
1
by brian
clean slate |
334 |
ggid varchar(32) binary DEFAULT '' NOT NULL,
|
335 |
email varchar(64) DEFAULT '' NOT NULL,
|
|
336 |
passwd varchar(32) binary DEFAULT '' NOT NULL,
|
|
337 |
PRIMARY KEY (id),
|
|
338 |
UNIQUE ggid (ggid)
|
|
339 |
) ENGINE=MyISAM;
|
|
340 |
insert into t1 (ggid,passwd) values ('test1','xxx');
|
|
341 |
insert into t1 (ggid,passwd) values ('test2','yyy');
|
|
342 |
insert into t1 (ggid,passwd) values ('test2','this will fail');
|
|
343 |
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
|
|
344 |
insert into t1 (ggid,id) values ('this will fail',1);
|
|
345 |
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
|
346 |
select * from t1 where ggid='test1';
|
|
347 |
id ggid email passwd
|
|
348 |
1 test1 xxx
|
|
349 |
select * from t1 where passwd='xxx';
|
|
350 |
id ggid email passwd
|
|
351 |
1 test1 xxx
|
|
352 |
select * from t1 where id=2;
|
|
353 |
id ggid email passwd
|
|
354 |
2 test2 yyy
|
|
355 |
replace into t1 (ggid,id) values ('this will work',1);
|
|
356 |
replace into t1 (ggid,passwd) values ('test2','this will work');
|
|
357 |
update t1 set id=100,ggid='test2' where id=1;
|
|
358 |
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
|
|
359 |
select * from t1;
|
|
360 |
id ggid email passwd
|
|
361 |
1 this will work
|
|
362 |
3 test2 this will work
|
|
363 |
select * from t1 where id=1;
|
|
364 |
id ggid email passwd
|
|
365 |
1 this will work
|
|
366 |
select * from t1 where id=999;
|
|
367 |
id ggid email passwd
|
|
368 |
drop table t1;
|
|
369 |
CREATE TABLE t1 (
|
|
370 |
user_name varchar(12),
|
|
371 |
password text,
|
|
372 |
subscribed char(1),
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
373 |
user_id int DEFAULT '0' NOT NULL,
|
374 |
quota bigint,
|
|
1
by brian
clean slate |
375 |
weight double,
|
376 |
access_date date,
|
|
377 |
approved datetime,
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
378 |
dummy_primary_key int NOT NULL auto_increment,
|
1
by brian
clean slate |
379 |
PRIMARY KEY (dummy_primary_key)
|
380 |
) ENGINE=MyISAM;
|
|
896.5.1
by Jay Pipes
Removes the TIME column type and related time functions. |
381 |
INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','2000-09-07 23:06:59',1);
|
382 |
INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','2000-09-07 23:06:59',2);
|
|
383 |
INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','2000-09-07 23:06:59',3);
|
|
384 |
INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','2000-09-07 23:06:59',4);
|
|
385 |
INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','2000-09-07 23:06:59',5);
|
|
386 |
select user_name, password , subscribed, user_id, quota, weight, access_date, approved, dummy_primary_key from t1 order by user_name;
|
|
387 |
user_name password subscribed user_id quota weight access_date approved dummy_primary_key
|
|
388 |
user_0 somepassword N 0 0 0 2000-09-07 2000-09-07 23:06:59 1
|
|
389 |
user_1 somepassword Y 1 1 1 2000-09-07 2000-09-07 23:06:59 2
|
|
390 |
user_2 somepassword N 2 2 1.4142135623731 2000-09-07 2000-09-07 23:06:59 3
|
|
391 |
user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 2000-09-07 23:06:59 4
|
|
392 |
user_4 somepassword N 4 4 2 2000-09-07 2000-09-07 23:06:59 5
|
|
1
by brian
clean slate |
393 |
drop table t1;
|
394 |
CREATE TABLE t1 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
395 |
id int NOT NULL auto_increment,
|
396 |
parent_id int DEFAULT '0' NOT NULL,
|
|
397 |
level int DEFAULT '0' NOT NULL,
|
|
1
by brian
clean slate |
398 |
KEY (id),
|
399 |
KEY parent_id (parent_id),
|
|
400 |
KEY level (level)
|
|
401 |
) engine=MyISAM;
|
|
402 |
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
|
|
403 |
INSERT INTO t1 values (179,5,2);
|
|
404 |
update t1 set parent_id=parent_id+100;
|
|
405 |
select * from t1 where parent_id=102;
|
|
406 |
id parent_id level
|
|
407 |
8 102 2
|
|
408 |
9 102 2
|
|
409 |
15 102 2
|
|
410 |
update t1 set id=id+1000;
|
|
411 |
update t1 set id=1024 where id=1009;
|
|
412 |
select * from t1;
|
|
413 |
id parent_id level
|
|
414 |
1001 100 0
|
|
415 |
1003 101 1
|
|
416 |
1004 101 1
|
|
417 |
1008 102 2
|
|
418 |
1024 102 2
|
|
419 |
1017 103 2
|
|
420 |
1022 104 2
|
|
421 |
1024 104 2
|
|
422 |
1028 105 2
|
|
423 |
1029 105 2
|
|
424 |
1030 105 2
|
|
425 |
1031 106 2
|
|
426 |
1032 106 2
|
|
427 |
1033 106 2
|
|
428 |
1203 107 2
|
|
429 |
1202 107 2
|
|
430 |
1020 103 2
|
|
431 |
1157 100 0
|
|
432 |
1193 105 2
|
|
433 |
1040 107 2
|
|
434 |
1002 101 1
|
|
435 |
1015 102 2
|
|
436 |
1006 101 1
|
|
437 |
1034 106 2
|
|
438 |
1035 106 2
|
|
439 |
1016 103 2
|
|
440 |
1007 101 1
|
|
441 |
1036 107 2
|
|
442 |
1018 103 2
|
|
443 |
1026 105 2
|
|
444 |
1027 105 2
|
|
445 |
1183 104 2
|
|
446 |
1038 107 2
|
|
447 |
1025 105 2
|
|
448 |
1037 107 2
|
|
449 |
1021 104 2
|
|
450 |
1019 103 2
|
|
451 |
1005 101 1
|
|
452 |
1179 105 2
|
|
453 |
update ignore t1 set id=id+1;
|
|
454 |
select * from t1;
|
|
455 |
id parent_id level
|
|
456 |
1002 100 0
|
|
457 |
1004 101 1
|
|
458 |
1005 101 1
|
|
459 |
1009 102 2
|
|
460 |
1025 102 2
|
|
461 |
1018 103 2
|
|
462 |
1023 104 2
|
|
463 |
1025 104 2
|
|
464 |
1029 105 2
|
|
465 |
1030 105 2
|
|
466 |
1031 105 2
|
|
467 |
1032 106 2
|
|
468 |
1033 106 2
|
|
469 |
1034 106 2
|
|
470 |
1204 107 2
|
|
471 |
1203 107 2
|
|
472 |
1021 103 2
|
|
473 |
1158 100 0
|
|
474 |
1194 105 2
|
|
475 |
1041 107 2
|
|
476 |
1003 101 1
|
|
477 |
1016 102 2
|
|
478 |
1007 101 1
|
|
479 |
1035 106 2
|
|
480 |
1036 106 2
|
|
481 |
1017 103 2
|
|
482 |
1008 101 1
|
|
483 |
1037 107 2
|
|
484 |
1019 103 2
|
|
485 |
1027 105 2
|
|
486 |
1028 105 2
|
|
487 |
1184 104 2
|
|
488 |
1039 107 2
|
|
489 |
1026 105 2
|
|
490 |
1038 107 2
|
|
491 |
1022 104 2
|
|
492 |
1020 103 2
|
|
493 |
1006 101 1
|
|
494 |
1180 105 2
|
|
495 |
update ignore t1 set id=1023 where id=1010;
|
|
496 |
select * from t1 where parent_id=102;
|
|
497 |
id parent_id level
|
|
498 |
1009 102 2
|
|
499 |
1025 102 2
|
|
500 |
1016 102 2
|
|
501 |
explain select level from t1 where level=1;
|
|
502 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
503 |
1 SIMPLE t1 ref level level 4 const # Using index
|
1
by brian
clean slate |
504 |
select level,id from t1 where level=1;
|
505 |
level id
|
|
506 |
1 1004
|
|
507 |
1 1005
|
|
508 |
1 1003
|
|
509 |
1 1007
|
|
510 |
1 1008
|
|
511 |
1 1006
|
|
512 |
select level,id,parent_id from t1 where level=1;
|
|
513 |
level id parent_id
|
|
514 |
1 1004 101
|
|
515 |
1 1005 101
|
|
516 |
1 1003 101
|
|
517 |
1 1007 101
|
|
518 |
1 1008 101
|
|
519 |
1 1006 101
|
|
520 |
select level,id from t1 where level=1 order by id;
|
|
521 |
level id
|
|
522 |
1 1003
|
|
523 |
1 1004
|
|
524 |
1 1005
|
|
525 |
1 1006
|
|
526 |
1 1007
|
|
527 |
1 1008
|
|
528 |
delete from t1 where level=1;
|
|
529 |
select * from t1;
|
|
530 |
id parent_id level
|
|
531 |
1002 100 0
|
|
532 |
1009 102 2
|
|
533 |
1025 102 2
|
|
534 |
1018 103 2
|
|
535 |
1023 104 2
|
|
536 |
1025 104 2
|
|
537 |
1029 105 2
|
|
538 |
1030 105 2
|
|
539 |
1031 105 2
|
|
540 |
1032 106 2
|
|
541 |
1033 106 2
|
|
542 |
1034 106 2
|
|
543 |
1204 107 2
|
|
544 |
1203 107 2
|
|
545 |
1021 103 2
|
|
546 |
1158 100 0
|
|
547 |
1194 105 2
|
|
548 |
1041 107 2
|
|
549 |
1016 102 2
|
|
550 |
1035 106 2
|
|
551 |
1036 106 2
|
|
552 |
1017 103 2
|
|
553 |
1037 107 2
|
|
554 |
1019 103 2
|
|
555 |
1027 105 2
|
|
556 |
1028 105 2
|
|
557 |
1184 104 2
|
|
558 |
1039 107 2
|
|
559 |
1026 105 2
|
|
560 |
1038 107 2
|
|
561 |
1022 104 2
|
|
562 |
1020 103 2
|
|
563 |
1180 105 2
|
|
564 |
drop table t1;
|
|
565 |
CREATE TABLE t1 (
|
|
566 |
sca_code char(6) NOT NULL,
|
|
567 |
cat_code char(6) NOT NULL,
|
|
568 |
sca_desc varchar(50),
|
|
569 |
lan_code char(2) NOT NULL,
|
|
570 |
sca_pic varchar(100),
|
|
571 |
sca_sdesc varchar(50),
|
|
572 |
sca_sch_desc varchar(16),
|
|
573 |
PRIMARY KEY (sca_code, cat_code, lan_code),
|
|
574 |
INDEX sca_pic (sca_pic)
|
|
575 |
) engine = MyISAM ;
|
|
576 |
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
|
|
577 |
select count(*) from t1 where sca_code = 'PD';
|
|
578 |
count(*)
|
|
579 |
1
|
|
580 |
select count(*) from t1 where sca_code <= 'PD';
|
|
581 |
count(*)
|
|
582 |
1
|
|
583 |
select count(*) from t1 where sca_pic is null;
|
|
584 |
count(*)
|
|
585 |
2
|
|
586 |
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
|
|
587 |
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
|
588 |
count(*)
|
|
589 |
1
|
|
590 |
select count(*) from t1 where cat_code='E';
|
|
591 |
count(*)
|
|
592 |
0
|
|
593 |
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
|
|
594 |
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
|
595 |
count(*)
|
|
596 |
1
|
|
597 |
select count(*) from t1 where sca_pic >= 'n';
|
|
598 |
count(*)
|
|
599 |
1
|
|
600 |
select sca_pic from t1 where sca_pic is null;
|
|
601 |
sca_pic
|
|
602 |
NULL
|
|
603 |
NULL
|
|
604 |
update t1 set sca_pic="test" where sca_pic is null;
|
|
605 |
delete from t1 where sca_code='pd';
|
|
606 |
drop table t1;
|
|
607 |
set @a:=now();
|
|
608 |
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=MyISAM;
|
|
609 |
insert into t1 (a) values(1),(2),(3);
|
|
610 |
select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
|
|
611 |
a
|
|
612 |
1
|
|
613 |
2
|
|
614 |
3
|
|
615 |
select a from t1 natural join t1 as t2 where b >= @a order by a;
|
|
616 |
a
|
|
617 |
1
|
|
618 |
2
|
|
619 |
3
|
|
620 |
update t1 set a=5 where a=1;
|
|
621 |
select a from t1;
|
|
622 |
a
|
|
623 |
2
|
|
624 |
3
|
|
625 |
5
|
|
626 |
drop table t1;
|
|
627 |
create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=MyISAM;
|
|
628 |
insert into t1 values("hello",1),("world",2);
|
|
629 |
select * from t1 order by b desc;
|
|
630 |
a b
|
|
631 |
world 2
|
|
632 |
hello 1
|
|
633 |
optimize table t1;
|
|
634 |
Table Op Msg_type Msg_text
|
|
635 |
test.t1 optimize status OK
|
|
636 |
show keys from t1;
|
|
637 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
|
|
638 |
t1 0 PRIMARY 1 a A # NULL NULL BTREE
|
|
639 |
drop table t1;
|
|
640 |
create table t1 (i int, j int ) ENGINE=MyISAM;
|
|
641 |
insert into t1 values (1,2);
|
|
642 |
select * from t1 where i=1 and j=2;
|
|
643 |
i j
|
|
644 |
1 2
|
|
645 |
create index ax1 on t1 (i,j);
|
|
646 |
select * from t1 where i=1 and j=2;
|
|
647 |
i j
|
|
648 |
1 2
|
|
649 |
drop table t1;
|
|
650 |
CREATE TABLE t1 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
651 |
a int NOT NULL,
|
652 |
b int NOT NULL,
|
|
1
by brian
clean slate |
653 |
UNIQUE (a, b)
|
654 |
) ENGINE = MyISAM;
|
|
655 |
INSERT INTO t1 VALUES (1, 1);
|
|
656 |
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
|
|
657 |
MIN(B) MAX(b)
|
|
658 |
1 1
|
|
659 |
drop table t1;
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
660 |
CREATE TABLE t1 (a int NOT NULL) engine=MyISAM;
|
1
by brian
clean slate |
661 |
INSERT INTO t1 VALUES (1);
|
662 |
SELECT * FROM t1;
|
|
663 |
a
|
|
664 |
1
|
|
665 |
DROP TABLE t1;
|
|
666 |
create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = MyISAM;
|
|
667 |
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
|
|
668 |
explain select * from t1 where a > 0 and a < 50;
|
|
669 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
670 |
1 SIMPLE t1 system PRIMARY NULL NULL NULL #
|
|
671 |
drop table t1;
|
|
672 |
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=MyISAM;
|
|
673 |
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
|
|
674 |
LOCK TABLES t1 WRITE;
|
|
675 |
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
|
|
676 |
ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
|
|
677 |
select id from t1;
|
|
678 |
id
|
|
679 |
0
|
|
680 |
1
|
|
681 |
2
|
|
682 |
99
|
|
683 |
select id from t1;
|
|
684 |
id
|
|
685 |
0
|
|
686 |
1
|
|
687 |
2
|
|
688 |
99
|
|
689 |
UNLOCK TABLES;
|
|
690 |
DROP TABLE t1;
|
|
691 |
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=MyISAM;
|
|
692 |
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
|
|
693 |
LOCK TABLES t1 WRITE;
|
|
694 |
begin;
|
|
695 |
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
|
|
696 |
ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
|
|
697 |
select id from t1;
|
|
698 |
id
|
|
699 |
0
|
|
700 |
1
|
|
701 |
2
|
|
702 |
99
|
|
703 |
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
|
|
704 |
commit;
|
|
705 |
select id,id3 from t1;
|
|
706 |
id id3
|
|
707 |
0 0
|
|
708 |
2 2
|
|
709 |
1 1
|
|
710 |
99 2
|
|
711 |
100 2
|
|
712 |
UNLOCK TABLES;
|
|
713 |
DROP TABLE t1;
|
|
714 |
create table t1 (a char(20), unique (a(5))) engine=MyISAM;
|
|
715 |
drop table t1;
|
|
716 |
create table t1 (a char(20), index (a(5))) engine=MyISAM;
|
|
717 |
show create table t1;
|
|
718 |
Table Create Table
|
|
719 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
720 |
`a` varchar(20) DEFAULT NULL,
|
1008.3.10
by Stewart Smith
fix test result now that I fixed SHOW CREATE TABLE |
721 |
KEY `a` (`a`(5))
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
722 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
723 |
drop table t1;
|
724 |
create temporary table t1 (a int not null auto_increment, primary key(a)) engine=MyISAM;
|
|
725 |
insert into t1 values (NULL),(NULL),(NULL);
|
|
726 |
delete from t1 where a=3;
|
|
727 |
insert into t1 values (NULL);
|
|
728 |
select * from t1;
|
|
729 |
a
|
|
730 |
1
|
|
731 |
2
|
|
732 |
4
|
|
733 |
alter table t1 add b int;
|
|
734 |
select * from t1;
|
|
735 |
a b
|
|
736 |
1 NULL
|
|
737 |
2 NULL
|
|
738 |
4 NULL
|
|
739 |
drop table t1;
|
|
740 |
create table t1
|
|
741 |
(
|
|
742 |
id int auto_increment primary key,
|
|
743 |
name varchar(32) not null,
|
|
744 |
value text not null,
|
|
745 |
uid int not null,
|
|
746 |
unique key(name,uid)
|
|
747 |
) engine=MyISAM;
|
|
748 |
insert into t1 values (1,'one','one value',101),
|
|
749 |
(2,'two','two value',102),(3,'three','three value',103);
|
|
750 |
replace into t1 (value,name,uid) values ('other value','two',102);
|
|
751 |
delete from t1 where uid=102;
|
|
752 |
replace into t1 (value,name,uid) values ('other value','two',102);
|
|
753 |
replace into t1 (value,name,uid) values ('other value','two',102);
|
|
754 |
select * from t1;
|
|
755 |
id name value uid
|
|
756 |
1 one one value 101
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
757 |
6 two other value 102
|
1
by brian
clean slate |
758 |
3 three three value 103
|
759 |
drop table t1;
|
|
760 |
create database mysqltest;
|
|
761 |
create table mysqltest.t1 (a int not null) engine= MyISAM;
|
|
762 |
insert into mysqltest.t1 values(1);
|
|
763 |
create table mysqltest.t2 (a int not null) engine= MEMORY;
|
|
764 |
insert into mysqltest.t2 values(1);
|
|
765 |
create table mysqltest.t3 (a int not null) engine= MEMORY;
|
|
766 |
insert into mysqltest.t3 values(1);
|
|
767 |
commit;
|
|
768 |
drop database mysqltest;
|
|
769 |
show tables from mysqltest;
|
|
770 |
ERROR 42000: Unknown database 'mysqltest'
|
|
771 |
set autocommit=0;
|
|
772 |
create table t1 (a int not null) engine= MyISAM;
|
|
773 |
insert into t1 values(1),(2);
|
|
774 |
truncate table t1;
|
|
775 |
commit;
|
|
776 |
truncate table t1;
|
|
777 |
truncate table t1;
|
|
778 |
select * from t1;
|
|
779 |
a
|
|
780 |
insert into t1 values(1),(2);
|
|
781 |
delete from t1;
|
|
782 |
select * from t1;
|
|
783 |
a
|
|
784 |
commit;
|
|
785 |
drop table t1;
|
|
786 |
set autocommit=1;
|
|
787 |
create table t1 (a int not null) engine= MyISAM;
|
|
788 |
insert into t1 values(1),(2);
|
|
789 |
truncate table t1;
|
|
790 |
insert into t1 values(1),(2);
|
|
791 |
select * from t1;
|
|
792 |
a
|
|
793 |
1
|
|
794 |
2
|
|
795 |
truncate table t1;
|
|
796 |
insert into t1 values(1),(2);
|
|
797 |
delete from t1;
|
|
798 |
select * from t1;
|
|
799 |
a
|
|
800 |
drop table t1;
|
|
801 |
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=MyISAM;
|
|
802 |
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
|
|
803 |
explain select * from t1 order by a;
|
|
804 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
805 |
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
|
|
806 |
explain select * from t1 order by b;
|
|
807 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
808 |
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
|
|
809 |
explain select * from t1 order by c;
|
|
810 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
811 |
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
|
|
812 |
explain select a from t1 order by a;
|
|
813 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
814 |
1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index
|
|
815 |
explain select b from t1 order by b;
|
|
816 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
817 |
1 SIMPLE t1 index NULL b 4 NULL # Using index
|
|
818 |
explain select a,b from t1 order by b;
|
|
819 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
820 |
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
|
|
821 |
explain select a,b from t1;
|
|
822 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
823 |
1 SIMPLE t1 ALL NULL NULL NULL NULL #
|
|
824 |
explain select a,b,c from t1;
|
|
825 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
826 |
1 SIMPLE t1 ALL NULL NULL NULL NULL #
|
|
827 |
drop table t1;
|
|
828 |
create table t1 (t int not null default 1, key (t)) engine=MyISAM;
|
|
829 |
desc t1;
|
|
830 |
Field Type Null Key Default Extra
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
831 |
t int NO MUL 1
|
1
by brian
clean slate |
832 |
drop table t1;
|
833 |
CREATE TABLE t1 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
834 |
number bigint NOT NULL default '0',
|
1
by brian
clean slate |
835 |
cname char(15) NOT NULL default '',
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
836 |
carrier_id int NOT NULL default '0',
|
837 |
privacy int NOT NULL default '0',
|
|
1
by brian
clean slate |
838 |
last_mod_date timestamp NOT NULL,
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
839 |
last_mod_id int NOT NULL default '0',
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
840 |
last_app_date timestamp NULL,
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
841 |
last_app_id int default '-1',
|
842 |
version int NOT NULL default '0',
|
|
843 |
assigned_scps int default '0',
|
|
844 |
status int default '0'
|
|
1
by brian
clean slate |
845 |
) ENGINE=MyISAM;
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
846 |
INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,NULL,-1,2,3,1);
|
1
by brian
clean slate |
847 |
INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
848 |
INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,NULL,-1,1,24,1);
|
1
by brian
clean slate |
849 |
INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0);
|
850 |
INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0);
|
|
851 |
INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0);
|
|
852 |
CREATE TABLE t2 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
853 |
number bigint NOT NULL default '0',
|
1
by brian
clean slate |
854 |
cname char(15) NOT NULL default '',
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
855 |
carrier_id int NOT NULL default '0',
|
856 |
privacy int NOT NULL default '0',
|
|
1
by brian
clean slate |
857 |
last_mod_date timestamp NOT NULL,
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
858 |
last_mod_id int NOT NULL default '0',
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
859 |
last_app_date timestamp NULL,
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
860 |
last_app_id int default '-1',
|
861 |
version int NOT NULL default '0',
|
|
862 |
assigned_scps int default '0',
|
|
863 |
status int default '0'
|
|
1
by brian
clean slate |
864 |
) ENGINE=MyISAM;
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
865 |
INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,NULL,-1,2,3,1);
|
1
by brian
clean slate |
866 |
INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
867 |
INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,NULL,-1,1,24,1);
|
1
by brian
clean slate |
868 |
INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
|
869 |
select * from t1;
|
|
870 |
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
|
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
871 |
4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 NULL -1 2 3 1
|
1
by brian
clean slate |
872 |
9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
873 |
650 San Francisco 0 0 2001-12-27 11:13:36 342 NULL -1 1 24 1
|
1
by brian
clean slate |
874 |
302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0
|
875 |
6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
|
|
876 |
333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
|
|
877 |
select * from t2;
|
|
878 |
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
|
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
879 |
4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 NULL -1 2 3 1
|
1
by brian
clean slate |
880 |
9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
881 |
650 San Francisco 90 0 2002-01-09 11:31:58 342 NULL -1 1 24 1
|
1
by brian
clean slate |
882 |
333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
|
883 |
delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
|
|
884 |
select * from t1;
|
|
885 |
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
|
|
886 |
6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
|
|
887 |
333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
|
|
888 |
select * from t2;
|
|
889 |
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
|
|
890 |
333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
|
|
891 |
select * from t2;
|
|
892 |
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
|
|
893 |
333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
|
|
894 |
drop table t1,t2;
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
895 |
create table t1 (id int not null auto_increment, code int not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=MyISAM;
|
1
by brian
clean slate |
896 |
BEGIN;
|
897 |
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
|
898 |
SELECT @@tx_isolation,@@global.tx_isolation;
|
|
899 |
@@tx_isolation @@global.tx_isolation
|
|
900 |
SERIALIZABLE REPEATABLE-READ
|
|
901 |
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
|
|
902 |
select id, code, name from t1 order by id;
|
|
903 |
id code name
|
|
904 |
1 1 Tim
|
|
905 |
2 1 Monty
|
|
906 |
3 2 David
|
|
907 |
COMMIT;
|
|
908 |
BEGIN;
|
|
909 |
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
|
910 |
insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
|
|
911 |
select id, code, name from t1 order by id;
|
|
912 |
id code name
|
|
913 |
1 1 Tim
|
|
914 |
2 1 Monty
|
|
915 |
3 2 David
|
|
916 |
4 2 Erik
|
|
917 |
5 3 Sasha
|
|
918 |
COMMIT;
|
|
919 |
BEGIN;
|
|
920 |
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
|
921 |
insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
|
|
922 |
select id, code, name from t1 order by id;
|
|
923 |
id code name
|
|
924 |
1 1 Tim
|
|
925 |
2 1 Monty
|
|
926 |
3 2 David
|
|
927 |
4 2 Erik
|
|
928 |
5 3 Sasha
|
|
929 |
6 3 Jeremy
|
|
930 |
7 4 Matt
|
|
931 |
COMMIT;
|
|
932 |
DROP TABLE t1;
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
933 |
create table t1 (n int, d int) engine=MyISAM;
|
934 |
create table t2 (n int, d int) engine=MyISAM;
|
|
1
by brian
clean slate |
935 |
insert into t1 values(1,1),(1,2);
|
936 |
insert into t2 values(1,10),(2,20);
|
|
937 |
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
|
|
938 |
select * from t1;
|
|
939 |
n d
|
|
940 |
1 10
|
|
941 |
1 10
|
|
942 |
select * from t2;
|
|
943 |
n d
|
|
944 |
1 30
|
|
945 |
2 20
|
|
946 |
drop table t1,t2;
|
|
947 |
create table t1 (a int, b int) engine=MyISAM;
|
|
948 |
insert into t1 values(20,null);
|
|
949 |
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
|
950 |
t2.b=t3.a;
|
|
951 |
b ifnull(t2.b,"this is null")
|
|
952 |
NULL this is null
|
|
953 |
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
|
954 |
t2.b=t3.a order by 1;
|
|
955 |
b ifnull(t2.b,"this is null")
|
|
956 |
NULL this is null
|
|
957 |
insert into t1 values(10,null);
|
|
958 |
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
|
|
959 |
t2.b=t3.a order by 1;
|
|
960 |
b ifnull(t2.b,"this is null")
|
|
961 |
NULL this is null
|
|
962 |
NULL this is null
|
|
963 |
drop table t1;
|
|
964 |
create table t1 (a varchar(10) not null) engine = MEMORY;
|
|
965 |
create table t2 (b varchar(10) not null unique) engine=MyISAM;
|
|
966 |
select t1.a from t1,t2 where t1.a=t2.b;
|
|
967 |
a
|
|
968 |
drop table t1,t2;
|
|
969 |
create table t1 (a int not null, b int, primary key (a)) engine = MyISAM;
|
|
970 |
create table t2 (a int not null, b int, primary key (a)) engine = MyISAM;
|
|
971 |
insert into t1 values (10, 20);
|
|
972 |
insert into t2 values (10, 20);
|
|
973 |
update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
|
|
974 |
drop table t1,t2;
|
|
975 |
CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=MyISAM;
|
|
976 |
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
|
|
977 |
UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
|
|
978 |
SELECT * from t1;
|
|
979 |
a b
|
|
980 |
1 1
|
|
981 |
102 2
|
|
982 |
103 3
|
|
983 |
4 4
|
|
984 |
5 5
|
|
985 |
6 6
|
|
986 |
7 7
|
|
987 |
8 8
|
|
988 |
9 9
|
|
989 |
drop table t1;
|
|
990 |
CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=MyISAM;
|
|
991 |
CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=MyISAM;
|
|
992 |
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
|
|
993 |
INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
|
|
994 |
update t1,t2 set t1.a=t1.a+100;
|
|
995 |
select * from t1;
|
|
996 |
a b
|
|
997 |
101 1
|
|
998 |
102 2
|
|
999 |
103 3
|
|
1000 |
104 4
|
|
1001 |
105 5
|
|
1002 |
106 6
|
|
1003 |
107 7
|
|
1004 |
108 8
|
|
1005 |
109 9
|
|
1006 |
110 10
|
|
1007 |
111 11
|
|
1008 |
112 12
|
|
1009 |
update t1,t2 set t1.a=t1.a+100 where t1.a=101;
|
|
1010 |
select * from t1;
|
|
1011 |
a b
|
|
1012 |
201 1
|
|
1013 |
102 2
|
|
1014 |
103 3
|
|
1015 |
104 4
|
|
1016 |
105 5
|
|
1017 |
106 6
|
|
1018 |
107 7
|
|
1019 |
108 8
|
|
1020 |
109 9
|
|
1021 |
110 10
|
|
1022 |
111 11
|
|
1023 |
112 12
|
|
1024 |
update t1,t2 set t1.b=t1.b+10 where t1.b=2;
|
|
1025 |
select * from t1;
|
|
1026 |
a b
|
|
1027 |
201 1
|
|
1028 |
102 12
|
|
1029 |
103 3
|
|
1030 |
104 4
|
|
1031 |
105 5
|
|
1032 |
106 6
|
|
1033 |
107 7
|
|
1034 |
108 8
|
|
1035 |
109 9
|
|
1036 |
110 10
|
|
1037 |
111 11
|
|
1038 |
112 12
|
|
1039 |
update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
|
|
1040 |
select * from t1;
|
|
1041 |
a b
|
|
1042 |
201 1
|
|
1043 |
102 12
|
|
1044 |
103 5
|
|
1045 |
104 6
|
|
1046 |
105 7
|
|
1047 |
106 6
|
|
1048 |
107 7
|
|
1049 |
108 8
|
|
1050 |
109 9
|
|
1051 |
110 10
|
|
1052 |
111 11
|
|
1053 |
112 12
|
|
1054 |
select * from t2;
|
|
1055 |
a b
|
|
1056 |
1 1
|
|
1057 |
2 2
|
|
1058 |
3 13
|
|
1059 |
4 14
|
|
1060 |
5 15
|
|
1061 |
6 6
|
|
1062 |
7 7
|
|
1063 |
8 8
|
|
1064 |
9 9
|
|
1065 |
drop table t1,t2;
|
|
1066 |
CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MEMORY;
|
|
1067 |
CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM;
|
|
1068 |
SET AUTOCOMMIT=0;
|
|
1069 |
INSERT INTO t1 ( B_ID ) VALUES ( 1 );
|
|
1070 |
INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
|
|
1071 |
ROLLBACK;
|
|
1072 |
Warnings:
|
|
1073 |
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
|
1074 |
SELECT * FROM t1;
|
|
1075 |
B_ID
|
|
1076 |
1
|
|
1077 |
drop table t1,t2;
|
|
1078 |
create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = MyISAM;
|
|
1079 |
insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
|
|
1080 |
select distinct parent,child from t1 order by parent;
|
|
1081 |
parent child
|
|
1082 |
0 4
|
|
1083 |
1 2
|
|
1084 |
1 3
|
|
1085 |
2 1
|
|
1086 |
drop table t1;
|
|
1087 |
create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=MyISAM;
|
|
1088 |
create table t2 (a int not null auto_increment primary key, b int) ENGINE = MEMORY;
|
|
1089 |
insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
|
|
1090 |
insert into t2 (a) select b from t1;
|
|
1091 |
insert into t1 (b) select b from t2;
|
|
1092 |
insert into t2 (a) select b from t1;
|
|
1093 |
insert into t1 (a) select b from t2;
|
|
1094 |
insert into t2 (a) select b from t1;
|
|
1095 |
insert into t1 (a) select b from t2;
|
|
1096 |
insert into t2 (a) select b from t1;
|
|
1097 |
insert into t1 (a) select b from t2;
|
|
1098 |
insert into t2 (a) select b from t1;
|
|
1099 |
insert into t1 (a) select b from t2;
|
|
1100 |
insert into t2 (a) select b from t1;
|
|
1101 |
insert into t1 (a) select b from t2;
|
|
1102 |
insert into t2 (a) select b from t1;
|
|
1103 |
insert into t1 (a) select b from t2;
|
|
1104 |
insert into t2 (a) select b from t1;
|
|
1105 |
insert into t1 (a) select b from t2;
|
|
1106 |
insert into t2 (a) select b from t1;
|
|
1107 |
insert into t1 (a) select b from t2;
|
|
1108 |
select count(*) from t1;
|
|
1109 |
count(*)
|
|
1110 |
29267
|
|
1111 |
explain select * from t1 where c between 1 and 2500;
|
|
1112 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1113 |
1 SIMPLE t1 range c c 5 NULL # Using where; Using MRR
|
1
by brian
clean slate |
1114 |
update t1 set c=a;
|
1115 |
explain select * from t1 where c between 1 and 2500;
|
|
1116 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1117 |
1 SIMPLE t1 range c c 5 NULL # Using where; Using MRR
|
1
by brian
clean slate |
1118 |
drop table t1,t2;
|
1119 |
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=MyISAM;
|
|
1120 |
insert into t1 (id) values (null),(null),(null),(null),(null);
|
|
1121 |
update t1 set fk=69 where fk is null order by id limit 1;
|
|
1122 |
SELECT * from t1;
|
|
1123 |
id fk
|
|
1124 |
1 69
|
|
1125 |
2 NULL
|
|
1126 |
3 NULL
|
|
1127 |
4 NULL
|
|
1128 |
5 NULL
|
|
1129 |
drop table t1;
|
|
1130 |
create table t1 (a int not null, b int not null, key (a)) engine=MyISAM;
|
|
1131 |
insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
|
|
1132 |
SET @tmp=0;
|
|
1133 |
update t1 set b=(@tmp:=@tmp+1) order by a;
|
|
1134 |
update t1 set b=99 where a=1 order by b asc limit 1;
|
|
1135 |
update t1 set b=100 where a=1 order by b desc limit 2;
|
|
1136 |
update t1 set a=a+10+b where a=1 order by b;
|
|
1137 |
select * from t1 order by a,b;
|
|
1138 |
a b
|
|
1139 |
2 4
|
|
1140 |
2 5
|
|
1141 |
2 6
|
|
1142 |
3 7
|
|
1143 |
3 8
|
|
1144 |
3 9
|
|
1145 |
3 10
|
|
1146 |
3 11
|
|
1147 |
3 12
|
|
1148 |
13 2
|
|
1149 |
111 100
|
|
1150 |
111 100
|
|
1151 |
drop table t1;
|
|
1152 |
create table t1 ( c char(8) not null ) engine=MyISAM;
|
|
1153 |
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
|
1154 |
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
|
1155 |
alter table t1 add b char(8) not null;
|
|
1156 |
alter table t1 add a char(8) not null;
|
|
1157 |
alter table t1 add primary key (a,b,c);
|
|
1158 |
update t1 set a=c, b=c;
|
|
1159 |
create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=MyISAM;
|
|
1160 |
insert into t2 select * from t1;
|
|
1161 |
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
|
1162 |
drop table t1,t2;
|
|
1163 |
SET AUTOCOMMIT=1;
|
|
1164 |
create table t1 (a integer auto_increment primary key) engine=MyISAM;
|
|
1165 |
insert into t1 (a) values (NULL),(NULL);
|
|
1166 |
truncate table t1;
|
|
1167 |
insert into t1 (a) values (NULL),(NULL);
|
|
1168 |
SELECT * from t1;
|
|
1169 |
a
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1170 |
3
|
1171 |
4
|
|
1
by brian
clean slate |
1172 |
drop table t1;
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1173 |
CREATE TABLE t1 (col1 int)ENGINE=MyISAM;
|
1174 |
CREATE TABLE t2 (col1 int,stamp TIMESTAMP,INDEX stamp_idx
|
|
1
by brian
clean slate |
1175 |
(stamp))ENGINE=MyISAM;
|
1176 |
insert into t1 values (1),(2),(3);
|
|
1177 |
insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
|
|
907.1.7
by Jay Pipes
Merged in remove-timezone work |
1178 |
ERROR HY000: Received an invalid value '20020204310000' for a UNIX timestamp.
|
1
by brian
clean slate |
1179 |
SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
|
1180 |
'20020204120000' GROUP BY col1;
|
|
1181 |
col1
|
|
1182 |
1
|
|
1183 |
2
|
|
1184 |
3
|
|
1185 |
drop table t1,t2;
|
|
1186 |
CREATE TABLE t1 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1187 |
`id` int NOT NULL auto_increment,
|
1188 |
`id_object` int default '0',
|
|
1189 |
`id_version` int NOT NULL default '1',
|
|
1
by brian
clean slate |
1190 |
`label` varchar(100) NOT NULL default '',
|
1191 |
`description` text,
|
|
1192 |
PRIMARY KEY (`id`),
|
|
1193 |
KEY `id_object` (`id_object`),
|
|
1194 |
KEY `id_version` (`id_version`)
|
|
1195 |
) ENGINE=MyISAM;
|
|
1196 |
INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
|
|
1197 |
CREATE TABLE t2 (
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1198 |
`id` int NOT NULL auto_increment,
|
1199 |
`id_version` int NOT NULL default '1',
|
|
1
by brian
clean slate |
1200 |
PRIMARY KEY (`id`),
|
1201 |
KEY `id_version` (`id_version`)
|
|
1202 |
) ENGINE=MyISAM;
|
|
1203 |
INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
|
|
1204 |
SELECT t2.id, t1.`label` FROM t2 INNER JOIN
|
|
1205 |
(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl
|
|
1206 |
ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
|
|
1207 |
id label
|
|
1208 |
3382 Test
|
|
1209 |
102 Le Pekin (Test)
|
|
1210 |
1794 Test de resto
|
|
1211 |
1822 Test 3
|
|
1212 |
3524 Societe Test
|
|
1213 |
3525 Fournisseur Test
|
|
1214 |
drop table t1,t2;
|
|
1215 |
create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=MyISAM;
|
|
1216 |
create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=MyISAM;
|
|
1217 |
create table t3 (a int, b varchar(200), c varchar(200) not null) checksum=1 engine=MEMORY;
|
|
1218 |
create table t4 (a int, b varchar(200), c varchar(200) not null) checksum=0 engine=MEMORY;
|
|
1219 |
create table t5 (a int, b varchar(200), c text not null) checksum=1 engine=MyISAM;
|
|
1220 |
create table t6 (a int, b varchar(200), c text not null) checksum=0 engine=MyISAM;
|
|
1221 |
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
|
|
1222 |
insert t2 select * from t1;
|
|
1223 |
insert t3 select * from t1;
|
|
1224 |
insert t4 select * from t1;
|
|
1225 |
insert t5 select * from t1;
|
|
1226 |
insert t6 select * from t1;
|
|
1227 |
checksum table t1, t2, t3, t4, t5, t6, t7 quick;
|
|
1228 |
Table Checksum
|
|
1229 |
test.t1 2948697075
|
|
1230 |
test.t2 NULL
|
|
1231 |
test.t3 NULL
|
|
1232 |
test.t4 NULL
|
|
1233 |
test.t5 2948697075
|
|
1234 |
test.t6 NULL
|
|
1235 |
test.t7 NULL
|
|
1236 |
Warnings:
|
|
1237 |
Error 1146 Table 'test.t7' doesn't exist
|
|
1238 |
checksum table t1, t2, t3, t4, t5, t6, t7;
|
|
1239 |
Table Checksum
|
|
1240 |
test.t1 2948697075
|
|
1241 |
test.t2 2948697075
|
|
1242 |
test.t3 2948697075
|
|
1243 |
test.t4 2948697075
|
|
1244 |
test.t5 2948697075
|
|
1245 |
test.t6 2948697075
|
|
1246 |
test.t7 NULL
|
|
1247 |
Warnings:
|
|
1248 |
Error 1146 Table 'test.t7' doesn't exist
|
|
1249 |
checksum table t1, t2, t3, t4, t5, t6, t7 extended;
|
|
1250 |
Table Checksum
|
|
1251 |
test.t1 2948697075
|
|
1252 |
test.t2 2948697075
|
|
1253 |
test.t3 2948697075
|
|
1254 |
test.t4 2948697075
|
|
1255 |
test.t5 2948697075
|
|
1256 |
test.t6 2948697075
|
|
1257 |
test.t7 NULL
|
|
1258 |
Warnings:
|
|
1259 |
Error 1146 Table 'test.t7' doesn't exist
|
|
1260 |
drop table t1,t2,t3, t4, t5, t6;
|
|
1261 |
create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=MyISAM;
|
|
1262 |
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
|
|
1263 |
select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
|
|
1264 |
trim(name2)
|
|
1265 |
fff
|
|
1266 |
sss
|
|
1267 |
ttt
|
|
1268 |
first
|
|
1269 |
second
|
|
1270 |
third
|
|
1271 |
1
|
|
1272 |
2
|
|
1273 |
3
|
|
1274 |
drop table t1;
|
|
1275 |
create table t1 (a int) engine=MyISAM;
|
|
1276 |
create table t2 like t1;
|
|
1277 |
show create table t2;
|
|
1278 |
Table Create Table
|
|
1279 |
t2 CREATE TABLE `t2` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1280 |
`a` int DEFAULT NULL
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1281 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1282 |
drop table t1,t2;
|
1283 |
flush status;
|
|
1284 |
show status like "binlog_cache_use";
|
|
1285 |
Variable_name Value
|
|
1286 |
show status like "binlog_cache_disk_use";
|
|
1287 |
Variable_name Value
|
|
1288 |
create table t1 (a int) engine=MyISAM;
|
|
1289 |
show status like "binlog_cache_use";
|
|
1290 |
Variable_name Value
|
|
1291 |
show status like "binlog_cache_disk_use";
|
|
1292 |
Variable_name Value
|
|
1293 |
begin;
|
|
1294 |
delete from t1;
|
|
1295 |
commit;
|
|
1296 |
show status like "binlog_cache_use";
|
|
1297 |
Variable_name Value
|
|
1298 |
show status like "binlog_cache_disk_use";
|
|
1299 |
Variable_name Value
|
|
1300 |
drop table t1;
|
|
1301 |
create table t1 (c char(10), index (c,c)) engine=MyISAM;
|
|
1302 |
ERROR 42S21: Duplicate column name 'c'
|
|
1303 |
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=MyISAM;
|
|
1304 |
ERROR 42S21: Duplicate column name 'c1'
|
|
1305 |
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=MyISAM;
|
|
1306 |
ERROR 42S21: Duplicate column name 'c1'
|
|
1307 |
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=MyISAM;
|
|
1308 |
ERROR 42S21: Duplicate column name 'c1'
|
|
1309 |
create table t1 (c1 char(10), c2 char(10)) engine=MyISAM;
|
|
1310 |
alter table t1 add key (c1,c1);
|
|
1311 |
ERROR 42S21: Duplicate column name 'c1'
|
|
1312 |
alter table t1 add key (c2,c1,c1);
|
|
1313 |
ERROR 42S21: Duplicate column name 'c1'
|
|
1314 |
alter table t1 add key (c1,c2,c1);
|
|
1315 |
ERROR 42S21: Duplicate column name 'c1'
|
|
1316 |
alter table t1 add key (c1,c1,c2);
|
|
1317 |
ERROR 42S21: Duplicate column name 'c1'
|
|
1318 |
drop table t1;
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1319 |
create table t1(a int, b int) engine=MyISAM;
|
1
by brian
clean slate |
1320 |
insert into t1 values ('1111', '3333');
|
1321 |
select distinct concat(a, b) from t1;
|
|
1322 |
concat(a, b)
|
|
1323 |
11113333
|
|
1324 |
drop table t1;
|
|
1325 |
create temporary table t1 (a int) engine=MyISAM;
|
|
1326 |
insert into t1 values (4711);
|
|
1327 |
truncate t1;
|
|
1328 |
insert into t1 values (42);
|
|
1329 |
select * from t1;
|
|
1330 |
a
|
|
1331 |
42
|
|
1332 |
drop table t1;
|
|
1333 |
create table t1 (a int) engine=MyISAM;
|
|
1334 |
insert into t1 values (4711);
|
|
1335 |
truncate t1;
|
|
1336 |
insert into t1 values (42);
|
|
1337 |
select * from t1;
|
|
1338 |
a
|
|
1339 |
42
|
|
1340 |
drop table t1;
|
|
1341 |
create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=MyISAM;
|
|
1342 |
insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
|
|
1343 |
select * from t1 order by a,b,c,d;
|
|
1344 |
a b c d e
|
|
1345 |
1 1 a 1 1
|
|
1346 |
2 2 b 2 2
|
|
1347 |
3 3 ab 3 3
|
|
1348 |
explain select * from t1 order by a,b,c,d;
|
|
1349 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
1350 |
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
|
1351 |
drop table t1;
|
|
1352 |
create table t1 (a char(1), b char(1), key(a, b)) engine=MyISAM;
|
|
1353 |
insert into t1 values ('8', '6'), ('4', '7');
|
|
1354 |
select min(a) from t1;
|
|
1355 |
min(a)
|
|
1356 |
4
|
|
1357 |
select min(b) from t1 where a='8';
|
|
1358 |
min(b)
|
|
1359 |
6
|
|
1360 |
drop table t1;
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1361 |
create table t1 (x bigint not null primary key) engine=MyISAM;
|
1
by brian
clean slate |
1362 |
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1363 |
ERROR 22003: Out of range value for column 'x' at row 1
|
1
by brian
clean slate |
1364 |
select * from t1;
|
1365 |
x
|
|
1366 |
select count(*) from t1 where x>0;
|
|
1367 |
count(*)
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1368 |
0
|
1
by brian
clean slate |
1369 |
select count(*) from t1 where x=0;
|
1370 |
count(*)
|
|
1371 |
0
|
|
1372 |
select count(*) from t1 where x<0;
|
|
1373 |
count(*)
|
|
1374 |
0
|
|
1375 |
select count(*) from t1 where x < -16;
|
|
1376 |
count(*)
|
|
1377 |
0
|
|
1378 |
select count(*) from t1 where x = -16;
|
|
1379 |
count(*)
|
|
1380 |
0
|
|
1381 |
explain select count(*) from t1 where x > -16;
|
|
1382 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1383 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
1
by brian
clean slate |
1384 |
select count(*) from t1 where x > -16;
|
1385 |
count(*)
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1386 |
0
|
1
by brian
clean slate |
1387 |
select * from t1 where x > -16;
|
1388 |
x
|
|
1389 |
select count(*) from t1 where x = 18446744073709551601;
|
|
1390 |
count(*)
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1391 |
0
|
1
by brian
clean slate |
1392 |
drop table t1;
|
1393 |
set storage_engine=MyISAM;
|
|
1394 |
drop table if exists t1,t2,t3;
|
|
1395 |
--- Testing varchar ---
|
|
1396 |
--- Testing varchar ---
|
|
1397 |
create table t1 (v varchar(10), c char(10), t text);
|
|
1398 |
insert into t1 values('+ ', '+ ', '+ ');
|
|
1399 |
set @a=repeat(' ',20);
|
|
1400 |
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
|
|
1401 |
Warnings:
|
|
1402 |
Note 1265 Data truncated for column 'v' at row 1
|
|
1403 |
Note 1265 Data truncated for column 'c' at row 1
|
|
1404 |
select concat('*',v,'*',c,'*',t,'*') from t1;
|
|
1405 |
concat('*',v,'*',c,'*',t,'*')
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1406 |
*+ *+ *+ *
|
1407 |
*+ *+ *+ *
|
|
1
by brian
clean slate |
1408 |
show create table t1;
|
1409 |
Table Create Table
|
|
1410 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1411 |
`v` varchar(10) DEFAULT NULL,
|
1412 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1413 |
`t` text
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1414 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1415 |
create table t2 like t1;
|
1416 |
show create table t2;
|
|
1417 |
Table Create Table
|
|
1418 |
t2 CREATE TABLE `t2` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1419 |
`v` varchar(10) DEFAULT NULL,
|
1420 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1421 |
`t` text
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1422 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1423 |
create table t3 select * from t1;
|
1424 |
show create table t3;
|
|
1425 |
Table Create Table
|
|
1426 |
t3 CREATE TABLE `t3` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1427 |
`v` varchar(10) DEFAULT NULL,
|
1428 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1429 |
`t` text
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1430 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1431 |
alter table t1 modify c varchar(10);
|
1432 |
show create table t1;
|
|
1433 |
Table Create Table
|
|
1434 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1435 |
`v` varchar(10) DEFAULT NULL,
|
1436 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1437 |
`t` text
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1438 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1439 |
alter table t1 modify v char(10);
|
1440 |
show create table t1;
|
|
1441 |
Table Create Table
|
|
1442 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1443 |
`v` varchar(10) DEFAULT NULL,
|
1444 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1445 |
`t` text
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1446 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1447 |
alter table t1 modify t varchar(10);
|
1448 |
Warnings:
|
|
1449 |
Note 1265 Data truncated for column 't' at row 2
|
|
1450 |
show create table t1;
|
|
1451 |
Table Create Table
|
|
1452 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1453 |
`v` varchar(10) DEFAULT NULL,
|
1454 |
`c` varchar(10) DEFAULT NULL,
|
|
1455 |
`t` varchar(10) DEFAULT NULL
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1456 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1457 |
select concat('*',v,'*',c,'*',t,'*') from t1;
|
1458 |
concat('*',v,'*',c,'*',t,'*')
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1459 |
*+ *+ *+ *
|
1460 |
*+ *+ *+ *
|
|
1
by brian
clean slate |
1461 |
drop table t1,t2,t3;
|
1462 |
create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
|
|
1463 |
show create table t1;
|
|
1464 |
Table Create Table
|
|
1465 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1466 |
`v` varchar(10) DEFAULT NULL,
|
1467 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1468 |
`t` text,
|
1469 |
KEY `v` (`v`),
|
|
1470 |
KEY `c` (`c`),
|
|
1008.3.10
by Stewart Smith
fix test result now that I fixed SHOW CREATE TABLE |
1471 |
KEY `t` (`t`(10))
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1472 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1473 |
select count(*) from t1;
|
1474 |
count(*)
|
|
1475 |
270
|
|
1476 |
insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
|
|
1477 |
select count(*) from t1 where v='a';
|
|
1478 |
count(*)
|
|
1479 |
10
|
|
1480 |
select count(*) from t1 where c='a';
|
|
1481 |
count(*)
|
|
1482 |
10
|
|
1483 |
select count(*) from t1 where t='a';
|
|
1484 |
count(*)
|
|
1485 |
10
|
|
1486 |
select count(*) from t1 where v='a ';
|
|
1487 |
count(*)
|
|
1488 |
10
|
|
1489 |
select count(*) from t1 where c='a ';
|
|
1490 |
count(*)
|
|
1491 |
10
|
|
1492 |
select count(*) from t1 where t='a ';
|
|
1493 |
count(*)
|
|
1494 |
10
|
|
1495 |
select count(*) from t1 where v between 'a' and 'a ';
|
|
1496 |
count(*)
|
|
1497 |
10
|
|
1498 |
select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
|
|
1499 |
count(*)
|
|
1500 |
10
|
|
1501 |
select count(*) from t1 where v like 'a%';
|
|
1502 |
count(*)
|
|
1503 |
11
|
|
1504 |
select count(*) from t1 where c like 'a%';
|
|
1505 |
count(*)
|
|
1506 |
11
|
|
1507 |
select count(*) from t1 where t like 'a%';
|
|
1508 |
count(*)
|
|
1509 |
11
|
|
1510 |
select count(*) from t1 where v like 'a %';
|
|
1511 |
count(*)
|
|
1512 |
9
|
|
1513 |
explain select count(*) from t1 where v='a ';
|
|
1514 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1515 |
1 SIMPLE t1 ref v v 43 const # Using where; Using index
|
1
by brian
clean slate |
1516 |
explain select count(*) from t1 where c='a ';
|
1517 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1518 |
1 SIMPLE t1 ref c c 43 const # Using where; Using index
|
1
by brian
clean slate |
1519 |
explain select count(*) from t1 where t='a ';
|
1520 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1521 |
1 SIMPLE t1 ref t t 43 const # Using where
|
1
by brian
clean slate |
1522 |
explain select count(*) from t1 where v like 'a%';
|
1523 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1524 |
1 SIMPLE t1 range v v 43 NULL # Using where; Using index
|
1
by brian
clean slate |
1525 |
explain select count(*) from t1 where v between 'a' and 'a ';
|
1526 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1527 |
1 SIMPLE t1 ref v v 43 const # Using where; Using index
|
1
by brian
clean slate |
1528 |
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
|
1529 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1530 |
1 SIMPLE t1 ref v v 43 const # Using where; Using index
|
1
by brian
clean slate |
1531 |
alter table t1 add unique(v);
|
1532 |
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
|
|
1533 |
alter table t1 add key(v);
|
|
1534 |
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
|
|
1535 |
qq
|
|
1536 |
*a*a*a*
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1537 |
*a *a *a *
|
1538 |
*a *a *a *
|
|
1539 |
*a *a *a *
|
|
1540 |
*a *a *a *
|
|
1541 |
*a *a *a *
|
|
1542 |
*a *a *a *
|
|
1543 |
*a *a *a *
|
|
1544 |
*a *a *a *
|
|
1545 |
*a *a *a *
|
|
1
by brian
clean slate |
1546 |
explain select * from t1 where v='a';
|
1547 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1548 |
1 SIMPLE t1 ref v,v_2 # 43 const # Using where
|
1
by brian
clean slate |
1549 |
select v,count(*) from t1 group by v limit 10;
|
1550 |
v count(*)
|
|
1551 |
a 1
|
|
1552 |
a 10
|
|
1553 |
b 10
|
|
1554 |
c 10
|
|
1555 |
d 10
|
|
1556 |
e 10
|
|
1557 |
f 10
|
|
1558 |
g 10
|
|
1559 |
h 10
|
|
1560 |
i 10
|
|
1561 |
select v,count(t) from t1 group by v limit 10;
|
|
1562 |
v count(t)
|
|
1563 |
a 1
|
|
1564 |
a 10
|
|
1565 |
b 10
|
|
1566 |
c 10
|
|
1567 |
d 10
|
|
1568 |
e 10
|
|
1569 |
f 10
|
|
1570 |
g 10
|
|
1571 |
h 10
|
|
1572 |
i 10
|
|
1573 |
select v,count(c) from t1 group by v limit 10;
|
|
1574 |
v count(c)
|
|
1575 |
a 1
|
|
1576 |
a 10
|
|
1577 |
b 10
|
|
1578 |
c 10
|
|
1579 |
d 10
|
|
1580 |
e 10
|
|
1581 |
f 10
|
|
1582 |
g 10
|
|
1583 |
h 10
|
|
1584 |
i 10
|
|
1585 |
select sql_big_result v,count(t) from t1 group by v limit 10;
|
|
1586 |
v count(t)
|
|
1587 |
a 1
|
|
1588 |
a 10
|
|
1589 |
b 10
|
|
1590 |
c 10
|
|
1591 |
d 10
|
|
1592 |
e 10
|
|
1593 |
f 10
|
|
1594 |
g 10
|
|
1595 |
h 10
|
|
1596 |
i 10
|
|
1597 |
select sql_big_result v,count(c) from t1 group by v limit 10;
|
|
1598 |
v count(c)
|
|
1599 |
a 1
|
|
1600 |
a 10
|
|
1601 |
b 10
|
|
1602 |
c 10
|
|
1603 |
d 10
|
|
1604 |
e 10
|
|
1605 |
f 10
|
|
1606 |
g 10
|
|
1607 |
h 10
|
|
1608 |
i 10
|
|
1609 |
select c,count(*) from t1 group by c limit 10;
|
|
1610 |
c count(*)
|
|
1611 |
a 1
|
|
1612 |
a 10
|
|
1613 |
b 10
|
|
1614 |
c 10
|
|
1615 |
d 10
|
|
1616 |
e 10
|
|
1617 |
f 10
|
|
1618 |
g 10
|
|
1619 |
h 10
|
|
1620 |
i 10
|
|
1621 |
select c,count(t) from t1 group by c limit 10;
|
|
1622 |
c count(t)
|
|
1623 |
a 1
|
|
1624 |
a 10
|
|
1625 |
b 10
|
|
1626 |
c 10
|
|
1627 |
d 10
|
|
1628 |
e 10
|
|
1629 |
f 10
|
|
1630 |
g 10
|
|
1631 |
h 10
|
|
1632 |
i 10
|
|
1633 |
select sql_big_result c,count(t) from t1 group by c limit 10;
|
|
1634 |
c count(t)
|
|
1635 |
a 1
|
|
1636 |
a 10
|
|
1637 |
b 10
|
|
1638 |
c 10
|
|
1639 |
d 10
|
|
1640 |
e 10
|
|
1641 |
f 10
|
|
1642 |
g 10
|
|
1643 |
h 10
|
|
1644 |
i 10
|
|
1645 |
select t,count(*) from t1 group by t limit 10;
|
|
1646 |
t count(*)
|
|
1647 |
a 1
|
|
1648 |
a 10
|
|
1649 |
b 10
|
|
1650 |
c 10
|
|
1651 |
d 10
|
|
1652 |
e 10
|
|
1653 |
f 10
|
|
1654 |
g 10
|
|
1655 |
h 10
|
|
1656 |
i 10
|
|
1657 |
select t,count(t) from t1 group by t limit 10;
|
|
1658 |
t count(t)
|
|
1659 |
a 1
|
|
1660 |
a 10
|
|
1661 |
b 10
|
|
1662 |
c 10
|
|
1663 |
d 10
|
|
1664 |
e 10
|
|
1665 |
f 10
|
|
1666 |
g 10
|
|
1667 |
h 10
|
|
1668 |
i 10
|
|
1669 |
select sql_big_result t,count(t) from t1 group by t limit 10;
|
|
1670 |
t count(t)
|
|
1671 |
a 1
|
|
1672 |
a 10
|
|
1673 |
b 10
|
|
1674 |
c 10
|
|
1675 |
d 10
|
|
1676 |
e 10
|
|
1677 |
f 10
|
|
1678 |
g 10
|
|
1679 |
h 10
|
|
1680 |
i 10
|
|
1681 |
alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
|
|
1682 |
show create table t1;
|
|
1683 |
Table Create Table
|
|
1684 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1685 |
`v` varchar(300) DEFAULT NULL,
|
1686 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1687 |
`t` text,
|
1688 |
KEY `c` (`c`),
|
|
1008.3.10
by Stewart Smith
fix test result now that I fixed SHOW CREATE TABLE |
1689 |
KEY `t` (`t`(10)),
|
1
by brian
clean slate |
1690 |
KEY `v` (`v`)
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1691 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1692 |
select count(*) from t1 where v='a';
|
1693 |
count(*)
|
|
1694 |
10
|
|
1695 |
select count(*) from t1 where v='a ';
|
|
1696 |
count(*)
|
|
1697 |
10
|
|
1698 |
select count(*) from t1 where v between 'a' and 'a ';
|
|
1699 |
count(*)
|
|
1700 |
10
|
|
1701 |
select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
|
|
1702 |
count(*)
|
|
1703 |
10
|
|
1704 |
select count(*) from t1 where v like 'a%';
|
|
1705 |
count(*)
|
|
1706 |
11
|
|
1707 |
select count(*) from t1 where v like 'a %';
|
|
1708 |
count(*)
|
|
1709 |
9
|
|
1710 |
explain select count(*) from t1 where v='a ';
|
|
1711 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1712 |
1 SIMPLE t1 ref v v 1203 const # Using where; Using index
|
1
by brian
clean slate |
1713 |
explain select count(*) from t1 where v like 'a%';
|
1714 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1715 |
1 SIMPLE t1 range v v 1203 NULL # Using where; Using index
|
1
by brian
clean slate |
1716 |
explain select count(*) from t1 where v between 'a' and 'a ';
|
1717 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1718 |
1 SIMPLE t1 ref v v 1203 const # Using where; Using index
|
1
by brian
clean slate |
1719 |
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
|
1720 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1721 |
1 SIMPLE t1 ref v v 1203 const # Using where; Using index
|
1
by brian
clean slate |
1722 |
explain select * from t1 where v='a';
|
1723 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1724 |
1 SIMPLE t1 ref v v 1203 const # Using where
|
1
by brian
clean slate |
1725 |
select v,count(*) from t1 group by v limit 10;
|
1726 |
v count(*)
|
|
1727 |
a 1
|
|
1728 |
a 10
|
|
1729 |
b 10
|
|
1730 |
c 10
|
|
1731 |
d 10
|
|
1732 |
e 10
|
|
1733 |
f 10
|
|
1734 |
g 10
|
|
1735 |
h 10
|
|
1736 |
i 10
|
|
1737 |
select v,count(t) from t1 group by v limit 10;
|
|
1738 |
v count(t)
|
|
1739 |
a 1
|
|
1740 |
a 10
|
|
1741 |
b 10
|
|
1742 |
c 10
|
|
1743 |
d 10
|
|
1744 |
e 10
|
|
1745 |
f 10
|
|
1746 |
g 10
|
|
1747 |
h 10
|
|
1748 |
i 10
|
|
1749 |
select sql_big_result v,count(t) from t1 group by v limit 10;
|
|
1750 |
v count(t)
|
|
1751 |
a 1
|
|
1752 |
a 10
|
|
1753 |
b 10
|
|
1754 |
c 10
|
|
1755 |
d 10
|
|
1756 |
e 10
|
|
1757 |
f 10
|
|
1758 |
g 10
|
|
1759 |
h 10
|
|
1760 |
i 10
|
|
1761 |
alter table t1 drop key v, add key v (v(30));
|
|
1762 |
show create table t1;
|
|
1763 |
Table Create Table
|
|
1764 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1765 |
`v` varchar(300) DEFAULT NULL,
|
1766 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1767 |
`t` text,
|
1768 |
KEY `c` (`c`),
|
|
1008.3.10
by Stewart Smith
fix test result now that I fixed SHOW CREATE TABLE |
1769 |
KEY `t` (`t`(10)),
|
1770 |
KEY `v` (`v`(30))
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1771 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1772 |
select count(*) from t1 where v='a';
|
1773 |
count(*)
|
|
1774 |
10
|
|
1775 |
select count(*) from t1 where v='a ';
|
|
1776 |
count(*)
|
|
1777 |
10
|
|
1778 |
select count(*) from t1 where v between 'a' and 'a ';
|
|
1779 |
count(*)
|
|
1780 |
10
|
|
1781 |
select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
|
|
1782 |
count(*)
|
|
1783 |
10
|
|
1784 |
select count(*) from t1 where v like 'a%';
|
|
1785 |
count(*)
|
|
1786 |
11
|
|
1787 |
select count(*) from t1 where v like 'a %';
|
|
1788 |
count(*)
|
|
1789 |
9
|
|
1790 |
explain select count(*) from t1 where v='a ';
|
|
1791 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1792 |
1 SIMPLE t1 ref v v 123 const # Using where
|
1
by brian
clean slate |
1793 |
explain select count(*) from t1 where v like 'a%';
|
1794 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1795 |
1 SIMPLE t1 range v v 123 NULL # Using where
|
1
by brian
clean slate |
1796 |
explain select count(*) from t1 where v between 'a' and 'a ';
|
1797 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1798 |
1 SIMPLE t1 ref v v 123 const # Using where
|
1
by brian
clean slate |
1799 |
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
|
1800 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1801 |
1 SIMPLE t1 ref v v 123 const # Using where
|
1
by brian
clean slate |
1802 |
explain select * from t1 where v='a';
|
1803 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1804 |
1 SIMPLE t1 ref v v 123 const # Using where
|
1
by brian
clean slate |
1805 |
select v,count(*) from t1 group by v limit 10;
|
1806 |
v count(*)
|
|
1807 |
a 1
|
|
1808 |
a 10
|
|
1809 |
b 10
|
|
1810 |
c 10
|
|
1811 |
d 10
|
|
1812 |
e 10
|
|
1813 |
f 10
|
|
1814 |
g 10
|
|
1815 |
h 10
|
|
1816 |
i 10
|
|
1817 |
select v,count(t) from t1 group by v limit 10;
|
|
1818 |
v count(t)
|
|
1819 |
a 1
|
|
1820 |
a 10
|
|
1821 |
b 10
|
|
1822 |
c 10
|
|
1823 |
d 10
|
|
1824 |
e 10
|
|
1825 |
f 10
|
|
1826 |
g 10
|
|
1827 |
h 10
|
|
1828 |
i 10
|
|
1829 |
select sql_big_result v,count(t) from t1 group by v limit 10;
|
|
1830 |
v count(t)
|
|
1831 |
a 1
|
|
1832 |
a 10
|
|
1833 |
b 10
|
|
1834 |
c 10
|
|
1835 |
d 10
|
|
1836 |
e 10
|
|
1837 |
f 10
|
|
1838 |
g 10
|
|
1839 |
h 10
|
|
1840 |
i 10
|
|
1841 |
alter table t1 modify v varchar(600), drop key v, add key v (v);
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1842 |
Warnings:
|
1843 |
Warning 1071 Specified key was too long; max key length is 1332 bytes
|
|
1
by brian
clean slate |
1844 |
show create table t1;
|
1845 |
Table Create Table
|
|
1846 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1847 |
`v` varchar(600) DEFAULT NULL,
|
1848 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1849 |
`t` text,
|
1850 |
KEY `c` (`c`),
|
|
1008.3.10
by Stewart Smith
fix test result now that I fixed SHOW CREATE TABLE |
1851 |
KEY `t` (`t`(10)),
|
1852 |
KEY `v` (`v`(333))
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1853 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1854 |
select v,count(*) from t1 group by v limit 10;
|
1855 |
v count(*)
|
|
1856 |
a 1
|
|
1857 |
a 10
|
|
1858 |
b 10
|
|
1859 |
c 10
|
|
1860 |
d 10
|
|
1861 |
e 10
|
|
1862 |
f 10
|
|
1863 |
g 10
|
|
1864 |
h 10
|
|
1865 |
i 10
|
|
1866 |
select v,count(t) from t1 group by v limit 10;
|
|
1867 |
v count(t)
|
|
1868 |
a 1
|
|
1869 |
a 10
|
|
1870 |
b 10
|
|
1871 |
c 10
|
|
1872 |
d 10
|
|
1873 |
e 10
|
|
1874 |
f 10
|
|
1875 |
g 10
|
|
1876 |
h 10
|
|
1877 |
i 10
|
|
1878 |
select sql_big_result v,count(t) from t1 group by v limit 10;
|
|
1879 |
v count(t)
|
|
1880 |
a 1
|
|
1881 |
a 10
|
|
1882 |
b 10
|
|
1883 |
c 10
|
|
1884 |
d 10
|
|
1885 |
e 10
|
|
1886 |
f 10
|
|
1887 |
g 10
|
|
1888 |
h 10
|
|
1889 |
i 10
|
|
1890 |
drop table t1;
|
|
1891 |
create table t1 (a char(10), unique (a));
|
|
1892 |
insert into t1 values ('a ');
|
|
1893 |
insert into t1 values ('a ');
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1894 |
ERROR 23000: Duplicate entry 'a ' for key 'a'
|
1
by brian
clean slate |
1895 |
alter table t1 modify a varchar(10);
|
1896 |
insert into t1 values ('a '),('a '),('a '),('a ');
|
|
1897 |
ERROR 23000: Duplicate entry 'a ' for key 'a'
|
|
1898 |
insert into t1 values ('a ');
|
|
1899 |
ERROR 23000: Duplicate entry 'a ' for key 'a'
|
|
1900 |
insert into t1 values ('a ');
|
|
1901 |
ERROR 23000: Duplicate entry 'a ' for key 'a'
|
|
1902 |
insert into t1 values ('a ');
|
|
1903 |
ERROR 23000: Duplicate entry 'a ' for key 'a'
|
|
1904 |
update t1 set a='a ' where a like 'a%';
|
|
1905 |
select concat(a,'.') from t1;
|
|
1906 |
concat(a,'.')
|
|
1907 |
a .
|
|
1908 |
update t1 set a='abc ' where a like 'a ';
|
|
1909 |
select concat(a,'.') from t1;
|
|
1910 |
concat(a,'.')
|
|
1911 |
a .
|
|
1912 |
update t1 set a='a ' where a like 'a %';
|
|
1913 |
select concat(a,'.') from t1;
|
|
1914 |
concat(a,'.')
|
|
1915 |
a .
|
|
1916 |
update t1 set a='a ' where a like 'a ';
|
|
1917 |
select concat(a,'.') from t1;
|
|
1918 |
concat(a,'.')
|
|
1919 |
a .
|
|
1920 |
drop table t1;
|
|
1921 |
create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5)));
|
|
1922 |
show create table t1;
|
|
1923 |
Table Create Table
|
|
1924 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1925 |
`v` varchar(10) DEFAULT NULL,
|
1926 |
`c` varchar(10) DEFAULT NULL,
|
|
1
by brian
clean slate |
1927 |
`t` text,
|
1008.3.10
by Stewart Smith
fix test result now that I fixed SHOW CREATE TABLE |
1928 |
KEY `v` (`v`(5)),
|
1929 |
KEY `c` (`c`(5)),
|
|
1930 |
KEY `t` (`t`(5))
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1931 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1932 |
drop table t1;
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1933 |
create table t1 (v char(10));
|
1
by brian
clean slate |
1934 |
show create table t1;
|
1935 |
Table Create Table
|
|
1936 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1937 |
`v` varchar(10) DEFAULT NULL
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1938 |
) ENGINE=MyISAM
|
1
by brian
clean slate |
1939 |
drop table t1;
|
1940 |
create table t1 (v varchar(10), c char(10)) row_format=fixed;
|
|
1941 |
show create table t1;
|
|
1942 |
Table Create Table
|
|
1943 |
t1 CREATE TABLE `t1` (
|
|
873.2.35
by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements. |
1944 |
`v` varchar(10) DEFAULT NULL,
|
1945 |
`c` varchar(10) DEFAULT NULL
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1946 |
) ENGINE=MyISAM ROW_FORMAT=FIXED
|
1
by brian
clean slate |
1947 |
insert into t1 values('a','a'),('a ','a ');
|
1948 |
select concat('*',v,'*',c,'*') from t1;
|
|
1949 |
concat('*',v,'*',c,'*')
|
|
1950 |
*a*a*
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1951 |
*a *a *
|
1
by brian
clean slate |
1952 |
drop table t1;
|
1953 |
create table t1(a int, b varchar(12), key ba(b, a));
|
|
1954 |
insert into t1 values (1, 'A'), (20, NULL);
|
|
1955 |
explain select * from t1 where a=20 and b is null;
|
|
1956 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1957 |
1 SIMPLE t1 ref ba ba 56 const,const 1 Using where; Using index
|
1
by brian
clean slate |
1958 |
select * from t1 where a=20 and b is null;
|
1959 |
a b
|
|
1960 |
20 NULL
|
|
1961 |
drop table t1;
|
|
1962 |
create table t1 (a char(1), b char(1), key(a, b)) engine=MyISAM;
|
|
1963 |
insert into t1 values ('8', '6'), ('4', '7');
|
|
1964 |
select min(a) from t1;
|
|
1965 |
min(a)
|
|
1966 |
4
|
|
1967 |
select min(b) from t1 where a='8';
|
|
1968 |
min(b)
|
|
1969 |
6
|
|
1970 |
drop table t1;
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1971 |
CREATE TABLE t1 ( `a` int NOT NULL auto_increment, `b` int default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=MyISAM;
|
1
by brian
clean slate |
1972 |
insert into t1 (b) values (1);
|
1973 |
replace into t1 (b) values (2), (1), (3);
|
|
1974 |
select * from t1;
|
|
1975 |
a b
|
|
1976 |
3 1
|
|
1977 |
2 2
|
|
1978 |
4 3
|
|
1979 |
truncate table t1;
|
|
1980 |
insert into t1 (b) values (1);
|
|
1981 |
replace into t1 (b) values (2);
|
|
1982 |
replace into t1 (b) values (1);
|
|
1983 |
replace into t1 (b) values (3);
|
|
1984 |
select * from t1;
|
|
1985 |
a b
|
|
685.4.4
by Jay Pipes
Re-enabled and fixed the mix2_myisam test. |
1986 |
7 1
|
1987 |
6 2
|
|
1988 |
8 3
|
|
1
by brian
clean slate |
1989 |
drop table t1;
|
1990 |
create table t1 (rowid int not null auto_increment, val int not null,primary
|
|
1991 |
key (rowid), unique(val)) engine=MyISAM;
|
|
1992 |
replace into t1 (val) values ('1'),('2');
|
|
1993 |
replace into t1 (val) values ('1'),('2');
|
|
1994 |
insert into t1 (val) values ('1'),('2');
|
|
1995 |
ERROR 23000: Duplicate entry '1' for key 'val'
|
|
1996 |
select * from t1;
|
|
1997 |
rowid val
|
|
1998 |
3 1
|
|
1999 |
4 2
|
|
2000 |
drop table t1;
|
|
2001 |
CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=MyISAM;
|
|
2002 |
INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
|
|
2003 |
SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300;
|
|
2004 |
GRADE
|
|
2005 |
252
|
|
2006 |
SELECT GRADE FROM t1 WHERE GRADE= 151;
|
|
2007 |
GRADE
|
|
2008 |
151
|
|
2009 |
DROP TABLE t1;
|
|
2010 |
create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=MyISAM;
|
|
2011 |
create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=MyISAM;
|
|
2012 |
insert into t2 values ('aa','cc');
|
|
2013 |
insert into t1 values ('aa','bb'),('aa','cc');
|
|
2014 |
delete t1 from t1,t2 where f1=f3 and f4='cc';
|
|
2015 |
select * from t1;
|
|
2016 |
f1 f2
|
|
2017 |
drop table t1,t2;
|
|
2018 |
create table t1(a date) engine=MyISAM;
|
|
2019 |
create table t2(a date, key(a)) engine=MyISAM;
|
|
2020 |
insert into t1 values('2005-10-01');
|
|
2021 |
insert into t2 values('2005-10-01');
|
|
2022 |
select * from t1, t2
|
|
2023 |
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
|
|
2024 |
a a
|
|
2025 |
2005-10-01 2005-10-01
|
|
2026 |
drop table t1, t2;
|
|
2027 |
create table t1 (id int not null, f_id int not null, f int not null,
|
|
2028 |
primary key(f_id, id)) engine=MyISAM;
|
|
2029 |
create table t2 (id int not null,s_id int not null,s varchar(200),
|
|
2030 |
primary key(id)) engine=MyISAM;
|
|
2031 |
INSERT INTO t1 VALUES (8, 1, 3);
|
|
2032 |
INSERT INTO t1 VALUES (1, 2, 1);
|
|
2033 |
INSERT INTO t2 VALUES (1, 0, '');
|
|
2034 |
INSERT INTO t2 VALUES (8, 1, '');
|
|
2035 |
commit;
|
|
2036 |
DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
|
|
2037 |
WHERE mm.id IS NULL;
|
|
2038 |
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
|
|
2039 |
where mm.id is null lock in share mode;
|
|
2040 |
id f_id f
|
|
2041 |
drop table t1,t2;
|
|
2042 |
create table t1(a int not null, b int, primary key(a)) engine=MyISAM;
|
|
2043 |
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
|
|
2044 |
commit;
|
|
2045 |
set autocommit = 0;
|
|
2046 |
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
2047 |
update t1 set b = 5 where b = 1;
|
|
2048 |
set autocommit = 0;
|
|
2049 |
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
2050 |
select * from t1 where a = 7 and b = 3 for update;
|
|
2051 |
a b
|
|
2052 |
7 3
|
|
2053 |
commit;
|
|
2054 |
commit;
|
|
2055 |
drop table t1;
|
|
2056 |
CREATE TABLE t1 ( a int ) ENGINE=MyISAM;
|
|
2057 |
BEGIN;
|
|
2058 |
INSERT INTO t1 VALUES (1);
|
|
2059 |
OPTIMIZE TABLE t1;
|
|
2060 |
Table Op Msg_type Msg_text
|
|
2061 |
test.t1 optimize status OK
|
|
2062 |
DROP TABLE t1;
|