10
grp int(11) default NULL,
11
a bigint(20) unsigned default NULL,
11
a bigint unsigned default NULL,
12
12
c char(10) NOT NULL default ''
14
14
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
118
118
CREATE TABLE t1 (
119
cod_asig int(11) DEFAULT '0' NOT NULL,
119
cod_asig int DEFAULT '0' NOT NULL,
120
120
desc_larga_cat varchar(80) DEFAULT '' NOT NULL,
121
121
desc_larga_cas varchar(80) DEFAULT '' NOT NULL,
122
122
desc_corta_cat varchar(40) DEFAULT '' NOT NULL,
123
123
desc_corta_cas varchar(40) DEFAULT '' NOT NULL,
124
124
cred_total double(3,1) DEFAULT '0.0' NOT NULL,
125
pre_requisit int(11),
127
preco_requisit int(11),
128
128
PRIMARY KEY (cod_asig)
138
138
INSERT INTO t1 VALUES (11406,'Calcul Infinitesimal','Cßlculo Infinitesimal','Calcul Infinitesimal','Calcul Infinitesimal',15.0,NULL,NULL,NULL);
140
140
CREATE TABLE t2 (
141
idAssignatura int(11) DEFAULT '0' NOT NULL,
142
Grup int(11) DEFAULT '0' NOT NULL,
143
Places smallint(6) DEFAULT '0' NOT NULL,
144
PlacesOcupades int(11) DEFAULT '0',
141
idAssignatura int DEFAULT '0' NOT NULL,
142
Grup int DEFAULT '0' NOT NULL,
143
Places smallint DEFAULT '0' NOT NULL,
144
PlacesOcupades int DEFAULT '0',
145
145
PRIMARY KEY (idAssignatura,Grup)
173
173
INSERT INTO t2 VALUES (11409,0,0,0);
175
175
CREATE TABLE t3 (
176
id int(11) NOT NULL auto_increment,
176
id int NOT NULL auto_increment,
177
177
dni_pasaporte char(16) DEFAULT '' NOT NULL,
178
idPla int(11) DEFAULT '0' NOT NULL,
179
cod_asig int(11) DEFAULT '0' NOT NULL,
180
any smallint(6) DEFAULT '0' NOT NULL,
181
quatrimestre smallint(6) DEFAULT '0' NOT NULL,
178
idPla int DEFAULT '0' NOT NULL,
179
cod_asig int DEFAULT '0' NOT NULL,
180
any smallint DEFAULT '0' NOT NULL,
181
quatrimestre smallint DEFAULT '0' NOT NULL,
182
182
estat char(1) DEFAULT 'M' NOT NULL,
183
183
PRIMARY KEY (id),
184
184
UNIQUE dni_pasaporte (dni_pasaporte,idPla),
188
188
INSERT INTO t3 VALUES (1,'11111111',1,10362,98,1,'M');
190
190
CREATE TABLE t4 (
191
id int(11) NOT NULL auto_increment,
192
papa int(11) DEFAULT '0' NOT NULL,
193
fill int(11) DEFAULT '0' NOT NULL,
194
idPla int(11) DEFAULT '0' NOT NULL,
191
id int NOT NULL auto_increment,
192
papa int DEFAULT '0' NOT NULL,
193
fill int DEFAULT '0' NOT NULL,
194
idPla int DEFAULT '0' NOT NULL,
195
195
PRIMARY KEY (id),
196
196
KEY papa (idPla,papa),
197
197
UNIQUE papa_2 (idPla,papa,fill)
224
224
INSERT INTO t1 VALUES (3,'Thimble Smith');
226
226
CREATE TABLE t2 (
227
id smallint(5) unsigned NOT NULL auto_increment,
228
owner smallint(5) unsigned DEFAULT '0' NOT NULL,
227
id smallint unsigned NOT NULL auto_increment,
228
owner smallint unsigned DEFAULT '0' NOT NULL,
264
264
CREATE TABLE t1 (
265
t1_id bigint(21) NOT NULL auto_increment,
265
t1_id bigint NOT NULL auto_increment,
266
266
PRIMARY KEY (t1_id)
268
268
CREATE TABLE t2 (
269
t2_id bigint(21) NOT NULL auto_increment,
269
t2_id bigint NOT NULL auto_increment,
270
270
PRIMARY KEY (t2_id)
272
272
CREATE TABLE t3 (
273
t3_id bigint(21) NOT NULL auto_increment,
273
t3_id bigint NOT NULL auto_increment,
274
274
PRIMARY KEY (t3_id)
276
276
CREATE TABLE t4 (
277
seq_0_id bigint(21) DEFAULT '0' NOT NULL,
278
seq_1_id bigint(21) DEFAULT '0' NOT NULL,
277
seq_0_id bigint DEFAULT '0' NOT NULL,
278
seq_1_id bigint DEFAULT '0' NOT NULL,
279
279
KEY seq_0_id (seq_0_id),
280
280
KEY seq_1_id (seq_1_id)
282
282
CREATE TABLE t5 (
283
seq_0_id bigint(21) DEFAULT '0' NOT NULL,
284
seq_1_id bigint(21) DEFAULT '0' NOT NULL,
283
seq_0_id bigint DEFAULT '0' NOT NULL,
284
seq_1_id bigint DEFAULT '0' NOT NULL,
285
285
KEY seq_1_id (seq_1_id),
286
286
KEY seq_0_id (seq_0_id)
388
388
CREATE TABLE t1 (
389
id int(11) DEFAULT '0' NOT NULL,
389
id int DEFAULT '0' NOT NULL,
390
390
name tinytext DEFAULT '' NOT NULL,
393
393
INSERT INTO t1 VALUES (1,'yes'),(2,'no');
394
394
CREATE TABLE t2 (
395
id int(11) DEFAULT '0' NOT NULL,
396
idx int(11) DEFAULT '0' NOT NULL,
395
id int DEFAULT '0' NOT NULL,
396
idx int DEFAULT '0' NOT NULL,
397
397
UNIQUE id (id,idx)
399
399
INSERT INTO t2 VALUES (1,1);
476
476
# Test for BUG#5088
478
478
create table t1 (
479
match_id tinyint(3) unsigned not null auto_increment,
480
home tinyint(3) unsigned default '0',
479
match_id tinyint unsigned not null auto_increment,
480
home tinyint unsigned default '0',
481
481
unique key match_id (match_id),
482
482
key match_id_2 (match_id)
485
485
insert into t1 values("1", "2");
487
487
create table t2 (
488
player_id tinyint(3) unsigned default '0',
489
match_1_h tinyint(3) unsigned default '0',
488
player_id tinyint unsigned default '0',
489
match_1_h tinyint unsigned default '0',
490
490
key player_id (player_id)
538
538
drop table t1, t2;
540
540
CREATE TABLE t1 (
541
ts_id bigint(20) default NULL,
542
inst_id tinyint(4) default NULL,
541
ts_id bigint default NULL,
542
inst_id tinyint default NULL,
543
543
flag_name varchar(64) default NULL,
545
545
UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
546
546
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
548
548
CREATE TABLE t2 (
549
ts_id bigint(20) default NULL,
550
inst_id tinyint(4) default NULL,
549
ts_id bigint default NULL,
550
inst_id tinyint default NULL,
551
551
flag_name varchar(64) default NULL,
553
553
UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
670
670
# BUG#10162 - ON is merged with WHERE, left join is convered to a regular join
672
create table t1 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, art int(11) not null, primary key (gid,x,y));
672
create table t1 (gid smallint unsigned not null, x int not null, y int not null, art int not null, primary key (gid,x,y));
673
673
insert t1 values (1, -5, -8, 2), (1, 2, 2, 1), (1, 1, 1, 1);
674
create table t2 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, id int(11) not null, primary key (gid,id,x,y), key id (id));
674
create table t2 (gid smallint unsigned not null, x int not null, y int not null, id int not null, primary key (gid,id,x,y), key id (id));
675
675
insert t2 values (1, -5, -8, 1), (1, 1, 1, 1), (1, 2, 2, 1);
676
create table t3 ( set_id smallint(5) unsigned not null, id tinyint(4) unsigned not null, name char(12) not null, primary key (id,set_id));
676
create table t3 ( set_id smallint unsigned not null, id tinyint unsigned not null, name char(12) not null, primary key (id,set_id));
677
677
insert t3 values (0, 1, 'a'), (1, 1, 'b'), (0, 2, 'c'), (1, 2, 'd'), (1, 3, 'e'), (1, 4, 'f'), (1, 5, 'g'), (1, 6, 'h');
678
678
explain select name from t1 left join t2 on t1.x = t2.x and t1.y = t2.y
679
679
left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8