I want to be able to insert null values for specific rows, not by default For example: I hope to be able to insert null values for age, but if not specified then it's defaulted with the value 10.
create table mytable
(
age Int null default 10,
name String
) ENGINE = MergeTree()
ORDER BY name
result
Code: 62, e.displayText() = DB::Exception: Syntax error: failed at position 88 ('default') (line 3, col 26): default 10,
name String
) ENGINE = MergeTree()
ORDER BY name. Expected one of: CODEC, TTL, ClosingRoundBracket, Comma, COMMENT, token (version 21.8.10.19 (official build))
the documentation says:
NULL is the default value for any Nullable type, unless specified otherwise in the ClickHouse server configuration.
I think I have to find the correct setting on this page or I misunderstood the relationship between default values and Nullable type...
ClickHouse has a special syntax Nullable( <type> )
--> age Nullable(Int)
create table mytable
(
age Nullable(Int) default 10,
name String
) ENGINE = MergeTree()
ORDER BY name