create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
select id, code, name from t1 order by id;
id code name
2 1 Monty
3 2 David
4 2 Erik
5 3 Sasha
6 3 Jeremy
7 4 Matt
8 1 Sinisa
update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
select id, code, name from t1 order by id;
id code name
3 2 David
4 2 Erik
5 3 Sasha
6 3 Jeremy
7 4 Matt
8 1 Sinisa
12 1 Ralph
drop table t1;
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
parent_id int(11) DEFAULT '0' NOT NULL,
level tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY parent_id (parent_id),
KEY level (level)
) engine=innodb;
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);
update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102;
id parent_id level
8 102 2
9 102 2
15 102 2
update t1 set id=id+1000;
update t1 set id=1024 where id=1009;
Got one of the listed errors
select * from t1;
id parent_id level
1001 100 0
1002 101 1
1003 101 1
1004 101 1
1005 101 1
1006 101 1
1007 101 1
1008 102 2
1009 102 2
1015 102 2
1016 103 2
1017 103 2
1018 103 2
1019 103 2
1020 103 2
1021 104 2
1022 104 2
1024 104 2
1025 105 2
1026 105 2
1027 105 2
1028 105 2
1029 105 2
1030 105 2
1031 106 2
1032 106 2
1033 106 2
1034 106 2
1035 106 2
1036 107 2
1037 107 2
1038 107 2
1040 107 2
1157 100 0
1179 105 2
1183 104 2
1193 105 2
1202 107 2
1203 107 2
update ignore t1 set id=id+1;
select * from t1;
id parent_id level
1001 100 0
1002 101 1
1003 101 1
1004 101 1
1005 101 1
1006 101 1
1007 101 1
1008 102 2
1010 102 2
1015 102 2
1016 103 2
1017 103 2
1018 103 2
1019 103 2
1020 103 2
1021 104 2
1023 104 2
1024 104 2
1025 105 2
1026 105 2
1027 105 2
1028 105 2
1029 105 2
1030 105 2
1031 106 2
1032 106 2
1033 106 2
1034 106 2
1035 106 2
1036 107 2
1037 107 2
1039 107 2
1041 107 2
1158 100 0
1180 105 2
1184 104 2
1194 105 2
1202 107 2
1204 107 2
update ignore t1 set id=1023 where id=1010;
select * from t1 where parent_id=102;
id parent_id level
1008 102 2
1010 102 2
1015 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref level level 1 const # Using where; Using index
explain select level,id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref level level 1 const # Using where; Using index
explain select level,id,parent_id from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
_userid
marc@anyware.co.uk
drop table t1;
set autocommit=1;
CREATE TABLE t1 (
user_id int(10) DEFAULT '0' NOT NULL,
name varchar(100),
phone varchar(100),
ref_email varchar(100) DEFAULT '' NOT NULL,
detail varchar(200),
PRIMARY KEY (user_id,ref_email)
)engine=innodb;
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');
select * from t1 where user_id=10292;
user_id name phone ref_email detail
10292 sanjeev 29153373 sansh777@hotmail.com xxx
10292 shirish 2333604 shirish@yahoo.com ddsds
10292 sonali 323232 sonali@bolly.com filmstar
INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
select * from t1 where user_id=10292;
user_id name phone ref_email detail
10292 sanjeev 29153373 sansh777@hotmail.com xxx
10292 shirish 2333604 shirish@yahoo.com ddsds
10292 sonali 323232 sonali@bolly.com filmstar
select * from t1 where user_id>=10292;
user_id name phone ref_email detail
10292 sanjeev 29153373 sansh777@hotmail.com xxx
10292 shirish 2333604 shirish@yahoo.com ddsds
10292 sonali 323232 sonali@bolly.com filmstar
10293 shirish 2333604 shirish@yahoo.com ddsds
select * from t1 where user_id>10292;
user_id name phone ref_email detail
10293 shirish 2333604 shirish@yahoo.com ddsds
select * from t1 where user_id<10292;
user_id name phone ref_email detail
10291 sanjeev 29153373 sansh777@hotmail.com xxx
drop table t1;
CREATE TABLE t1 (a int not null, b int not null,c int not null,
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);
INSERT INTO t1 values (179,5,2);
update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102;
id parent_id level
8 102 2
9 102 2
15 102 2
update t1 set id=id+1000;
update t1 set id=1024 where id=1009;
select * from t1;
id parent_id level
1001 100 0
1003 101 1
1004 101 1
1008 102 2
1024 102 2
1017 103 2
1022 104 2
1024 104 2
1028 105 2
1029 105 2
1030 105 2
1031 106 2
1032 106 2
1033 106 2
1203 107 2
1202 107 2
1020 103 2
1157 100 0
1193 105 2
1040 107 2
1002 101 1
1015 102 2
1006 101 1
1034 106 2
1035 106 2
1016 103 2
1007 101 1
1036 107 2
1018 103 2
1026 105 2
1027 105 2
1183 104 2
1038 107 2
1025 105 2
1037 107 2
1021 104 2
1019 103 2
1005 101 1
1179 105 2
update ignore t1 set id=id+1;
select * from t1;
id parent_id level
1002 100 0
1004 101 1
1005 101 1
1009 102 2
1025 102 2
1018 103 2
1023 104 2
1025 104 2
1029 105 2
1030 105 2
1031 105 2
1032 106 2
1033 106 2
1034 106 2
1204 107 2
1203 107 2
1021 103 2
1158 100 0
1194 105 2
1041 107 2
1003 101 1
1016 102 2
1007 101 1
1035 106 2
1036 106 2
1017 103 2
1008 101 1
1037 107 2
1019 103 2
1027 105 2
1028 105 2
1184 104 2
1039 107 2
1026 105 2
1038 107 2
1022 104 2
1020 103 2
1006 101 1
1180 105 2
update ignore t1 set id=1023 where id=1010;
select * from t1 where parent_id=102;
id parent_id level
1009 102 2
1025 102 2
1016 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref level level 1 const # Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
1 1005
1 1003
1 1007
1 1008
1 1006
select level,id,parent_id from t1 where level=1;
level id parent_id
1 1004 101
1 1005 101
1 1003 101
1 1007 101
1 1008 101
1 1006 101
select level,id from t1 where level=1 order by id;
CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
a
1
DROP TABLE t1;
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 = innodb;
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);
explain select * from t1 where a > 0 and a < 50;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where
drop table t1;
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=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
ERROR 23000: Duplicate entry '1-1' for key 1
select id from t1;
id
0
1
2
select id from t1;
id
0
1
2
UNLOCK TABLES;
DROP TABLE t1;
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=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
begin;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
ERROR 23000: Duplicate entry '1-1' for key 1
select id from t1;
id
0
1
2
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
commit;
select id,id3 from t1;
id id3
0 0
1 1
2 2
100 2
UNLOCK TABLES;
DROP TABLE t1;
create table t1 (a char(20), unique (a(5))) engine=innodb;
drop table t1;
create table t1 (a char(20), index (a(5))) engine=innodb;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(20) default NULL,
KEY `a` (`a`(5))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
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);
select * from t1;
number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
1024
select repeat('a',2000);
repeat('a',2000)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default;
set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
alter table t3 add t2nr int not null auto_increment primary key first;
drop table tmp;
SET SQL_BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
namn
Abraham Abraham
abrogating abrogating
admonishing admonishing
Adolph Adolph
afield afield
aging aging
ammonium ammonium
analyzable analyzable
animals animals
animized animized
SET SQL_BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
concat(fld3," ",fld3)
Abraham Abraham
abrogating abrogating
admonishing admonishing
Adolph Adolph
afield afield
aging aging
ammonium ammonium
analyzable analyzable
animals animals
animized animized
select distinct fld5 from t2 limit 10;
fld5
neat
Steinberg
jarring
tinily
balled
persist
attainments
fanatic
measures
rightfulness
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
and 1
annoyers 1
Anthony 1
assayed 1
assurers 1
attendants 1
bedlam 1
bedpost 1
boasted 1
SET SQL_BIG_TABLES=1;
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
fld3 count(*)
affixed 1
and 1
annoyers 1
Anthony 1
assayed 1
assurers 1
attendants 1
bedlam 1
bedpost 1
boasted 1
SET SQL_BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
fld3 repeat("a",length(fld3)) count(*)
circus aaaaaa 1
cited aaaaa 1
Colombo aaaaaaa 1
congresswoman aaaaaaaaaaaaa 1
contrition aaaaaaaaaa 1
corny aaaaa 1
cultivation aaaaaaaaaaa 1
definiteness aaaaaaaaaaaa 1
demultiplex aaaaaaaaaaa 1
disappointing aaaaaaaaaaaaa 1
select distinct companynr,rtrim(space(512+companynr)) from t3 order by 1,2;
companynr rtrim(space(512+companynr))
37
78
101
154
311
447
512
select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3;
fld3
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 index period period 4 NULL 41810
1 SIMPLE t1 ref period period 4 test.t3.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index period period 4 NULL 41810
1 SIMPLE t3 ref period period 4 test.t1.period 4181
select period from t1;
period
9410
select period from t1 where period=1900;
period
select fld3,period from t1,t2 where fld1 = 011401 order by period;
fld3 period
breaking 9410
select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
fld3 period
breaking 1001
explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
select fld3,period from t2,t1 where companynr*10 = 37*10;
fld3 period
breaking 9410
Romans 9410
intercepted 9410
bewilderingly 9410
astound 9410
admonishing 9410
sumac 9410
flanking 9410
combed 9410
subjective 9410
scatterbrain 9410
Eulerian 9410
Kane 9410
overlay 9410
perturb 9410
goblins 9410
annihilates 9410
Wotan 9410
snatching 9410
concludes 9410
laterally 9410
yelped 9410
grazing 9410
Baird 9410
celery 9410
misunderstander 9410
handgun 9410
foldout 9410
mystic 9410
succumbed 9410
Nabisco 9410
fingerings 9410
aging 9410
afield 9410
ammonium 9410
boat 9410
intelligibility 9410
Augustine 9410
teethe 9410
dreaded 9410
scholastics 9410
audiology 9410
wallet 9410
parters 9410
eschew 9410
quitter 9410
neat 9410
Steinberg 9410
jarring 9410
tinily 9410
balled 9410
persist 9410
attainments 9410
fanatic 9410
measures 9410
rightfulness 9410
capably 9410
impulsive 9410
starlet 9410
terminators 9410
untying 9410
announces 9410
featherweight 9410
pessimist 9410
daughter 9410
decliner 9410
lawgiver 9410
stated 9410
readable 9410
attrition 9410
cascade 9410
motors 9410
interrogate 9410
pests 9410
stairway 9410
dopers 9410
testicle 9410
Parsifal 9410
leavings 9410
postulation 9410
squeaking 9410
contrasted 9410
leftover 9410
whiteners 9410
erases 9410
Punjab 9410
Merritt 9410
Quixotism 9410
sweetish 9410
dogging 9410
scornfully 9410
bellow 9410
bills 9410
cupboard 9410
sureties 9410
puddings 9410
fetters 9410
bivalves 9410
incurring 9410
Adolph 9410
pithed 9410
Miles 9410
trimmings 9410
tragedies 9410
skulking 9410
flint 9410
flopping 9410
relaxing 9410
offload 9410
suites 9410
lists 9410
animized 9410
multilayer 9410
standardizes 9410
Judas 9410
vacuuming 9410
dentally 9410
humanness 9410
inch 9410
Weissmuller 9410
irresponsibly 9410
luckily 9410
culled 9410
medical 9410
bloodbath 9410
subschema 9410
animals 9410
Micronesia 9410
repetitions 9410
Antares 9410
ventilate 9410
pityingly 9410
interdependent 9410
Graves 9410
neonatal 9410
chafe 9410
honoring 9410
realtor 9410
elite 9410
funereal 9410
abrogating 9410
sorters 9410
Conley 9410
lectured 9410
Abraham 9410
Hawaii 9410
cage 9410
hushes 9410
Simla 9410
reporters 9410
Dutchman 9410
descendants 9410
groupings 9410
dissociate 9410
coexist 9410
Beebe 9410
Taoism 9410
Connally 9410
fetched 9410
checkpoints 9410
rusting 9410
galling 9410
obliterates 9410
traitor 9410
resumes 9410
analyzable 9410
terminator 9410
gritty 9410
firearm 9410
minima 9410
Selfridge 9410
disable 9410
witchcraft 9410
betroth 9410
Manhattanize 9410
imprint 9410
peeked 9410
swelling 9410
interrelationships 9410
riser 9410
Gandhian 9410
peacock 9410
bee 9410
kanji 9410
dental 9410
scarf 9410
chasm 9410
insolence 9410
syndicate 9410
alike 9410
imperial 9410
convulsion 9410
railway 9410
validate 9410
normalizes 9410
comprehensive 9410
chewing 9410
denizen 9410
schemer 9410
chronicle 9410
Kline 9410
Anatole 9410
partridges 9410
brunch 9410
recruited 9410
dimensions 9410
Chicana 9410
announced 9410
praised 9410
employing 9410
linear 9410
quagmire 9410
western 9410
relishing 9410
serving 9410
scheduling 9410
lore 9410
eventful 9410
arteriole 9410
disentangle 9410
cured 9410
Fenton 9410
avoidable 9410
drains 9410
detectably 9410
husky 9410
impelling 9410
undoes 9410
evened 9410
squeezes 9410
destroyer 9410
rudeness 9410
beaner 9410
boorish 9410
Everhart 9410
encompass 9410
mushrooms 9410
Alison 9410
externally 9410
pellagra 9410
cult 9410
creek 9410
Huffman 9410
Majorca 9410
governing 9410
gadfly 9410
reassigned 9410
intentness 9410
craziness 9410
psychic 9410
squabbled 9410
burlesque 9410
capped 9410
extracted 9410
DiMaggio 9410
exclamation 9410
subdirectory 9410
Gothicism 9410
feminine 9410
metaphysically 9410
sanding 9410
Miltonism 9410
freakish 9410
index 9410
straight 9410
flurried 9410
denotative 9410
coming 9410
commencements 9410
gentleman 9410
gifted 9410
Shanghais 9410
sportswriting 9410
sloping 9410
navies 9410
leaflet 9410
shooter 9410
Joplin 9410
babies 9410
assails 9410
admiring 9410
swaying 9410
Goldstine 9410
fitting 9410
Norwalk 9410
analogy 9410
deludes 9410
cokes 9410
Clayton 9410
exhausts 9410
causality 9410
sating 9410
icon 9410
throttles 9410
communicants 9410
dehydrate 9410
priceless 9410
publicly 9410
incidentals 9410
commonplace 9410
mumbles 9410
furthermore 9410
cautioned 9410
parametrized 9410
registration 9410
sadly 9410
positioning 9410
babysitting 9410
eternal 9410
hoarder 9410
congregates 9410
rains 9410
workers 9410
sags 9410
unplug 9410
garage 9410
boulder 9410
specifics 9410
Teresa 9410
Winsett 9410
convenient 9410
buckboards 9410
amenities 9410
resplendent 9410
sews 9410
participated 9410
Simon 9410
certificates 9410
Fitzpatrick 9410
Evanston 9410
misted 9410
textures 9410
save 9410
count 9410
rightful 9410
chaperone 9410
Lizzy 9410
clenched 9410
effortlessly 9410
accessed 9410
beaters 9410
Hornblower 9410
vests 9410
indulgences 9410
infallibly 9410
unwilling 9410
excrete 9410
spools 9410
crunches 9410
overestimating 9410
ineffective 9410
humiliation 9410
sophomore 9410
star 9410
rifles 9410
dialysis 9410
arriving 9410
indulge 9410
clockers 9410
languages 9410
Antarctica 9410
percentage 9410
ceiling 9410
specification 9410
regimented 9410
ciphers 9410
pictures 9410
serpents 9410
allot 9410
realized 9410
mayoral 9410
opaquely 9410
hostess 9410
fiftieth 9410
incorrectly 9410
decomposition 9410
stranglings 9410
mixture 9410
electroencephalography 9410
similarities 9410
charges 9410
freest 9410
Greenberg 9410
tinting 9410
expelled 9410
warm 9410
smoothed 9410
deductions 9410
Romano 9410
bitterroot 9410
corset 9410
securing 9410
environing 9410
cute 9410
Crays 9410
heiress 9410
inform 9410
avenge 9410
universals 9410
Kinsey 9410
ravines 9410
bestseller 9410
equilibrium 9410
extents 9410
relatively 9410
pressure 9410
critiques 9410
befouled 9410
rightfully 9410
mechanizing 9410
Latinizes 9410
timesharing 9410
Aden 9410
embassies 9410
males 9410
shapelessly 9410
mastering 9410
Newtonian 9410
finishers 9410
abates 9410
teem 9410
kiting 9410
stodgy 9410
feed 9410
guitars 9410
airships 9410
store 9410
denounces 9410
Pyle 9410
Saxony 9410
serializations 9410
Peruvian 9410
taxonomically 9410
kingdom 9410
stint 9410
Sault 9410
faithful 9410
Ganymede 9410
tidiness 9410
gainful 9410
contrary 9410
Tipperary 9410
tropics 9410
theorizers 9410
renew 9410
already 9410
terminal 9410
Hegelian 9410
hypothesizer 9410
warningly 9410
journalizing 9410
nested 9410
Lars 9410
saplings 9410
foothill 9410
labeled 9410
imperiously 9410
reporters 9410
furnishings 9410
precipitable 9410
discounts 9410
excises 9410
Stalin 9410
despot 9410
ripeness 9410
Arabia 9410
unruly 9410
mournfulness 9410
boom 9410
slaughter 9410
Sabine 9410
handy 9410
rural 9410
organizer 9410
shipyard 9410
civics 9410
inaccuracy 9410
rules 9410
juveniles 9410
comprised 9410
investigations 9410
stabilizes 9410
seminaries 9410
Hunter 9410
sporty 9410
test 9410
weasels 9410
CERN 9410
tempering 9410
afore 9410
Galatean 9410
techniques 9410
error 9410
veranda 9410
severely 9410
Cassites 9410
forthcoming 9410
guides 9410
vanish 9410
lied 9410
sawtooth 9410
fated 9410
gradually 9410
widens 9410
preclude 9410
evenhandedly 9410
percentage 9410
disobedience 9410
humility 9410
gleaning 9410
petted 9410
bloater 9410
minion 9410
marginal 9410
apiary 9410
measures 9410
precaution 9410
repelled 9410
primary 9410
coverings 9410
Artemia 9410
navigate 9410
spatial 9410
Gurkha 9410
meanwhile 9410
Melinda 9410
Butterfield 9410
Aldrich 9410
previewing 9410
glut 9410
unaffected 9410
inmate 9410
mineral 9410
impending 9410
meditation 9410
ideas 9410
miniaturizes 9410
lewdly 9410
title 9410
youthfulness 9410
creak 9410
Chippewa 9410
clamored 9410
freezes 9410
forgivably 9410
reduce 9410
McGovern 9410
Nazis 9410
epistle 9410
socializes 9410
conceptions 9410
Kevin 9410
uncovering 9410
chews 9410
appendixes 9410
appendixes 9410
appendixes 9410
appendixes 9410
appendixes 9410
appendixes 9410
raining 9410
infest 9410
compartment 9410
minting 9410
ducks 9410
roped 9410
waltz 9410
Lillian 9410
repressions 9410
chillingly 9410
noncritical 9410
lithograph 9410
spongers 9410
parenthood 9410
posed 9410
instruments 9410
filial 9410
fixedly 9410
relives 9410
Pandora 9410
watering 9410
ungrateful 9410
secures 9410
poison 9410
dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
select fld3,period,price,price2 from t2,t3 where t2.fld1=t3.t2nr and period >= 1001 and period <= 1002 and t2.companynr = 37 order by fld3,period, price;
fld3 period price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
Antares 1002 28357832 8723648
astound 1001 5987435 234724
audiology 1001 5987435 234724
Augustine 1002 28357832 8723648
Baird 1002 28357832 8723648
bewilderingly 1001 5987435 234724
breaking 1001 5987435 234724
Conley 1001 5987435 234724
dentally 1002 28357832 8723648
dissociate 1002 28357832 8723648
elite 1001 5987435 234724
eschew 1001 5987435 234724
Eulerian 1001 5987435 234724
flanking 1001 5987435 234724
foldout 1002 28357832 8723648
funereal 1002 28357832 8723648
galling 1002 28357832 8723648
Graves 1001 5987435 234724
grazing 1001 5987435 234724
groupings 1001 5987435 234724
handgun 1001 5987435 234724
humility 1002 28357832 8723648
impulsive 1002 28357832 8723648
inch 1001 5987435 234724
intelligibility 1001 5987435 234724
jarring 1001 5987435 234724
lawgiver 1001 5987435 234724
lectured 1002 28357832 8723648
Merritt 1002 28357832 8723648
neonatal 1001 5987435 234724
offload 1002 28357832 8723648
parters 1002 28357832 8723648
pityingly 1002 28357832 8723648
puddings 1002 28357832 8723648
Punjab 1001 5987435 234724
quitter 1002 28357832 8723648
realtor 1001 5987435 234724
relaxing 1001 5987435 234724
repetitions 1001 5987435 234724
resumes 1001 5987435 234724
Romans 1002 28357832 8723648
rusting 1001 5987435 234724
scholastics 1001 5987435 234724
skulking 1002 28357832 8723648
stated 1002 28357832 8723648
suites 1002 28357832 8723648
sureties 1001 5987435 234724
testicle 1002 28357832 8723648
tinily 1002 28357832 8723648
tragedies 1001 5987435 234724
trimmings 1001 5987435 234724
vacuuming 1001 5987435 234724
ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2.fld1 <= 18811 and t2.fld1=t3.t2nr and period = 1001 and t2.companynr = 37;
fld1 fld3 period price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
018811 repetitions 1001 5987435 234724
create table t4 (
companynr tinyint(2) unsigned zerofill NOT NULL default '00',
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 12
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
41 40
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
fld1 companynr fld3 period
038008 37 reporters 1008
038208 37 Selfridge 1008
select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t2.fld1 = 38208 or t2.fld1 = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
fld1 companynr fld3 period
038008 37 reporters 1008
038208 37 Selfridge 1008
select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t3.t2nr = 38208 or t3.t2nr = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
fld1 companynr fld3 period
038008 37 reporters 1008
038208 37 Selfridge 1008
select period from t1 where (((period > 0) or period < 10000 or (period = 1900)) and (period=1900 and period <= 1901) or (period=1903 and (period=1903)) and period>=1902) or ((period=1904 or period=1905) or (period=1906 or period>1907)) or (period=1908 and period = 1909);
period
9410
select period from t1 where ((period > 0 and period < 1) or (((period > 0 and period < 100) and (period > 10)) or (period > 10)) or (period > 0 and (period > 5 or period > 6)));
period
9410
select a.fld1 from t2 as a,t2 b where ((a.fld1 = 250501 and a.fld1=b.fld1) or a.fld1=250502 or a.fld1=250503 or (a.fld1=250505 and a.fld1<=b.fld1 and b.fld1>=a.fld1)) and a.fld1=b.fld1;
fld1
250501
250502
250503
250505
select fld1 from t2 where fld1 in (250502,98005,98006,250503,250605,250606) and fld1 >=250502 and fld1 not in (250605,250606);
fld1
250502
250503
select fld1 from t2 where fld1 between 250502 and 250504;
fld1
250502
250503
250504
select fld3 from t2 where (((fld3 like "_%L%" ) or (fld3 like "%ok%")) and ( fld3 like "L%" or fld3 like "G%")) and fld3 like "L%" ;
fld3
label
labeled
labeled
landslide
laterally
leaflet
lewdly
Lillian
luckily
select count(*) from t1;
count(*)
1
select companynr,count(*),sum(fld1) from t2 group by companynr;
companynr count(*) sum(fld1)
00 82 10355753
29 95 14473298
34 70 17788966
36 215 22786296
37 588 83602098
40 37 6618386
41 52 12816335
50 11 1595438
53 4 793210
58 23 2254293
65 10 2284055
68 12 3097288
select companynr,count(*) from t2 group by companynr order by companynr desc limit 5;
companynr count(*)
68 12
65 10
58 23
53 4
50 11
select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where
Warnings:
Note 1003 select count(0) AS `count(*)`,min(test.t2.fld4) AS `min(fld4)`,max(test.t2.fld4) AS `max(fld4)`,sum(test.t2.fld1) AS `sum(fld1)`,avg(test.t2.fld1) AS `avg(fld1)`,std(test.t2.fld1) AS `std(fld1)`,variance(test.t2.fld1) AS `variance(fld1)` from test.t2 where ((test.t2.companynr = 34) and (test.t2.fld4 <> _latin1''))
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
select /*! SQL_SMALL_RESULT */ companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
select sum(fld1),fld3 from t2 where fld3="Romans" group by fld1 limit 10;
sum(fld1) fld3
11402 Romans
select name,count(*) from t3 where name='cloakroom' group by name;
name count(*)
cloakroom 4181
select name,count(*) from t3 where name='cloakroom' and price>10 group by name;
name count(*)
cloakroom 4181
select count(*) from t3 where name='cloakroom' and price2=823742;
count(*)
4181
select name,count(*) from t3 where name='cloakroom' and price2=823742 group by name;
name count(*)
cloakroom 4181
select name,count(*) from t3 where name >= "extramarital" and price <= 39654943 group by name;
name count(*)
extramarital 4181
gazer 4181
gems 4181
Iranizes 4181
spates 4181
tucked 4181
violinist 4181
select t2.fld3,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld3 count(*)
spates 4181
select companynr|0,companyname from t4 group by 1;
companynr|0 companyname
0 Unknown
29 company 1
34 company 2
36 company 3
37 company 4
40 company 5
41 company 6
50 company 11
53 company 7
58 company 8
65 company 9
68 company 10
select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by t2.companynr order by companyname;
companynr companyname count(*)
29 company 1 95
68 company 10 12
50 company 11 11
34 company 2 70
36 company 3 215
37 company 4 588
40 company 5 37
41 company 6 52
53 company 7 4
58 company 8 23
65 company 9 10
00 Unknown 82
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
select sum(Period)/count(*) from t1;
sum(Period)/count(*)
9410.00
select companynr,count(price) as "count",sum(price) as "sum" ,abs(sum(price)/count(price)-avg(price)) as "diff",(0+count(price))*companynr as func from t3 group by companynr;
companynr count sum diff func
37 12543 309394878010 0.0000 464091
78 8362 414611089292 0.0000 652236
101 4181 3489454238 0.0000 422281
154 4181 4112197254950 0.0000 643874
311 4181 979599938 0.0000 1300291
447 4181 9929180954 0.0000 1868907
512 4181 3288532102 0.0000 2140672
select companynr,sum(price)/count(price) as avg from t3 group by companynr having avg > 70000000 order by avg;
companynr avg
154 983543950.00
select companynr,count(*) from t2 group by companynr order by 2 desc;
companynr count(*)
37 588
36 215
29 95
00 82
34 70
41 52
40 37
58 23
68 12
50 11
65 10
53 4
select companynr,count(*) from t2 where companynr > 40 group by companynr order by 2 desc;
companynr count(*)
41 52
58 23
68 12
50 11
65 10
53 4
select t2.fld4,t2.fld1,count(price),sum(price),min(price),max(price),avg(price) from t3,t2 where t3.companynr = 37 and t2.fld1 = t3.t2nr group by fld1,t2.fld4;
select t3.companynr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 group by companynr,fld3;
companynr fld3 sum(price)
512 boat 786542
512 capably 786542
512 cupboard 786542
512 decliner 786542
512 descendants 786542
512 dopers 786542
512 erases 786542
512 Micronesia 786542
512 Miles 786542
512 skies 786542
select t2.companynr,count(*),min(fld3),max(fld3),sum(price),avg(price) from t2,t3 where t3.companynr >= 30 and t3.companynr <= 58 and t3.t2nr = t2.fld1 and 1+1=2 group by t2.companynr;
select t3.companynr+0,t3.t2nr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 37 group by 1,t3.t2nr,fld3,fld3,fld3,fld3,fld3 order by fld1;
t3.companynr+0 t2nr fld3 sum(price)
37 1 Omaha 5987435
37 11401 breaking 5987435
37 11402 Romans 28357832
37 11403 intercepted 39654943
37 11501 bewilderingly 5987435
37 11701 astound 5987435
37 11702 admonishing 28357832
37 11703 sumac 39654943
37 12001 flanking 5987435
37 12003 combed 39654943
37 12301 Eulerian 5987435
37 12302 dubbed 28357832
37 12303 Kane 39654943
37 12501 annihilates 5987435
37 12602 Wotan 28357832
37 12603 snatching 39654943
37 12701 grazing 5987435
37 12702 Baird 28357832
37 12703 celery 39654943
37 13601 handgun 5987435
37 13602 foldout 28357832
37 13603 mystic 39654943
37 13801 intelligibility 5987435
37 13802 Augustine 28357832
37 13803 teethe 39654943
37 13901 scholastics 5987435
37 16001 audiology 5987435
37 16201 wallet 5987435
37 16202 parters 28357832
37 16301 eschew 5987435
37 16302 quitter 28357832
37 16303 neat 39654943
37 18001 jarring 5987435
37 18002 tinily 28357832
37 18003 balled 39654943
37 18012 impulsive 28357832
37 18013 starlet 39654943
37 18021 lawgiver 5987435
37 18022 stated 28357832
37 18023 readable 39654943
37 18032 testicle 28357832
37 18033 Parsifal 39654943
37 18041 Punjab 5987435
37 18042 Merritt 28357832
37 18043 Quixotism 39654943
37 18051 sureties 5987435
37 18052 puddings 28357832
37 18053 tapestry 39654943
37 18061 trimmings 5987435
37 18062 humility 28357832
37 18101 tragedies 5987435
37 18102 skulking 28357832
37 18103 flint 39654943
37 18201 relaxing 5987435
37 18202 offload 28357832
37 18402 suites 28357832
37 18403 lists 39654943
37 18601 vacuuming 5987435
37 18602 dentally 28357832
37 18603 humanness 39654943
37 18801 inch 5987435
37 18802 Weissmuller 28357832
37 18803 irresponsibly 39654943
37 18811 repetitions 5987435
37 18812 Antares 28357832
37 19101 ventilate 5987435
37 19102 pityingly 28357832
37 19103 interdependent 39654943
37 19201 Graves 5987435
37 30501 neonatal 5987435
37 30502 scribbled 28357832
37 30503 chafe 39654943
37 31901 realtor 5987435
37 36001 elite 5987435
37 36002 funereal 28357832
37 38001 Conley 5987435
37 38002 lectured 28357832
37 38003 Abraham 39654943
37 38011 groupings 5987435
37 38012 dissociate 28357832
37 38013 coexist 39654943
37 38101 rusting 5987435
37 38102 galling 28357832
37 38103 obliterates 39654943
37 38201 resumes 5987435
37 38202 analyzable 28357832
37 38203 terminator 39654943
select sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1= t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008;
sum(price)
234298
select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1 = t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008 or t3.t2nr = t2.fld1 and t2.fld1 = 38008 group by t2.fld1;
fld1 sum(price)
038008 234298
explain select fld3 from t2 where 1>2 or 2>3;
id select_type table type possible_keys key key_len ref rows Extra
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
do foobar;
ERROR 42S22: Unknown column 'foobar' in 'field list'
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
gvid the_success the_fail the_size the_time
DROP TABLE t1,t2;
create table t1 ( A_Id bigint(20) NOT NULL default '0', A_UpdateBy char(10) NOT NULL default '', A_UpdateDate bigint(20) NOT NULL default '0', A_UpdateSerial int(11) NOT NULL default '0', other_types bigint(20) NOT NULL default '0', wss_type bigint(20) NOT NULL default '0');
INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093);
select wss_type from t1 where wss_type ='102935229216544106';
wss_type
select wss_type from t1 where wss_type ='102935229216544105';
wss_type
select wss_type from t1 where wss_type ='102935229216544104';
wss_type
select wss_type from t1 where wss_type ='102935229216544093';
wss_type
102935229216544093
select wss_type from t1 where wss_type =102935229216544093;
wss_type
102935229216544093
drop table t1;
select 1+2,"aaaa",3.13*2.0 into @a,@b,@c;
select @a;
@a
3
select @b;
@b
aaaa
select @c;
@c
6.26
create table t1 (a int not null auto_increment primary key);
insert into t1 values ();
insert into t1 values ();
insert into t1 values ();
select * from (t1 as t2 left join t1 as t3 using (a)), t1;
a a a
1 1 1
2 2 1
3 3 1
1 1 2
2 2 2
3 3 2
1 1 3
2 2 3
3 3 3
select * from t1, (t1 as t2 left join t1 as t3 using (a));
a a a
1 1 1
2 1 1
3 1 1
1 2 2
2 2 2
3 2 2
1 3 3
2 3 3
3 3 3
select * from (t1 as t2 left join t1 as t3 using (a)) straight_join t1;
a a a
1 1 1
2 2 1
3 3 1
1 1 2
2 2 2
3 3 2
1 1 3
2 2 3
3 3 3
select * from t1 straight_join (t1 as t2 left join t1 as t3 using (a));
a a a
1 1 1
2 1 1
3 1 1
1 2 2
2 2 2
3 2 2
1 3 3
2 3 3
3 3 3
select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 on t1.a>1;
a a a
1 1 2
1 1 3
2 2 2
2 2 3
3 3 2
3 3 3
select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
a a a
1 1 NULL
2 1 1
3 1 1
1 2 NULL
2 2 2
3 2 2
1 3 NULL
2 3 3
3 3 3
select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 using ( a );
a a a
1 1 1
2 2 2
3 3 3
select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) using ( a );
a a a
1 1 1
2 1 NULL
3 1 NULL
1 2 NULL
2 2 2
3 2 NULL
1 3 NULL
2 3 NULL
3 3 3
select * from (t1 as t2 left join t1 as t3 using (a)) left outer join t1 on t1.a>1;
a a a
1 1 2
1 1 3
2 2 2
2 2 3
3 3 2
3 3 3
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
a a a
1 1 NULL
2 1 1
3 1 1
1 2 NULL
2 2 2
3 2 2
1 3 NULL
2 3 3
3 3 3
select * from (t1 as t2 left join t1 as t3 using (a)) left join t1 using ( a );
a a a
1 1 1
2 2 2
3 3 3
select * from t1 left join (t1 as t2 left join t1 as t3 using (a)) using ( a );
a a a
1 1 1
2 1 NULL
3 1 NULL
1 2 NULL
2 2 2
3 2 NULL
1 3 NULL
2 3 NULL
3 3 3
select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
a a a
1 1 1
2 2 2
3 3 3
select * from t1 natural left join (t1 as t2 left join t1 as t3 using (a));
a a a
1 1 1
2 2 2
3 3 3
select * from (t1 as t2 left join t1 as t3 using (a)) right join t1 on t1.a>1;
a a a
1 NULL 1
2 NULL 1
3 NULL 1
1 1 2
2 2 2
3 3 2
1 1 3
2 2 3
3 3 3
select * from t1 right join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
a a a
2 1 1
3 1 1
2 2 2
3 2 2
2 3 3
3 3 3
select * from (t1 as t2 left join t1 as t3 using (a)) right outer join t1 using ( a );
a a a
1 1 1
2 NULL 1
3 NULL 1
1 NULL 2
2 2 2
3 NULL 2
1 NULL 3
2 NULL 3
3 3 3
select * from t1 right outer join (t1 as t2 left join t1 as t3 using (a)) using ( a );
a a a
1 1 1
2 2 2
3 3 3
select * from (t1 as t2 left join t1 as t3 using (a)) natural right join t1;
a a a
1 1 1
2 NULL 1
3 NULL 1
1 NULL 2
2 2 2
3 NULL 2
1 NULL 3
2 NULL 3
3 3 3
select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a));
a a a
1 1 1
2 2 2
3 3 3
select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
a a
1 1
2 2
3 3
select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
a a a
1 1 1
2 2 2
3 3 3
drop table t1;
CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522);
CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5;
aa id t2_id id
2 8299 2517 2517
3 8301 2518 2518
4 8302 2519 2519
5 8303 2520 2520
6 8304 2521 2521
drop table t1,t2;
create table t1 (id1 int NOT NULL);
create table t2 (id2 int NOT NULL);
create table t3 (id3 int NOT NULL);
create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4));
insert into t1 values (1);
insert into t1 values (2);
insert into t2 values (1);
insert into t4 values (1,1);
explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 1
1 SIMPLE t4 ALL id4 NULL NULL NULL 1 Using where
select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
id1 id2 id3 id4 id44
1 1 NULL NULL NULL
drop table t1,t2,t3,t4;
create table t1(s varchar(10) not null);
create table t2(s varchar(10) not null primary key);
create table t3(s varchar(10) not null primary key);
insert into t1 values ('one\t'), ('two\t');
insert into t2 values ('one\r'), ('two\t');
insert into t3 values ('one '), ('two\t');
select * from t1 where s = 'one';
s
select * from t2 where s = 'one';
s
select * from t3 where s = 'one';
s
one
select * from t1,t2 where t1.s = t2.s;
s s
two two
select * from t2,t3 where t2.s = t3.s;
s s
two two
drop table t1, t2, t3;
create table t1 (a integer, b integer, index(a), index(b));
create table t2 (c integer, d integer, index(c), index(d));
insert into t1 values (1,2), (2,2), (3,2), (4,2);
insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 2 Using where
1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
select * from t1 left join t2 on a=c where d in (4);
a b c d
3 2 3 4
4 2 4 4
explain select * from t1 left join t2 on a=c where d = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 2 Using where
1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
select * from t1 left join t2 on a=c where d = 4;
a b c d
3 2 3 4
4 2 4 4
drop table t1, t2;
CREATE TABLE t1 (
i int(11) NOT NULL default '0',
c char(10) NOT NULL default '',
PRIMARY KEY (i),
UNIQUE KEY c (c)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'a');
INSERT INTO t1 VALUES (2,'b');
INSERT INTO t1 VALUES (3,'c');
EXPLAIN SELECT i FROM t1 WHERE i=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
create table t1 (t text,c char(10),b blob, d binary(10));
insert into t1 values (NULL,NULL,NULL,NULL);
insert into t1 values ("","","","");
insert into t1 values ("hello","hello","hello","hello");
insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
insert into t1 values ("a","a","a","a");
insert into t1 values (1,1,1,1);
insert into t1 values (NULL,NULL,NULL,NULL);
update t1 set c="",b=null where c="1";
lock tables t1 READ;
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
t text latin1_swedish_ci YES NULL
c varchar(10) latin1_swedish_ci YES NULL
b blob NULL YES NULL
d varbinary(10) NULL YES NULL
lock tables t1 WRITE;
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
t text latin1_swedish_ci YES NULL
c varchar(10) latin1_swedish_ci YES NULL
b blob NULL YES NULL
d varbinary(10) NULL YES NULL
unlock tables;
select t from t1 where t like "hello";
t
hello
HELLO
select c from t1 where c like "hello";
c
hello
HELLO
select b from t1 where b like "hello";
b
hello
select d from t1 where d like "hello";
d
hello
select c from t1 having c like "hello";
c
hello
HELLO
select d from t1 having d like "hello";
d
hello
select t from t1 where t like "%HELLO%";
t
hello
HELLO
HELLO MY
select c from t1 where c like "%HELLO%";
c
hello
HELLO
HELLO MY
select b from t1 where b like "%HELLO%";
b
HELLO
HELLO MY
select d from t1 where d like "%HELLO%";
d
HELLO
HELLO MY
select c from t1 having c like "%HELLO%";
c
hello
HELLO
HELLO MY
select d from t1 having d like "%HELLO%";
d
HELLO
HELLO MY
select d from t1 having d like "%HE%LLO%";
d
HELLO
HELLO MY
select t from t1 order by t;
t
NULL
NULL
1
a
hello
HELLO
HELLO MY
select c from t1 order by c;
c
NULL
NULL
a
hello
HELLO
HELLO MY
select b from t1 order by b;
b
NULL
NULL
NULL
HELLO
HELLO MY
a
hello
select d from t1 order by d;
d
NULL
NULL
1
HELLO
HELLO MY
a
hello
select distinct t from t1;
t
NULL
hello
HELLO MY
a
1
select distinct b from t1;
b
NULL
hello
HELLO
HELLO MY
a
select distinct t from t1 order by t;
t
NULL
1
a
hello
HELLO MY
select distinct b from t1 order by b;
b
NULL
HELLO
HELLO MY
a
hello
select t from t1 group by t;
t
NULL
1
a
hello
HELLO MY
select b from t1 group by b;
b
NULL
HELLO
HELLO MY
a
hello
set option sql_big_tables=1;
select distinct t from t1;
t
NULL
hello
HELLO MY
a
1
select distinct b from t1;
b
NULL
hello
HELLO
HELLO MY
a
select distinct t from t1 order by t;
t
NULL
1
a
hello
HELLO MY
select distinct b from t1 order by b;
b
NULL
HELLO
HELLO MY
a
hello
select distinct c from t1;
c
NULL
hello
HELLO MY
a
select distinct d from t1;
d
NULL
hello
HELLO
HELLO MY
a
1
select distinct c from t1 order by c;
c
NULL
a
hello
HELLO MY
select distinct d from t1 order by d;
d
NULL
1
HELLO
HELLO MY
a
hello
select c from t1 group by c;
c
NULL
a
hello
HELLO MY
select d from t1 group by d;
d
NULL
1
HELLO
HELLO MY
a
hello
set option sql_big_tables=0;
select distinct * from t1;
t c b d
NULL NULL NULL NULL
hello hello hello hello
HELLO HELLO HELLO HELLO
HELLO MY HELLO MY HELLO MY HELLO MY
a a a a
1 NULL 1
select t,count(*) from t1 group by t;
t count(*)
NULL 2
1
1 1
a 1
hello 2
HELLO MY 1
select b,count(*) from t1 group by b;
b count(*)
NULL 3
1
HELLO 1
HELLO MY 1
a 1
hello 1
select c,count(*) from t1 group by c;
c count(*)
NULL 2
2
a 1
hello 2
HELLO MY 1
select d,count(*) from t1 group by d;
d count(*)
NULL 2
1
1 1
HELLO 1
HELLO MY 1
a 1
hello 1
drop table t1;
create table t1 (a text, unique (a(2100)));
ERROR 42000: Specified key was too long; max key length is 1000 bytes
create table t1 (a text, key (a(2100)));
Warnings:
Warning 1071 Specified key was too long; max key length is 1000 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text,
KEY `a` (`a`(1000))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 (
t1_id bigint(21) NOT NULL auto_increment,
_field_72 varchar(128) DEFAULT '' NOT NULL,
_field_95 varchar(32),
_field_115 tinyint(4) DEFAULT '0' NOT NULL,
_field_122 tinyint(4) DEFAULT '0' NOT NULL,
_field_126 tinyint(4),
_field_134 tinyint(4),
PRIMARY KEY (t1_id),
UNIQUE _field_72 (_field_72),
KEY _field_115 (_field_115),
KEY _field_122 (_field_122)
);
INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
CREATE TABLE t2 (
seq_0_id bigint(21) DEFAULT '0' NOT NULL,
seq_1_id bigint(21) DEFAULT '0' NOT NULL,
PRIMARY KEY (seq_0_id,seq_1_id)
);
INSERT INTO t2 VALUES (1,1);
INSERT INTO t2 VALUES (2,1);
INSERT INTO t2 VALUES (2,2);
CREATE TABLE t3 (
t3_id bigint(21) NOT NULL auto_increment,
_field_131 varchar(128),
_field_133 tinyint(4) DEFAULT '0' NOT NULL,
_field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
_field_137 tinyint(4),
_field_139 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
_field_140 blob,
_field_142 tinyint(4) DEFAULT '0' NOT NULL,
_field_145 tinyint(4) DEFAULT '0' NOT NULL,
_field_148 tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (t3_id),
KEY _field_133 (_field_133),
KEY _field_135 (_field_135),
KEY _field_139 (_field_139),
KEY _field_142 (_field_142),
KEY _field_145 (_field_145),
KEY _field_148 (_field_148)
);
INSERT INTO t3 VALUES (1,'test job 1',0,'0000-00-00 00:00:00',0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
INSERT INTO t3 VALUES (2,'test job 2',0,'0000-00-00 00:00:00',0,'1999-02-26 21:08:04','',0,0,0);
CREATE TABLE t4 (
seq_0_id bigint(21) DEFAULT '0' NOT NULL,
seq_1_id bigint(21) DEFAULT '0' NOT NULL,
PRIMARY KEY (seq_0_id,seq_1_id)
);
INSERT INTO t4 VALUES (1,1);
INSERT INTO t4 VALUES (2,1);
CREATE TABLE t5 (
t5_id bigint(21) NOT NULL auto_increment,
_field_149 tinyint(4),
_field_156 varchar(128) DEFAULT '' NOT NULL,
_field_157 varchar(128) DEFAULT '' NOT NULL,
_field_158 varchar(128) DEFAULT '' NOT NULL,
_field_159 varchar(128) DEFAULT '' NOT NULL,
_field_160 varchar(128) DEFAULT '' NOT NULL,
_field_161 varchar(128) DEFAULT '' NOT NULL,
PRIMARY KEY (t5_id),
KEY _field_156 (_field_156),
KEY _field_157 (_field_157),
KEY _field_158 (_field_158),
KEY _field_159 (_field_159),
KEY _field_160 (_field_160),
KEY _field_161 (_field_161)
);
INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
CREATE TABLE t6 (
seq_0_id bigint(21) DEFAULT '0' NOT NULL,
seq_1_id bigint(21) DEFAULT '0' NOT NULL,
PRIMARY KEY (seq_0_id,seq_1_id)
);
INSERT INTO t6 VALUES (1,1);
INSERT INTO t6 VALUES (1,2);
INSERT INTO t6 VALUES (2,2);
CREATE TABLE t7 (
t7_id bigint(21) NOT NULL auto_increment,
_field_143 tinyint(4),
_field_165 varchar(32),
_field_166 smallint(6) DEFAULT '0' NOT NULL,
PRIMARY KEY (t7_id),
KEY _field_166 (_field_166)
);
INSERT INTO t7 VALUES (1,0,'High',1);
INSERT INTO t7 VALUES (2,0,'Medium',2);
INSERT INTO t7 VALUES (3,0,'Low',3);
select replace(t3._field_140, "\r","^M"),t3_id,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select sql_no_cache charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'imagem' at row 1
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
options enum('one','two','tree') latin1_swedish_ci one #
flags set('one','two','tree') latin1_swedish_ci #
new_field varchar(10) latin1_swedish_ci new #
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
auto auto
16 16
...
...
@@ -268,11 +268,11 @@ drop table t2;
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
auto bigint(17) unsigned NULL PRI 0 select,insert,update,references
t3 longtext latin1_swedish_ci select,insert,update,references
t4 longblob NULL select,insert,update,references
auto bigint(17) unsigned NULL PRI 0 #
t1 bigint(1) NULL 0 #
t2 char(1) latin1_swedish_ci #
t3 longtext latin1_swedish_ci #
t4 longblob NULL #
select * from t2;
auto t1 t2 t3 t4
11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
...
...
@@ -291,9 +291,9 @@ ERROR 42S21: Duplicate column name 'c'
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
show full columns from t3;
Field Type Collation Null Key Default Extra Privileges Comment
t1 1 real_float 1 real_float A NULL NULL NULL BTREE
t1 1 ushort 1 ushort A NULL NULL NULL BTREE
t1 1 umedium 1 umedium A NULL NULL NULL BTREE
t1 1 ulong 1 ulong A NULL NULL NULL BTREE
t1 1 ulonglong 1 ulonglong A NULL NULL NULL BTREE
t1 1 ulonglong 2 ulong A NULL NULL NULL BTREE
t1 1 options 1 options A NULL NULL NULL BTREE
t1 1 options 2 flags A NULL NULL NULL BTREE
CREATE UNIQUE INDEX test on t1 ( auto ) ;
CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
CREATE INDEX test3 on t1 ( medium ) ;
DROP INDEX test ON t1;
insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
Warnings:
Warning 1264 Data truncated; out of range for column 'utiny' at row 1
Warning 1264 Data truncated; out of range for column 'ushort' at row 1
Warning 1264 Data truncated; out of range for column 'umedium' at row 1
Warning 1264 Data truncated; out of range for column 'ulong' at row 1
Warning 1265 Data truncated for column 'options' at row 1
Warning 1265 Data truncated for column 'flags' at row 1
insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
Warnings:
Warning 1265 Data truncated for column 'string' at row 1
Warning 1264 Data truncated; out of range for column 'tiny' at row 1
Warning 1264 Data truncated; out of range for column 'short' at row 1
Warning 1264 Data truncated; out of range for column 'medium' at row 1
Warning 1264 Data truncated; out of range for column 'long_int' at row 1
Warning 1264 Data truncated; out of range for column 'utiny' at row 1
Warning 1264 Data truncated; out of range for column 'ushort' at row 1
Warning 1264 Data truncated; out of range for column 'umedium' at row 1
Warning 1264 Data truncated; out of range for column 'ulong' at row 1
Warning 1265 Data truncated for column 'options' at row 1
insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
Warnings:
Warning 1264 Data truncated; out of range for column 'tiny' at row 1
Warning 1264 Data truncated; out of range for column 'short' at row 1
Warning 1264 Data truncated; out of range for column 'medium' at row 1
Warning 1264 Data truncated; out of range for column 'long_int' at row 1
Warning 1264 Data truncated; out of range for column 'utiny' at row 1
Warning 1264 Data truncated; out of range for column 'ushort' at row 1
Warning 1264 Data truncated; out of range for column 'umedium' at row 1
Warning 1265 Data truncated for column 'options' at row 1
insert into t1 (tiny) values (1);
select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col
options enum('one','two','tree') latin1_swedish_ci one
flags set('one','two','tree') latin1_swedish_ci
new_field varchar(10) latin1_swedish_ci new
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
auto auto
16 16
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.string and t1.tiny<=>t2.tiny and t1.short<=>t2.short and t1.medium<=>t2.medium and t1.long_int<=>t2.long_int and t1.longlong<=>t2.longlong and t1.real_float<=>t2.real_float and t1.real_double<=>t2.real_double and t1.utiny<=>t2.utiny and t1.ushort<=>t2.ushort and t1.umedium<=>t2.umedium and t1.ulong<=>t2.ulong and t1.ulonglong<=>t2.ulonglong and t1.time_stamp<=>t2.time_stamp and t1.date_field<=>t2.date_field and t1.time_field<=>t2.time_field and t1.date_time<=>t2.date_time and t1.new_blob_col<=>t2.new_blob_col and t1.tinyblob_col<=>t2.tinyblob_col and t1.mediumblob_col<=>t2.mediumblob_col and t1.options<=>t2.options and t1.flags<=>t2.flags and t1.new_field<=>t2.new_field);
auto auto
16 16
drop table t2;
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
auto bigint(17) unsigned NULL PRI 0
t1 bigint(1) NULL 0
t2 char(1) latin1_swedish_ci
t3 longtext latin1_swedish_ci
t4 longblob NULL
select * from t2;
auto t1 t2 t3 t4
11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
drop table t1,t2;
create table t1 (c int);
insert into t1 values(1),(2);
create table t2 select * from t1;
create table t3 select * from t1, t2;
ERROR 42S21: Duplicate column name 'c'
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
show full columns from t3;
Field Type Collation Null Key Default Extra Privileges Comment
c1 int(11) NULL YES NULL
c2 int(11) NULL YES NULL
const bigint(1) NULL 0
drop table t1,t2,t3;
create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
drop table t1;
create table t1 ( id integer unsigned not null primary key );
create table t2 ( id integer unsigned not null primary key );
insert into t1 values (1), (2);
insert into t2 values (1);
select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
id_A id_B
1 1
2 NULL
create table t3 (id_A integer unsigned not null, id_B integer unsigned null );
insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
select * from t3;
id_A id_B
1 1
2 NULL
drop table t3;
create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );