--disable_query_log set @@session.explicit_defaults_for_timestamp=off; --enable_query_log --echo ================ expression ceil ================ --disable_warnings drop table if exists test; --enable_warnings create table test (pk int primary key, c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 mediumint unsigned, c9 int unsigned, c10 bigint unsigned, c11 float, c12 double, c13 float unsigned, c14 double unsigned, c15 decimal(20, 10), c16 decimal(20, 10) unsigned, c17 datetime(6), c18 timestamp(6) default "2012-01-01 12:00:00", c19 date, c20 time, c21 year , c22 varchar(10000), c23 char(255), c24 varbinary(10000), c25 binary(255)); insert into test values (0, -128, 2, -3, 4, -5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '22.5324', '-23.436456', '-24', '25'); insert into test values (1, 1, -2, 3, -4, 5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '-22.999999', '23.00001', '24.9999', '-25.00001'); insert into test values (2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); select ceil(pk), ceil(c1), ceil(c2), ceil(c3), ceil(c4), ceil(c5), ceil(c6), ceil(c7), ceil(c8), ceil(c9), ceil(c10), ceil(c11), ceil(c12), ceil(c13), ceil(c14), ceil(c15), ceil(c16), ceil(c22), ceil(c23), ceil(c24), ceil(c25) from test; --disable_warnings drop table if exists test; --enable_warnings select ceil(3.1415926); select ceil(-3.1415926); select ceil(0.00); select ceil(-0.0); select ceil(0.123456789); select ceil(-0.123456789); select ceil(123456789.123456789); select ceil(-99999999.999999999); select ceil(999999999.123456789); select ceil(-999999999.123456789); select ceil(-123456789123456789123456789.123456789); select ceil(123456789123456789123456789123456789123456789123456789.123456789); select ceil(-123456789123456789123456789123456789123456789123456789.123456789); select ceil(123456789123456789123456789.123456789123456789123456789123456789); select ceil(-123456789123456789123456789.123456789123456789123456789123456789); select ceil(-123456789123456789123456789.123456789); select ceil(999999999999999999999999999999999999999999999.499999999); select ceil(999999999999999999999999999999999999999999999.500000001); select ceil(99999999999999999999999999999999999999999999.399999999); select ceil(-99999999999999999999999999999999999999999999.399999999); select ceil(-99999999999999999999999999999999999999999999.399999999); select ceil(999999999999999999999999999999999999999999999211111.399999999); select ceil(-999999999999999999999999999999999999999999999211111.399999999); select ceil(-999999999999999999999999999999999999999999999511111.399999999); select ceil(-999999999999999999999999999999999999999999999499999.399999999); select ceil(-1); select ceil(-161); select ceil(null); select ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702111111111111111111"); select ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702catters billet chloroplast's'"); --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1(id int,consumer char(20), price varchar(20),sal int,datetime1 DATE,datetime2 bigint); INSERT INTO t1 VALUES(1,'苹果','6500',5000,'2020-09-22 12:11:59',20200923121200); INSERT INTO t1 VALUES(2,'小米','3000',4000,'2020-09-21 10:11:59',20200921101159); INSERT INTO t1 VALUES(3,'OPPO','5000',3000,'2020-08-21 10:11:59',20190821101159); INSERT INTO t1 VALUES(4,'华为','9111',10000,'2020-02-29 10:11:59',20200228101159); SELECT CEIL(rpad(price,20,sal)) FROM t1 ORDER BY id; SELECT rpad(CEIL(sal),20,CEIL(price)) FROM t1 ORDER BY id;