1
1
drop table if exists t0,t1,t2,t3,t4,t5;
3
grp int(11) default NULL,
4
a bigint(20) unsigned default NULL,
4
a bigint unsigned default NULL,
5
5
c char(10) NOT NULL default ''
7
7
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
182
182
3 4 84676 NULL NULL NULL
183
183
drop table t1,t2;
184
184
CREATE TABLE t1 (
185
cod_asig int(11) DEFAULT '0' NOT NULL,
185
cod_asig int DEFAULT '0' NOT NULL,
186
186
desc_larga_cat varchar(80) DEFAULT '' NOT NULL,
187
187
desc_larga_cas varchar(80) DEFAULT '' NOT NULL,
188
188
desc_corta_cat varchar(40) DEFAULT '' NOT NULL,
189
189
desc_corta_cas varchar(40) DEFAULT '' NOT NULL,
190
190
cred_total double(3,1) DEFAULT '0.0' NOT NULL,
191
pre_requisit int(11),
193
preco_requisit int(11),
194
194
PRIMARY KEY (cod_asig)
196
196
INSERT INTO t1 VALUES (10360,'asdfggfg','Introduccion a los Ordenadores I','asdfggfg','Introduccio Ordinadors I',6.0,NULL,NULL,NULL);
202
202
INSERT INTO t1 VALUES (11405,'+lgebra lineal','Algebra lineal','+lgebra lineal','+lgebra lineal',18.0,NULL,NULL,NULL);
203
203
INSERT INTO t1 VALUES (11406,'Calcul Infinitesimal','Cßlculo Infinitesimal','Calcul Infinitesimal','Calcul Infinitesimal',15.0,NULL,NULL,NULL);
204
204
CREATE TABLE t2 (
205
idAssignatura int(11) DEFAULT '0' NOT NULL,
206
Grup int(11) DEFAULT '0' NOT NULL,
207
Places smallint(6) DEFAULT '0' NOT NULL,
208
PlacesOcupades int(11) DEFAULT '0',
205
idAssignatura int DEFAULT '0' NOT NULL,
206
Grup int DEFAULT '0' NOT NULL,
207
Places smallint DEFAULT '0' NOT NULL,
208
PlacesOcupades int DEFAULT '0',
209
209
PRIMARY KEY (idAssignatura,Grup)
211
211
INSERT INTO t2 VALUES (10360,12,333,0);
234
234
INSERT INTO t2 VALUES (11416,11416,32767,0);
235
235
INSERT INTO t2 VALUES (11409,0,0,0);
236
236
CREATE TABLE t3 (
237
id int(11) NOT NULL auto_increment,
237
id int NOT NULL auto_increment,
238
238
dni_pasaporte char(16) DEFAULT '' NOT NULL,
239
idPla int(11) DEFAULT '0' NOT NULL,
240
cod_asig int(11) DEFAULT '0' NOT NULL,
241
any smallint(6) DEFAULT '0' NOT NULL,
242
quatrimestre smallint(6) DEFAULT '0' NOT NULL,
239
idPla int DEFAULT '0' NOT NULL,
240
cod_asig int DEFAULT '0' NOT NULL,
241
any smallint DEFAULT '0' NOT NULL,
242
quatrimestre smallint DEFAULT '0' NOT NULL,
243
243
estat char(1) DEFAULT 'M' NOT NULL,
244
244
PRIMARY KEY (id),
245
245
UNIQUE dni_pasaporte (dni_pasaporte,idPla),
248
248
INSERT INTO t3 VALUES (1,'11111111',1,10362,98,1,'M');
249
249
CREATE TABLE t4 (
250
id int(11) NOT NULL auto_increment,
251
papa int(11) DEFAULT '0' NOT NULL,
252
fill int(11) DEFAULT '0' NOT NULL,
253
idPla int(11) DEFAULT '0' NOT NULL,
250
id int NOT NULL auto_increment,
251
papa int DEFAULT '0' NOT NULL,
252
fill int DEFAULT '0' NOT NULL,
253
idPla int DEFAULT '0' NOT NULL,
254
254
PRIMARY KEY (id),
255
255
KEY papa (idPla,papa),
256
256
UNIQUE papa_2 (idPla,papa,fill)
292
292
INSERT INTO t1 VALUES (2,'Lilliana Angelovska');
293
293
INSERT INTO t1 VALUES (3,'Thimble Smith');
294
294
CREATE TABLE t2 (
295
id smallint(5) unsigned NOT NULL auto_increment,
296
owner smallint(5) unsigned DEFAULT '0' NOT NULL,
295
id smallint unsigned NOT NULL auto_increment,
296
owner smallint unsigned DEFAULT '0' NOT NULL,
373
373
CREATE TABLE t1 (
374
t1_id bigint(21) NOT NULL auto_increment,
374
t1_id bigint NOT NULL auto_increment,
375
375
PRIMARY KEY (t1_id)
377
377
CREATE TABLE t2 (
378
t2_id bigint(21) NOT NULL auto_increment,
378
t2_id bigint NOT NULL auto_increment,
379
379
PRIMARY KEY (t2_id)
381
381
CREATE TABLE t3 (
382
t3_id bigint(21) NOT NULL auto_increment,
382
t3_id bigint NOT NULL auto_increment,
383
383
PRIMARY KEY (t3_id)
385
385
CREATE TABLE t4 (
386
seq_0_id bigint(21) DEFAULT '0' NOT NULL,
387
seq_1_id bigint(21) DEFAULT '0' NOT NULL,
386
seq_0_id bigint DEFAULT '0' NOT NULL,
387
seq_1_id bigint DEFAULT '0' NOT NULL,
388
388
KEY seq_0_id (seq_0_id),
389
389
KEY seq_1_id (seq_1_id)
391
391
CREATE TABLE t5 (
392
seq_0_id bigint(21) DEFAULT '0' NOT NULL,
393
seq_1_id bigint(21) DEFAULT '0' NOT NULL,
392
seq_0_id bigint DEFAULT '0' NOT NULL,
393
seq_1_id bigint DEFAULT '0' NOT NULL,
394
394
KEY seq_1_id (seq_1_id),
395
395
KEY seq_0_id (seq_0_id)
602
602
Warning 1101 BLOB/TEXT column 'name' can't have a default value
603
603
INSERT INTO t1 VALUES (1,'yes'),(2,'no');
604
604
CREATE TABLE t2 (
605
id int(11) DEFAULT '0' NOT NULL,
606
idx int(11) DEFAULT '0' NOT NULL,
605
id int DEFAULT '0' NOT NULL,
606
idx int DEFAULT '0' NOT NULL,
607
607
UNIQUE id (id,idx)
609
609
INSERT INTO t2 VALUES (1,1);
713
713
drop table t1,t2;
714
714
create table t1 (
715
match_id tinyint(3) unsigned not null auto_increment,
716
home tinyint(3) unsigned default '0',
715
match_id tinyint unsigned not null auto_increment,
716
home tinyint unsigned default '0',
717
717
unique key match_id (match_id),
718
718
key match_id_2 (match_id)
720
720
insert into t1 values("1", "2");
721
721
create table t2 (
722
player_id tinyint(3) unsigned default '0',
723
match_1_h tinyint(3) unsigned default '0',
722
player_id tinyint unsigned default '0',
723
match_1_h tinyint unsigned default '0',
724
724
key player_id (player_id)
726
726
insert into t2 values("1", "5");
792
792
drop table t1, t2;
793
793
CREATE TABLE t1 (
794
ts_id bigint(20) default NULL,
795
inst_id tinyint(4) default NULL,
794
ts_id bigint default NULL,
795
inst_id tinyint default NULL,
796
796
flag_name varchar(64) default NULL,
798
798
UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
799
799
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
800
800
CREATE TABLE t2 (
801
ts_id bigint(20) default NULL,
802
inst_id tinyint(4) default NULL,
801
ts_id bigint default NULL,
802
inst_id tinyint default NULL,
803
803
flag_name varchar(64) default NULL,
805
805
UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
821
821
DROP TABLE t1,t2;
822
822
CREATE TABLE t1 (
823
id int(11) unsigned NOT NULL auto_increment,
824
text_id int(10) unsigned default NULL,
823
id int unsigned NOT NULL auto_increment,
824
text_id int unsigned default NULL,
827
827
INSERT INTO t1 VALUES("1", "0");
963
963
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
964
964
drop table t1, t2;
965
965
set group_concat_max_len=default;
966
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));
966
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));
967
967
insert t1 values (1, -5, -8, 2), (1, 2, 2, 1), (1, 1, 1, 1);
968
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));
968
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));
969
969
insert t2 values (1, -5, -8, 1), (1, 1, 1, 1), (1, 2, 2, 1);
970
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));
970
create table t3 ( set_id smallint unsigned not null, id tinyint unsigned not null, name char(12) not null, primary key (id,set_id));
971
971
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');
972
972
explain select name from t1 left join t2 on t1.x = t2.x and t1.y = t2.y
973
973
left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8