2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS decimal;
|
2018-09-18 12:08:54 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS decimal
|
2018-09-18 12:08:54 +00:00
|
|
|
(
|
|
|
|
a DECIMAL(9,4) DEFAULT 0,
|
|
|
|
b DECIMAL(18,4) DEFAULT a / 2,
|
|
|
|
c DECIMAL(38,4) DEFAULT b / 3,
|
|
|
|
d MATERIALIZED a + toDecimal32('0.2', 1),
|
|
|
|
e ALIAS b * 2,
|
|
|
|
f ALIAS c * 6
|
|
|
|
) ENGINE = Memory;
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DESC TABLE decimal;
|
2018-09-18 12:08:54 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO decimal (a) VALUES (0), (1), (2), (3);
|
|
|
|
SELECT * FROM decimal;
|
|
|
|
SELECT a, b, c, d, e, f FROM decimal;
|
2018-09-18 12:08:54 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS decimal;
|