1
drop table if exists t1,t2;
2
SELECT 10,10.0,10.,.1e+2,100.0e-1;
3
10 10.0 10. .1e+2 100.0e-1
5
SELECT 6e-16, -6e-16, --6e-16, -6e-16+1.000000;
6
6e-16 -6e-16 --6e-16 -6e-16+1.000000
7
6e-16 -6e-16 6e-16 0.999999999999999
8
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
9
1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1
10
10 10 10 10 10 10 0.1 0.1 0.1
11
SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01;
12
0.001e+1 0.001e-1 -0.001e+01 -0.001e-01
13
0.01 0.0001 -0.01 -0.0001
14
SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0;
15
123.23E+02 -123.23E-02 "123.23E+02"+0.0 "-123.23E-02"+0.0
16
12323 -1.2323 12323 -1.2323
17
SELECT 2147483647E+02,21474836.47E+06;
18
2147483647E+02 21474836.47E+06
19
214748364700 21474836470000
20
create table t1 (f1 float primary key,f2 float);
22
Field Type Null Default Default_is_NULL On_Update
25
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
26
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
30
0.000000000000001 0.000000000000001
31
0.0000000001 0.0000000001
35
10000000000 10000000000
45
create table t1 (datum double primary key);
46
insert into t1 values (0.5),(1.0),(1.5),(2.0),(2.5);
54
select * from t1 where datum < 1.5;
58
select * from t1 where datum > 1.5;
62
select * from t1 where datum = 1.5;
66
create table t1 (c1 double primary key, c2 varchar(20));
67
insert t1 values (121,"16");
68
select c1 + c1 * (c2 / 100) as col from t1;
71
create temporary table t2 engine=myisam as select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
74
140.36 121.00000 121 0.000000347850542618522
77
t2 CREATE TEMPORARY TABLE `t2` (
78
`col1` DOUBLE DEFAULT NULL,
79
`col2` DOUBLE(22,5) NOT NULL,
80
`col3` DOUBLE NOT NULL,
81
`col4` DOUBLE DEFAULT NULL
82
) ENGINE=DEFAULT COLLATE = utf8_general_ci
84
create table t1 (a float primary key);
85
insert into t1 values (1);
86
select max(a),min(a),avg(a) from t1;
90
create table t1 (c20 char primary key);
91
insert into t1 values (5000.0);
92
ERROR 22001: Data too long for column 'c20' at row 1
93
insert into t1 values (0.5e4);
94
ERROR 22001: Data too long for column 'c20' at row 1
96
create table t1 (d1 double primary key, d2 double);
97
insert into t1 set d1 = -1.0;
98
update t1 set d2 = d1;
103
create table t1 (f float(4,3) primary key);
104
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
105
ERROR 22003: Out of range value for column 'f' at row 1
108
drop table if exists t1;
109
create table t1 (f double(4,3) primary key);
110
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
111
ERROR 22003: Out of range value for column 'f' at row 1
114
drop table if exists t1;
115
create table t1 (c char(20) primary key);
116
insert into t1 values (5e-28);
121
create table t1 (c char(6) primary key);
122
insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
130
CREATE TEMPORARY TABLE t1 (
132
recdesc varchar(50) NOT NULL,
135
INSERT INTO t1 VALUES (108, 'Has 108 as key');
136
INSERT INTO t1 VALUES (109, 'Has 109 as key');
137
select * from t1 where reckey=108;
140
select * from t1 where reckey=1.08E2;
143
select * from t1 where reckey=109;
146
select * from t1 where reckey=1.09E2;
150
create table t1 (d double primary key);
151
create table t2 (d double primary key);
152
insert into t1 values ("100000000.0");
153
insert into t2 values ("1.23456780");
154
create table t3 (d double primary key) as select t2.d from t2 union select t1.d from t1;
159
show create table t3;
161
t3 CREATE TABLE `t3` (
163
PRIMARY KEY (`d`) USING BTREE
164
) ENGINE=DEFAULT COLLATE = utf8_general_ci
165
drop table t1, t2, t3;
166
create temporary table t1 engine=myisam as select 105213674794682365.00 + 0.0 x;
170
Field Type Null Default Default_is_NULL On_Update
173
create temporary table t1 engine=myisam as select 0.0 x;
175
Field Type Null Default Default_is_NULL On_Update
177
create temporary table t2 engine=myisam as select 105213674794682365.00 y;
179
Field Type Null Default Default_is_NULL On_Update
181
create temporary table t3 engine=myisam as select x+y a from t1,t2;
185
Field Type Null Default Default_is_NULL On_Update
188
select 1e-308, 1.00000001e-300, 100000000e-300;
189
1e-308 1.00000001e-300 100000000e-300
190
1e-308 1.00000001e-300 1e-292
194
create table t1(a int, b double(8, 2), pk int auto_increment primary key);
195
insert into t1 (a,b) values
196
(1, 28.50), (1, 121.85), (1, 157.23), (1, 1351.00), (1, -1965.35), (1, 81.75),
197
(1, 217.08), (1, 7.94), (4, 96.07), (4, 6404.65), (4, -6500.72), (2, 100.00),
198
(5, 5.00), (5, -2104.80), (5, 2033.80), (5, 0.07), (5, 65.93),
199
(3, -4986.24), (3, 5.00), (3, 4857.34), (3, 123.74), (3, 0.16),
200
(6, -1695.31), (6, 1003.77), (6, 499.72), (6, 191.82);
201
explain select sum(b) s from t1 group by a;
202
id select_type table type possible_keys key key_len ref rows Extra
203
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using temporary; Using filesort
204
select sum(b) s from t1 group by a;
212
select sum(b) s from t1 group by a having s <> 0;
215
select sum(b) s from t1 group by a having s <> 0 order by s;
218
select sum(b) s from t1 group by a having s <=> 0;
225
select sum(b) s from t1 group by a having s <=> 0 order by s;
232
alter table t1 add key (a, b);
233
explain select sum(b) s from t1 group by a;
234
id select_type table type possible_keys key key_len ref rows Extra
235
1 SIMPLE t1 index NULL a 14 NULL # Using index
236
select sum(b) s from t1 group by a;
244
select sum(b) s from t1 group by a having s <> 0;
247
select sum(b) s from t1 group by a having s <> 0 order by s;
250
select sum(b) s from t1 group by a having s <=> 0;
257
select sum(b) s from t1 group by a having s <=> 0 order by s;
266
create table t1 (s1 float(0,2));
267
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
268
create table t1 (s1 float(1,2));
269
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
270
create table t1 (f1 double(200, 0) primary key);
271
insert into t1 values (1e199), (-1e199);
272
insert into t1 values (1e200), (-1e200);
273
insert into t1 values (2e200), (-2e200);
274
ERROR 22003: Out of range value for column 'f1' at row 1
275
select f1 + 0e0 from t1;
282
create table t1 (f1 float(30, 0) primary key);
283
insert into t1 values (1e29), (-1e29);
284
insert into t1 values (1e30), (-1e30);
285
insert into t1 values (2e30), (-2e30);
286
ERROR 22003: Out of range value for column 'f1' at row 1
287
select f1 + 0e0 from t1;
294
create table t1 (c char(6) primary key);
295
insert into t1 values (2e6),(2e-5);
301
CREATE TABLE d1 (d DOUBLE primary key);
302
INSERT INTO d1 VALUES (1.7976931348623157E+308);
306
INSERT INTO d1 VALUES (1.79769313486232e+308);
307
ERROR 22007: Illegal double '1.79769313486232e+308' value found during parsing
312
create table t1 (a char(20) primary key);
313
insert into t1 values (1.225e-05);