mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 08:44:33 +01:00
125cf485b1
commit 6b20342651
1156 lines
36 KiB
Text
1156 lines
36 KiB
Text
DROP TABLE IF EXISTS t1,t2,t3,t4;
|
|
CREATE TABLE t1(c1 DECIMAL(10,5) UNSIGNED NOT NULL, c2 DECIMAL(10,5) SIGNED NULL, c3 DECIMAL, c4 INT, UNIQUE INDEX idx(c1,c4));
|
|
INSERT INTO t1 VALUES('00100.05000','-00100.05000','00100119',1),('11111.00009','-9999.99999','9999999',2);
|
|
INSERT INTO t1 VALUES('1000000','10000000','1000000000.0001',3);
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 1
|
|
Warning 1264 Out of range value for column 'c2' at row 1
|
|
Note 1265 Data truncated for column 'c3' at row 1
|
|
INSERT INTO t1 values('100.000001','1000.999999','9999.999999',4);
|
|
Warnings:
|
|
Note 1265 Data truncated for column 'c1' at row 1
|
|
Note 1265 Data truncated for column 'c2' at row 1
|
|
Note 1265 Data truncated for column 'c3' at row 1
|
|
INSERT INTO t1 VALUES('99999.99999','-99999.99999','9999999999',5);
|
|
INSERT INTO t1 VALUES ("0.0","0.0","0.0",6),("01.0","01.0","01.0",7);
|
|
INSERT INTO t1 VALUES ("-.1","-.1","-.1",8);
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 1
|
|
Note 1265 Data truncated for column 'c3' at row 1
|
|
INSERT INTO t1 VALUES ("+111111111.11","+111111111.11","+111111111.11",9);
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 1
|
|
Warning 1264 Out of range value for column 'c2' at row 1
|
|
Note 1265 Data truncated for column 'c3' at row 1
|
|
INSERT INTO t1 VALUES('1.0e+4','1.0e-5','1.0e+9',10);
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 0 8
|
|
0.00000 0.00000 0 6
|
|
1.00000 1.00000 1 7
|
|
100.00000 1001.00000 10000 4
|
|
100.05000 -100.05000 100119 1
|
|
10000.00000 0.00001 1000000000 10
|
|
11111.00009 -9999.99999 9999999 2
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000 3
|
|
99999.99999 99999.99999 111111111 9
|
|
UPDATE t1 SET c1='10001.00001' WHERE c2 > 100 ORDER BY c2 LIMIT 1;
|
|
SELECT c1,c2 FROM t1;
|
|
c1 c2
|
|
0.00000 -0.10000
|
|
0.00000 0.00000
|
|
1.00000 1.00000
|
|
100.05000 -100.05000
|
|
10000.00000 0.00001
|
|
10001.00001 1001.00000
|
|
11111.00009 -9999.99999
|
|
99999.99999 -99999.99999
|
|
99999.99999 99999.99999
|
|
99999.99999 99999.99999
|
|
UPDATE t1 SET c1=c2+c3 WHERE c3 < 10000;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 8
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 0 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -100.05000 100119 1
|
|
10000.00000 0.00001 1000000000 10
|
|
10001.00001 1001.00000 10000 4
|
|
11111.00009 -9999.99999 9999999 2
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000 3
|
|
99999.99999 99999.99999 111111111 9
|
|
UPDATE t1 SET c2=c2+100 WHERE c1 >=100 ORDER BY c1 LIMIT 4;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 0 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
10001.00001 1101.00000 10000 4
|
|
11111.00009 -9899.99999 9999999 2
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000 3
|
|
99999.99999 99999.99999 111111111 9
|
|
UPDATE t1 SET c2=NULL WHERE c4=4;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 0 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
10001.00001 NULL 10000 4
|
|
11111.00009 -9899.99999 9999999 2
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000 3
|
|
99999.99999 99999.99999 111111111 9
|
|
UPDATE t1 SET c2=1.0e+5 WHERE c2=NULL;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 0 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
10001.00001 NULL 10000 4
|
|
11111.00009 -9899.99999 9999999 2
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000 3
|
|
99999.99999 99999.99999 111111111 9
|
|
UPDATE t1 SET c1=-1.0e+2 WHERE c4=2;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 0 8
|
|
0.00000 -9899.99999 9999999 2
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
10001.00001 NULL 10000 4
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000 3
|
|
99999.99999 99999.99999 111111111 9
|
|
UPDATE t1 SET c1=1.0e+20 WHERE c4=2;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 0 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
10001.00001 NULL 10000 4
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -9899.99999 9999999 2
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000 3
|
|
99999.99999 99999.99999 111111111 9
|
|
UPDATE t1 SET c1=0.9999999999e+5 WHERE c3=1 AND c4=7;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 0 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
10001.00001 NULL 10000 4
|
|
99999.99999 -9899.99999 9999999 2
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 1.00000 1 7
|
|
99999.99999 99999.99999 1000000000 3
|
|
99999.99999 99999.99999 111111111 9
|
|
UPDATE t1 SET c1=1.2e+2,c2=c4+c2 WHERE c3=9999999999 OR c2=1.0e-5;
|
|
SELECT * FROM t1 WHERE c1=1.2e+2;
|
|
c1 c2 c3 c4
|
|
120.00000 -99994.99999 9999999999 5
|
|
UPDATE t1 SET c3=1234567890 WHERE c4 IN (4,5,6);
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 0 8
|
|
0.00000 0.00000 1234567890 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
10001.00001 NULL 1234567890 4
|
|
120.00000 -99994.99999 1234567890 5
|
|
99999.99999 -9899.99999 9999999 2
|
|
99999.99999 1.00000 1 7
|
|
99999.99999 99999.99999 1000000000 3
|
|
99999.99999 99999.99999 111111111 9
|
|
UPDATE t1 SET c1=99999.999999 WHERE c4=7;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 7
|
|
SELECT c1,c4 FROM t1;
|
|
c1 c4
|
|
0.00000 6
|
|
0.00000 8
|
|
100.05000 1
|
|
10000.00000 10
|
|
10001.00001 4
|
|
120.00000 5
|
|
99999.99999 2
|
|
99999.99999 3
|
|
99999.99999 7
|
|
99999.99999 9
|
|
UPDATE t1 SET c2=-9999.0099 WHERE c4=5;
|
|
SELECT c2,c4 FROM t1;
|
|
c2 c4
|
|
-0.05000 1
|
|
-0.10000 8
|
|
-9899.99999 2
|
|
-9999.00990 5
|
|
0.00000 6
|
|
1.00000 7
|
|
100.00001 10
|
|
99999.99999 3
|
|
99999.99999 9
|
|
NULL 4
|
|
SELECT c1 FROM t1 WHERE c1>1000;
|
|
c1
|
|
10000.00000
|
|
10001.00001
|
|
99999.99999
|
|
99999.99999
|
|
99999.99999
|
|
99999.99999
|
|
SET SQL_MODE=STRICT_ALL_TABLES;
|
|
UPDATE t1 SET c1=NULL WHERE c1>1000;
|
|
ERROR 23000: Column 'c1' cannot be null
|
|
UPDATE IGNORE t1 SET c1=NULL WHERE c1>1000;
|
|
Warnings:
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
SELECT c1 from t1 WHERE c1>1000;
|
|
c1
|
|
SET SQL_MODE=DEFAULT;
|
|
TRUNCATE t1;
|
|
INSERT INTO t1 VALUES ('11111.11111','-11111.11111','1111111111',1),('22222.22222','-22222.22222','2222222222',2),('33333.33333','-33333.33333','3333333333',3),('44444.44444','-44444.44444','4444444444',4),('55555.55555','-55555.55555','5555555555',5),('66666.66666','-66666.66666','6666666666',6),('77777.77777','-77777.77777','7777777777',7),('88888.88888','-88888.88888','8888888888',8),('99999.99999','-99999.99999','9999999999',9);
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22222.22222 -22222.22222 2222222222 2
|
|
33333.33333 -33333.33333 3333333333 3
|
|
44444.44444 -44444.44444 4444444444 4
|
|
55555.55555 -55555.55555 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
SELECT c1 FROM t1 WHERE c1>='22222.22222' AND c1<='55555.55555' ORDER BY c1;
|
|
c1
|
|
22222.22222
|
|
33333.33333
|
|
44444.44444
|
|
55555.55555
|
|
UPDATE t1 SET c1=c1-100, c2=c1+c2 WHERE c1>='22222.22222' AND c1<='55555.55555' ORDER BY c1;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22122.22222 -100.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
CREATE TABLE t2(c1 DECIMAL(10,5) NOT NULL, c2 DECIMAL, c3 INT, UNIQUE INDEX idx2(c1,c3));
|
|
CREATE TABLE t3(c1 DECIMAL(10,5) NOT NULL, c2 DECIMAL, c3 INT, UNIQUE INDEX idx3(c1,c3));
|
|
CREATE TABLE t4(c1 DECIMAL(10,5) NOT NULL, c2 DECIMAL, c3 INT, UNIQUE INDEX idx4(c1,c3));
|
|
INSERT INTO t2 VALUES ('11111.11111','1111111111',1),('22222.22222','2222222222',2),('33333.33333','3333333333',3);
|
|
INSERT INTO t3 VALUES ('44444.44444','4444444444',4),('55555.55555','5555555555',5),('66666.66666','6666666666',6);
|
|
INSERT INTO t4 VALUES ('77777.77777','7777777777',7),('88888.88888','8888888888',8),('99999.99999','9999999999',9);
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
11111.11111 1111111111 1
|
|
22222.22222 2222222222 2
|
|
33333.33333 3333333333 3
|
|
SELECT * FROM t3;
|
|
c1 c2 c3
|
|
44444.44444 4444444444 4
|
|
55555.55555 5555555555 5
|
|
66666.66666 6666666666 6
|
|
SELECT * FROM t4;
|
|
c1 c2 c3
|
|
77777.77777 7777777777 7
|
|
88888.88888 8888888888 8
|
|
99999.99999 9999999999 9
|
|
UPDATE t1,t2,t3,t4 SET t2.c1=t2.c1+t3.c1, t3.c2=t3.c2-t2.c1, t4.c1=t1.c1*t1.c3 WHERE t1.c2 >'1111111111' AND t4.c2 < '8888888888' ;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22122.22222 -100.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22122.22222 -100.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22122.22222 -100.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
TRUNCATE t2;
|
|
TRUNCATE t3;
|
|
INSERT INTO t2 VALUES ('11111.11111','1111111111',1),('22222.22222','2222222222',2),('33333.33333','3333333333',3);
|
|
INSERT INTO t3 VALUES ('44444.44444','4444444444',4),('55555.55555','5555555555',5),('66666.66666','6666666666',6);
|
|
UPDATE t2 SET t2.c1='44444.44444', t2.c3=4 WHERE t2.c1='22222.22222' AND t2.c3=2;
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
11111.11111 1111111111 1
|
|
33333.33333 3333333333 3
|
|
44444.44444 2222222222 4
|
|
update t2 set t2.c1='99999.99999' where c1 BETWEEN '11111' AND '44444';
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
44444.44444 2222222222 4
|
|
99999.99999 1111111111 1
|
|
99999.99999 3333333333 3
|
|
UPDATE t2 SET c1=c1-1,c2=c2-1 WHERE c1 IN ('44444.44444','99999.99999');
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
44443.44444 2222222221 4
|
|
99998.99999 1111111110 1
|
|
99998.99999 3333333332 3
|
|
DROP TABLE t2,t3;
|
|
CREATE TABLE t2(c1 DECIMAL(10,5) NOT NULL, c2 DECIMAL, c3 INT);
|
|
CREATE TABLE t3(c1 DECIMAL(10,5) NOT NULL, c2 DECIMAL, c3 INT, UNIQUE INDEX idx3(c1));
|
|
INSERT INTO t2 VALUES ('11111.11111','1111111111',1),('22222.22222','2222222222',2),('33333.33333','3333333333',3);
|
|
INSERT INTO t3 VALUES ('11111.11111','4444444444',1),('55555.55555','5555555555',2),('66666.66666','6666666666',3);
|
|
UPDATE t2,t3 SET t3.c1='22222.22222' WHERE t2.c1=t3.c1 AND t2.c3=t3.c3;
|
|
UPDATE t1 SET c3='asdf' WHERE c1='11111.11111';
|
|
Warnings:
|
|
Warning 1366 Incorrect decimal value: 'asdf' for column 'c3' at row 1
|
|
SELECT c3 FROM t1;
|
|
c3
|
|
0
|
|
2222222222
|
|
3333333333
|
|
4444444444
|
|
5555555555
|
|
6666666666
|
|
7777777777
|
|
8888888888
|
|
9999999999
|
|
UPDATE t1 SET c2="1 e 1" WHERE c4=2;
|
|
Warnings:
|
|
Warning 1265 Data truncated for column 'c2' at row 2
|
|
SELECT c2 FROM t1;
|
|
c2
|
|
-100.00000
|
|
-100.00000
|
|
-100.00000
|
|
-11111.11111
|
|
-66666.66666
|
|
-77777.77777
|
|
-88888.88888
|
|
-99999.99999
|
|
1.00000
|
|
UPDATE t4 SET c1=88888.88888,c3=8 WHERE c3=7;
|
|
ERROR 23000: Duplicate entry '88888.88888-8' for key 'idx4'
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 0 1
|
|
22122.22222 1.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
11111.11111 1111111111 1
|
|
22222.22222 2222222222 2
|
|
33333.33333 3333333333 3
|
|
SELECT * FROM t3;
|
|
c1 c2 c3
|
|
22222.22222 4444444444 1
|
|
55555.55555 5555555555 2
|
|
66666.66666 6666666666 3
|
|
SELECT * FROM t4;
|
|
c1 c2 c3
|
|
77777.77777 7777777777 7
|
|
88888.88888 8888888888 8
|
|
99999.99999 9999999999 9
|
|
DROP TABLES IF EXISTS t1,t2,t3,t4;
|
|
CREATE TABLE t1(c1 FLOAT(10,5) UNSIGNED NOT NULL, c2 FLOAT(10,5) SIGNED NULL, c3 FLOAT, c4 INT, UNIQUE INDEX idx(c1,c4));
|
|
INSERT INTO t1 VALUES('00100.05000','-00100.05000','00100119',1),('11111.00009','-9999.99999','9999999',2);
|
|
INSERT INTO t1 VALUES('1000000','10000000','1000000000.0001',3);
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 1
|
|
Warning 1264 Out of range value for column 'c2' at row 1
|
|
INSERT INTO t1 values('100.000001','1000.999999','9999.999999',4);
|
|
INSERT INTO t1 VALUES('99999.99999','-99999.99999','9999999999',5);
|
|
INSERT INTO t1 VALUES ("0.0","0.0","0.0",6),("01.0","01.0","01.0",7);
|
|
INSERT INTO t1 VALUES ("-.1","-.1","-.1",8);
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 1
|
|
INSERT INTO t1 VALUES ("+111111111.11","+111111111.11","+111111111.11",9);
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 1
|
|
Warning 1264 Out of range value for column 'c2' at row 1
|
|
INSERT INTO t1 VALUES('1.0e+4','1.0e-5','1.0e+9',10);
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
1.00000 1.00000 1 7
|
|
100.00000 1001.00000 10000 4
|
|
100.05000 -100.05000 100119 1
|
|
10000.00000 0.00001 1000000000 10
|
|
100000.00000 -100000.00000 10000000000 5
|
|
100000.00000 100000.00000 1000000000 3
|
|
100000.00000 100000.00000 111111000 9
|
|
11111.00000 -10000.00000 10000000 2
|
|
UPDATE t1 SET c1='10001.00001' WHERE c2 > 100 ORDER BY c2 LIMIT 1;
|
|
SELECT c1,c2 FROM t1;
|
|
c1 c2
|
|
0.00000 -0.10000
|
|
0.00000 0.00000
|
|
1.00000 1.00000
|
|
100.05000 -100.05000
|
|
10000.00000 0.00001
|
|
100000.00000 -100000.00000
|
|
100000.00000 100000.00000
|
|
100000.00000 100000.00000
|
|
10001.00000 1001.00000
|
|
11111.00000 -10000.00000
|
|
UPDATE t1 SET c1=c2+c3 WHERE c3 < 10000;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 8
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -100.05000 100119 1
|
|
10000.00000 0.00001 1000000000 10
|
|
100000.00000 -100000.00000 10000000000 5
|
|
100000.00000 100000.00000 1000000000 3
|
|
100000.00000 100000.00000 111111000 9
|
|
10001.00000 1001.00000 10000 4
|
|
11111.00000 -10000.00000 10000000 2
|
|
2.00000 1.00000 1 7
|
|
UPDATE t1 SET c2=c2+100 WHERE c1 >=100 ORDER BY c1 LIMIT 4;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
100000.00000 -100000.00000 10000000000 5
|
|
100000.00000 100000.00000 1000000000 3
|
|
100000.00000 100000.00000 111111000 9
|
|
10001.00000 1101.00000 10000 4
|
|
11111.00000 -9900.00000 10000000 2
|
|
2.00000 1.00000 1 7
|
|
UPDATE t1 SET c2=NULL WHERE c4=4;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
100000.00000 -100000.00000 10000000000 5
|
|
100000.00000 100000.00000 1000000000 3
|
|
100000.00000 100000.00000 111111000 9
|
|
10001.00000 NULL 10000 4
|
|
11111.00000 -9900.00000 10000000 2
|
|
2.00000 1.00000 1 7
|
|
UPDATE t1 SET c2=1.0e+5 WHERE c2=NULL;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
100000.00000 -100000.00000 10000000000 5
|
|
100000.00000 100000.00000 1000000000 3
|
|
100000.00000 100000.00000 111111000 9
|
|
10001.00000 NULL 10000 4
|
|
11111.00000 -9900.00000 10000000 2
|
|
2.00000 1.00000 1 7
|
|
UPDATE t1 SET c1=-1.0e+2 WHERE c4=2;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 -9900.00000 10000000 2
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
100000.00000 -100000.00000 10000000000 5
|
|
100000.00000 100000.00000 1000000000 3
|
|
100000.00000 100000.00000 111111000 9
|
|
10001.00000 NULL 10000 4
|
|
2.00000 1.00000 1 7
|
|
UPDATE t1 SET c1=1.0e+20 WHERE c4=2;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
100000.00000 -100000.00000 10000000000 5
|
|
100000.00000 -9900.00000 10000000 2
|
|
100000.00000 100000.00000 1000000000 3
|
|
100000.00000 100000.00000 111111000 9
|
|
10001.00000 NULL 10000 4
|
|
2.00000 1.00000 1 7
|
|
UPDATE t1 SET c1=0.9999999999e+5 WHERE c3=1 AND c4=7;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
100000.00000 -100000.00000 10000000000 5
|
|
100000.00000 -9900.00000 10000000 2
|
|
100000.00000 1.00000 1 7
|
|
100000.00000 100000.00000 1000000000 3
|
|
100000.00000 100000.00000 111111000 9
|
|
10001.00000 NULL 10000 4
|
|
UPDATE t1 SET c1=1.2e+2,c2=c4+c2 WHERE c3=9999999999 OR c2=1.0e-5;
|
|
SELECT * FROM t1 WHERE c1=1.2e+2;
|
|
c1 c2 c3 c4
|
|
UPDATE t1 SET c3=1234567890 WHERE c4 IN (4,5,6);
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 1234570000 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
100000.00000 -100000.00000 1234570000 5
|
|
100000.00000 -9900.00000 10000000 2
|
|
100000.00000 1.00000 1 7
|
|
100000.00000 100000.00000 1000000000 3
|
|
100000.00000 100000.00000 111111000 9
|
|
10001.00000 NULL 1234570000 4
|
|
UPDATE t1 SET c1=99999.999999 WHERE c4=7;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 7
|
|
SELECT c1,c4 FROM t1;
|
|
c1 c4
|
|
0.00000 6
|
|
0.00000 8
|
|
100.05000 1
|
|
10000.00000 10
|
|
100000.00000 2
|
|
100000.00000 3
|
|
100000.00000 5
|
|
100000.00000 7
|
|
100000.00000 9
|
|
10001.00000 4
|
|
UPDATE t1 SET c2=-9999.0099 WHERE c4=5;
|
|
SELECT c2,c4 FROM t1;
|
|
c2 c4
|
|
-0.05000 1
|
|
-0.10000 8
|
|
-9900.00000 2
|
|
-9999.00977 5
|
|
0.00000 6
|
|
1.00000 7
|
|
100.00001 10
|
|
100000.00000 3
|
|
100000.00000 9
|
|
NULL 4
|
|
SELECT c1 FROM t1 WHERE c1>1000;
|
|
c1
|
|
10000.00000
|
|
10001.00000
|
|
100000.00000
|
|
100000.00000
|
|
100000.00000
|
|
100000.00000
|
|
100000.00000
|
|
SET SQL_MODE=STRICT_ALL_TABLES;
|
|
UPDATE t1 SET c1=NULL WHERE c1>1000;
|
|
ERROR 23000: Column 'c1' cannot be null
|
|
UPDATE IGNORE t1 SET c1=NULL WHERE c1>1000;
|
|
Warnings:
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
SELECT c1 from t1 WHERE c1>1000;
|
|
c1
|
|
SET SQL_MODE=DEFAULT;
|
|
TRUNCATE t1;
|
|
INSERT INTO t1 VALUES ('11111.11111','-11111.11111','1111111111',1),('22222.22222','-22222.22222','2222222222',2),('33333.33333','-33333.33333','3333333333',3),('44444.44444','-44444.44444','4444444444',4),('55555.55555','-55555.55555','5555555555',5),('66666.66666','-66666.66666','6666666666',6),('77777.77777','-77777.77777','7777777777',7),('88888.88888','-88888.88888','8888888888',8),('99999.99999','-99999.99999','9999999999',9);
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
100000.00000 -100000.00000 10000000000 9
|
|
11111.11133 -11111.11133 1111110000 1
|
|
22222.22266 -22222.22266 2222220000 2
|
|
33333.33203 -33333.33203 3333330000 3
|
|
44444.44531 -44444.44531 4444440000 4
|
|
55555.55469 -55555.55469 5555560000 5
|
|
66666.66406 -66666.66406 6666670000 6
|
|
77777.78125 -77777.78125 7777780000 7
|
|
88888.89062 -88888.89062 8888890000 8
|
|
SELECT c1 FROM t1 WHERE c1>='22222.22222' AND c1<='55555.55555' ORDER BY c1;
|
|
c1
|
|
22222.22266
|
|
33333.33203
|
|
44444.44531
|
|
55555.55469
|
|
UPDATE t1 SET c1=c1-100, c2=c1+c2 WHERE c1>='22222.22222' AND c1<='55555.55555' ORDER BY c1;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
100000.00000 -100000.00000 10000000000 9
|
|
11111.11133 -11111.11133 1111110000 1
|
|
22122.22266 -100.00000 2222220000 2
|
|
33233.33203 -100.00000 3333330000 3
|
|
44344.44531 -100.00000 4444440000 4
|
|
55455.55469 -100.00000 5555560000 5
|
|
66666.66406 -66666.66406 6666670000 6
|
|
77777.78125 -77777.78125 7777780000 7
|
|
88888.89062 -88888.89062 8888890000 8
|
|
CREATE TABLE t2(c1 FLOAT(10,5) NOT NULL, c2 FLOAT, c3 INT, UNIQUE INDEX idx2(c1,c3));
|
|
CREATE TABLE t3(c1 FLOAT(10,5) NOT NULL, c2 FLOAT, c3 INT, UNIQUE INDEX idx3(c1,c3));
|
|
CREATE TABLE t4(c1 FLOAT(10,5) NOT NULL, c2 FLOAT, c3 INT, UNIQUE INDEX idx4(c1,c3));
|
|
INSERT INTO t2 VALUES ('11111.11111','1111111111',1),('22222.22222','2222222222',2),('33333.33333','3333333333',3);
|
|
INSERT INTO t3 VALUES ('44444.44444','4444444444',4),('55555.55555','5555555555',5),('66666.66666','6666666666',6);
|
|
INSERT INTO t4 VALUES ('77777.77777','7777777777',7),('88888.88888','8888888888',8),('99999.99999','9999999999',9);
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
11111.11133 1111110000 1
|
|
22222.22266 2222220000 2
|
|
33333.33203 3333330000 3
|
|
SELECT * FROM t3;
|
|
c1 c2 c3
|
|
44444.44531 4444440000 4
|
|
55555.55469 5555560000 5
|
|
66666.66406 6666670000 6
|
|
SELECT * FROM t4;
|
|
c1 c2 c3
|
|
100000.00000 10000000000 9
|
|
77777.78125 7777780000 7
|
|
88888.89062 8888890000 8
|
|
UPDATE t1,t2,t3,t4 SET t2.c1=t2.c1+t3.c1, t3.c2=t3.c2-t2.c1, t4.c1=t1.c1*t1.c3 WHERE t1.c2 >'1111111111' AND t4.c2 < '8888888888' ;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
100000.00000 -100000.00000 10000000000 9
|
|
11111.11133 -11111.11133 1111110000 1
|
|
22122.22266 -100.00000 2222220000 2
|
|
33233.33203 -100.00000 3333330000 3
|
|
44344.44531 -100.00000 4444440000 4
|
|
55455.55469 -100.00000 5555560000 5
|
|
66666.66406 -66666.66406 6666670000 6
|
|
77777.78125 -77777.78125 7777780000 7
|
|
88888.89062 -88888.89062 8888890000 8
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
100000.00000 -100000.00000 10000000000 9
|
|
11111.11133 -11111.11133 1111110000 1
|
|
22122.22266 -100.00000 2222220000 2
|
|
33233.33203 -100.00000 3333330000 3
|
|
44344.44531 -100.00000 4444440000 4
|
|
55455.55469 -100.00000 5555560000 5
|
|
66666.66406 -66666.66406 6666670000 6
|
|
77777.78125 -77777.78125 7777780000 7
|
|
88888.89062 -88888.89062 8888890000 8
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
100000.00000 -100000.00000 10000000000 9
|
|
11111.11133 -11111.11133 1111110000 1
|
|
22122.22266 -100.00000 2222220000 2
|
|
33233.33203 -100.00000 3333330000 3
|
|
44344.44531 -100.00000 4444440000 4
|
|
55455.55469 -100.00000 5555560000 5
|
|
66666.66406 -66666.66406 6666670000 6
|
|
77777.78125 -77777.78125 7777780000 7
|
|
88888.89062 -88888.89062 8888890000 8
|
|
TRUNCATE t2;
|
|
TRUNCATE t3;
|
|
INSERT INTO t2 VALUES ('11111.11111','1111111111',1),('22222.22222','2222222222',2),('33333.33333','3333333333',3);
|
|
INSERT INTO t3 VALUES ('44444.44444','4444444444',4),('55555.55555','5555555555',5),('66666.66666','6666666666',6);
|
|
UPDATE t2 SET t2.c1='44444.44444', t2.c3=4 WHERE t2.c1='22222.22222' AND t2.c3=2;
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
11111.11133 1111110000 1
|
|
22222.22266 2222220000 2
|
|
33333.33203 3333330000 3
|
|
update t2 set t2.c1='99999.99999' where c1 BETWEEN '11111' AND '44444';
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
100000.00000 1111110000 1
|
|
100000.00000 2222220000 2
|
|
100000.00000 3333330000 3
|
|
UPDATE t2 SET c1=c1-1,c2=c2-1 WHERE c1 IN ('44444.44444','99999.99999');
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
100000.00000 1111110000 1
|
|
100000.00000 2222220000 2
|
|
100000.00000 3333330000 3
|
|
DROP TABLE t2,t3;
|
|
CREATE TABLE t2(c1 FLOAT(10,5) NOT NULL, c2 FLOAT, c3 INT);
|
|
CREATE TABLE t3(c1 FLOAT(10,5) NOT NULL, c2 FLOAT, c3 INT, UNIQUE INDEX idx3(c1));
|
|
INSERT INTO t2 VALUES ('11111.11111','1111111111',1),('22222.22222','2222222222',2),('33333.33333','3333333333',3);
|
|
INSERT INTO t3 VALUES ('11111.11111','4444444444',1),('55555.55555','5555555555',2),('66666.66666','6666666666',3);
|
|
UPDATE t2,t3 SET t3.c1='22222.22222' WHERE t2.c1=t3.c1 AND t2.c3=t3.c3;
|
|
UPDATE t1 SET c3='asdf' WHERE c1='11111.11111';
|
|
SELECT c3 FROM t1;
|
|
c3
|
|
10000000000
|
|
1111110000
|
|
2222220000
|
|
3333330000
|
|
4444440000
|
|
5555560000
|
|
6666670000
|
|
7777780000
|
|
8888890000
|
|
UPDATE t1 SET c2="1 e 1" WHERE c4=2;
|
|
Warnings:
|
|
Warning 1265 Data truncated for column 'c2' at row 2
|
|
SELECT c2 FROM t1;
|
|
c2
|
|
-100.00000
|
|
-100.00000
|
|
-100.00000
|
|
-100000.00000
|
|
-11111.11133
|
|
-66666.66406
|
|
-77777.78125
|
|
-88888.89062
|
|
1.00000
|
|
UPDATE t4 SET c1=88888.88888,c3=8 WHERE c3=7;
|
|
ERROR 23000: Duplicate entry '88888.89062-8' for key 'idx4'
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
100000.00000 -100000.00000 10000000000 9
|
|
11111.11133 -11111.11133 1111110000 1
|
|
22122.22266 1.00000 2222220000 2
|
|
33233.33203 -100.00000 3333330000 3
|
|
44344.44531 -100.00000 4444440000 4
|
|
55455.55469 -100.00000 5555560000 5
|
|
66666.66406 -66666.66406 6666670000 6
|
|
77777.78125 -77777.78125 7777780000 7
|
|
88888.89062 -88888.89062 8888890000 8
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
11111.11133 1111110000 1
|
|
22222.22266 2222220000 2
|
|
33333.33203 3333330000 3
|
|
SELECT * FROM t3;
|
|
c1 c2 c3
|
|
22222.22266 4444440000 1
|
|
55555.55469 5555560000 2
|
|
66666.66406 6666670000 3
|
|
SELECT * FROM t4;
|
|
c1 c2 c3
|
|
100000.00000 10000000000 9
|
|
77777.78125 7777780000 7
|
|
88888.89062 8888890000 8
|
|
DROP TABLES IF EXISTS t1,t2,t3,t4;
|
|
CREATE TABLE t1(c1 DOUBLE(10,5) UNSIGNED NOT NULL, c2 DOUBLE(10,5) SIGNED NULL, c3 DOUBLE, c4 INT, UNIQUE INDEX idx(c1,c4));
|
|
INSERT INTO t1 VALUES('00100.05000','-00100.05000','00100119',1),('11111.00009','-9999.99999','9999999',2);
|
|
INSERT INTO t1 VALUES('1000000','10000000','1000000000.0001',3);
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 1
|
|
Warning 1264 Out of range value for column 'c2' at row 1
|
|
INSERT INTO t1 values('100.000001','1000.999999','9999.999999',4);
|
|
INSERT INTO t1 VALUES('99999.99999','-99999.99999','9999999999',5);
|
|
INSERT INTO t1 VALUES ("0.0","0.0","0.0",6),("01.0","01.0","01.0",7);
|
|
INSERT INTO t1 VALUES ("-.1","-.1","-.1",8);
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 1
|
|
INSERT INTO t1 VALUES ("+111111111.11","+111111111.11","+111111111.11",9);
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 1
|
|
Warning 1264 Out of range value for column 'c2' at row 1
|
|
INSERT INTO t1 VALUES('1.0e+4','1.0e-5','1.0e+9',10);
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
1.00000 1.00000 1 7
|
|
100.00000 1001.00000 9999.999999 4
|
|
100.05000 -100.05000 100119 1
|
|
10000.00000 0.00001 1000000000 10
|
|
11111.00009 -9999.99999 9999999 2
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000.0001 3
|
|
99999.99999 99999.99999 111111111.11 9
|
|
UPDATE t1 SET c1='10001.00001' WHERE c2 > 100 ORDER BY c2 LIMIT 1;
|
|
SELECT c1,c2 FROM t1;
|
|
c1 c2
|
|
0.00000 -0.10000
|
|
0.00000 0.00000
|
|
1.00000 1.00000
|
|
100.05000 -100.05000
|
|
10000.00000 0.00001
|
|
10001.00001 1001.00000
|
|
11111.00009 -9999.99999
|
|
99999.99999 -99999.99999
|
|
99999.99999 99999.99999
|
|
99999.99999 99999.99999
|
|
UPDATE t1 SET c1=c2+c3 WHERE c3 < 10000;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 8
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -100.05000 100119 1
|
|
10000.00000 0.00001 1000000000 10
|
|
11001.00000 1001.00000 9999.999999 4
|
|
11111.00009 -9999.99999 9999999 2
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000.0001 3
|
|
99999.99999 99999.99999 111111111.11 9
|
|
UPDATE t1 SET c2=c2+100 WHERE c1 >=100 ORDER BY c1 LIMIT 4;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
11001.00000 1101.00000 9999.999999 4
|
|
11111.00009 -9899.99999 9999999 2
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000.0001 3
|
|
99999.99999 99999.99999 111111111.11 9
|
|
UPDATE t1 SET c2=NULL WHERE c4=4;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
11001.00000 NULL 9999.999999 4
|
|
11111.00009 -9899.99999 9999999 2
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000.0001 3
|
|
99999.99999 99999.99999 111111111.11 9
|
|
UPDATE t1 SET c2=1.0e+5 WHERE c2=NULL;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
11001.00000 NULL 9999.999999 4
|
|
11111.00009 -9899.99999 9999999 2
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000.0001 3
|
|
99999.99999 99999.99999 111111111.11 9
|
|
UPDATE t1 SET c1=-1.0e+2 WHERE c4=2;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 -9899.99999 9999999 2
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
11001.00000 NULL 9999.999999 4
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000.0001 3
|
|
99999.99999 99999.99999 111111111.11 9
|
|
UPDATE t1 SET c1=1.0e+20 WHERE c4=2;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Warning 1264 Out of range value for column 'c1' at row 2
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
11001.00000 NULL 9999.999999 4
|
|
2.00000 1.00000 1 7
|
|
99999.99999 -9899.99999 9999999 2
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 99999.99999 1000000000.0001 3
|
|
99999.99999 99999.99999 111111111.11 9
|
|
UPDATE t1 SET c1=0.9999999999e+5 WHERE c3=1 AND c4=7;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 0 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
11001.00000 NULL 9999.999999 4
|
|
99999.99999 -9899.99999 9999999 2
|
|
99999.99999 -99999.99999 9999999999 5
|
|
99999.99999 1.00000 1 7
|
|
99999.99999 99999.99999 1000000000.0001 3
|
|
99999.99999 99999.99999 111111111.11 9
|
|
UPDATE t1 SET c1=1.2e+2,c2=c4+c2 WHERE c3=9999999999 OR c2=1.0e-5;
|
|
SELECT * FROM t1 WHERE c1=1.2e+2;
|
|
c1 c2 c3 c4
|
|
120.00000 -99994.99999 9999999999 5
|
|
UPDATE t1 SET c3=1234567890 WHERE c4 IN (4,5,6);
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
0.00000 -0.10000 -0.1 8
|
|
0.00000 0.00000 1234567890 6
|
|
100.05000 -0.05000 100119 1
|
|
10000.00000 100.00001 1000000000 10
|
|
11001.00000 NULL 1234567890 4
|
|
120.00000 -99994.99999 1234567890 5
|
|
99999.99999 -9899.99999 9999999 2
|
|
99999.99999 1.00000 1 7
|
|
99999.99999 99999.99999 1000000000.0001 3
|
|
99999.99999 99999.99999 111111111.11 9
|
|
UPDATE t1 SET c1=99999.999999 WHERE c4=7;
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'c1' at row 7
|
|
SELECT c1,c4 FROM t1;
|
|
c1 c4
|
|
0.00000 6
|
|
0.00000 8
|
|
100.05000 1
|
|
10000.00000 10
|
|
11001.00000 4
|
|
120.00000 5
|
|
99999.99999 2
|
|
99999.99999 3
|
|
99999.99999 7
|
|
99999.99999 9
|
|
UPDATE t1 SET c2=-9999.0099 WHERE c4=5;
|
|
SELECT c2,c4 FROM t1;
|
|
c2 c4
|
|
-0.05000 1
|
|
-0.10000 8
|
|
-9899.99999 2
|
|
-9999.00990 5
|
|
0.00000 6
|
|
1.00000 7
|
|
100.00001 10
|
|
99999.99999 3
|
|
99999.99999 9
|
|
NULL 4
|
|
SELECT c1 FROM t1 WHERE c1>1000;
|
|
c1
|
|
10000.00000
|
|
11001.00000
|
|
99999.99999
|
|
99999.99999
|
|
99999.99999
|
|
99999.99999
|
|
SET SQL_MODE=STRICT_ALL_TABLES;
|
|
UPDATE t1 SET c1=NULL WHERE c1>1000;
|
|
ERROR 23000: Column 'c1' cannot be null
|
|
UPDATE IGNORE t1 SET c1=NULL WHERE c1>1000;
|
|
Warnings:
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
Warning 1048 Column 'c1' cannot be null
|
|
SELECT c1 from t1 WHERE c1>1000;
|
|
c1
|
|
SET SQL_MODE=DEFAULT;
|
|
TRUNCATE t1;
|
|
INSERT INTO t1 VALUES ('11111.11111','-11111.11111','1111111111',1),('22222.22222','-22222.22222','2222222222',2),('33333.33333','-33333.33333','3333333333',3),('44444.44444','-44444.44444','4444444444',4),('55555.55555','-55555.55555','5555555555',5),('66666.66666','-66666.66666','6666666666',6),('77777.77777','-77777.77777','7777777777',7),('88888.88888','-88888.88888','8888888888',8),('99999.99999','-99999.99999','9999999999',9);
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22222.22222 -22222.22222 2222222222 2
|
|
33333.33333 -33333.33333 3333333333 3
|
|
44444.44444 -44444.44444 4444444444 4
|
|
55555.55555 -55555.55555 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
SELECT c1 FROM t1 WHERE c1>='22222.22222' AND c1<='55555.55555' ORDER BY c1;
|
|
c1
|
|
22222.22222
|
|
33333.33333
|
|
44444.44444
|
|
55555.55555
|
|
UPDATE t1 SET c1=c1-100, c2=c1+c2 WHERE c1>='22222.22222' AND c1<='55555.55555' ORDER BY c1;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22122.22222 -100.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
CREATE TABLE t2(c1 DOUBLE(10,5) NOT NULL, c2 DOUBLE, c3 INT, UNIQUE INDEX idx2(c1,c3));
|
|
CREATE TABLE t3(c1 DOUBLE(10,5) NOT NULL, c2 DOUBLE, c3 INT, UNIQUE INDEX idx3(c1,c3));
|
|
CREATE TABLE t4(c1 DOUBLE(10,5) NOT NULL, c2 DOUBLE, c3 INT, UNIQUE INDEX idx4(c1,c3));
|
|
INSERT INTO t2 VALUES ('11111.11111','1111111111',1),('22222.22222','2222222222',2),('33333.33333','3333333333',3);
|
|
INSERT INTO t3 VALUES ('44444.44444','4444444444',4),('55555.55555','5555555555',5),('66666.66666','6666666666',6);
|
|
INSERT INTO t4 VALUES ('77777.77777','7777777777',7),('88888.88888','8888888888',8),('99999.99999','9999999999',9);
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
11111.11111 1111111111 1
|
|
22222.22222 2222222222 2
|
|
33333.33333 3333333333 3
|
|
SELECT * FROM t3;
|
|
c1 c2 c3
|
|
44444.44444 4444444444 4
|
|
55555.55555 5555555555 5
|
|
66666.66666 6666666666 6
|
|
SELECT * FROM t4;
|
|
c1 c2 c3
|
|
77777.77777 7777777777 7
|
|
88888.88888 8888888888 8
|
|
99999.99999 9999999999 9
|
|
UPDATE t1,t2,t3,t4 SET t2.c1=t2.c1+t3.c1, t3.c2=t3.c2-t2.c1, t4.c1=t1.c1*t1.c3 WHERE t1.c2 >'1111111111' AND t4.c2 < '8888888888' ;
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22122.22222 -100.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22122.22222 -100.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 1111111111 1
|
|
22122.22222 -100.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
TRUNCATE t2;
|
|
TRUNCATE t3;
|
|
INSERT INTO t2 VALUES ('11111.11111','1111111111',1),('22222.22222','2222222222',2),('33333.33333','3333333333',3);
|
|
INSERT INTO t3 VALUES ('44444.44444','4444444444',4),('55555.55555','5555555555',5),('66666.66666','6666666666',6);
|
|
UPDATE t2 SET t2.c1='44444.44444', t2.c3=4 WHERE t2.c1='22222.22222' AND t2.c3=2;
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
11111.11111 1111111111 1
|
|
33333.33333 3333333333 3
|
|
44444.44444 2222222222 4
|
|
update t2 set t2.c1='99999.99999' where c1 BETWEEN '11111' AND '44444';
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
44444.44444 2222222222 4
|
|
99999.99999 1111111111 1
|
|
99999.99999 3333333333 3
|
|
UPDATE t2 SET c1=c1-1,c2=c2-1 WHERE c1 IN ('44444.44444','99999.99999');
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
44443.44444 2222222221 4
|
|
99998.99999 1111111110 1
|
|
99998.99999 3333333332 3
|
|
DROP TABLE t2,t3;
|
|
CREATE TABLE t2(c1 DOUBLE(10,5) NOT NULL, c2 DOUBLE, c3 INT);
|
|
CREATE TABLE t3(c1 DOUBLE(10,5) NOT NULL, c2 DOUBLE, c3 INT, UNIQUE INDEX idx3(c1));
|
|
INSERT INTO t2 VALUES ('11111.11111','1111111111',1),('22222.22222','2222222222',2),('33333.33333','3333333333',3);
|
|
INSERT INTO t3 VALUES ('11111.11111','4444444444',1),('55555.55555','5555555555',2),('66666.66666','6666666666',3);
|
|
UPDATE t2,t3 SET t3.c1='22222.22222' WHERE t2.c1=t3.c1 AND t2.c3=t3.c3;
|
|
UPDATE t1 SET c3='asdf' WHERE c1='11111.11111';
|
|
Warnings:
|
|
Warning 1366 Incorrect double value: 'asdf' for column 'c3' at row 1
|
|
SELECT c3 FROM t1;
|
|
c3
|
|
0
|
|
2222222222
|
|
3333333333
|
|
4444444444
|
|
5555555555
|
|
6666666666
|
|
7777777777
|
|
8888888888
|
|
9999999999
|
|
UPDATE t1 SET c2="1 e 1" WHERE c4=2;
|
|
Warnings:
|
|
Warning 1265 Data truncated for column 'c2' at row 2
|
|
SELECT c2 FROM t1;
|
|
c2
|
|
-100.00000
|
|
-100.00000
|
|
-100.00000
|
|
-11111.11111
|
|
-66666.66666
|
|
-77777.77777
|
|
-88888.88888
|
|
-99999.99999
|
|
1.00000
|
|
UPDATE t4 SET c1=88888.88888,c3=8 WHERE c3=7;
|
|
ERROR 23000: Duplicate entry '88888.88888-8' for key 'idx4'
|
|
SELECT * FROM t1;
|
|
c1 c2 c3 c4
|
|
11111.11111 -11111.11111 0 1
|
|
22122.22222 1.00000 2222222222 2
|
|
33233.33333 -100.00000 3333333333 3
|
|
44344.44444 -100.00000 4444444444 4
|
|
55455.55555 -100.00000 5555555555 5
|
|
66666.66666 -66666.66666 6666666666 6
|
|
77777.77777 -77777.77777 7777777777 7
|
|
88888.88888 -88888.88888 8888888888 8
|
|
99999.99999 -99999.99999 9999999999 9
|
|
SELECT * FROM t2;
|
|
c1 c2 c3
|
|
11111.11111 1111111111 1
|
|
22222.22222 2222222222 2
|
|
33333.33333 3333333333 3
|
|
SELECT * FROM t3;
|
|
c1 c2 c3
|
|
22222.22222 4444444444 1
|
|
55555.55555 5555555555 2
|
|
66666.66666 6666666666 3
|
|
SELECT * FROM t4;
|
|
c1 c2 c3
|
|
77777.77777 7777777777 7
|
|
88888.88888 8888888888 8
|
|
99999.99999 9999999999 9
|
|
DROP TABLES IF EXISTS t1,t2,t3,t4;
|