我希望能夠為特定行插入空值,而不是默認情況下例如:我希望能夠為年齡插入空值,但如果未指定,則默認值為 10。
create table mytable
(
age Int null default 10,
name String
) ENGINE = MergeTree()
ORDER BY name
結果
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))
該文件說:NULL is the default value for any Nullable type, unless specified otherwise in the ClickHouse server configuration.
我想我必須在這個頁面上找到正確的設置,否則我誤解了默認值和 Nullable 類型之間的關係......
ClickHouse 有一個特殊的語法Nullable( <type> )
-->age Nullable(Int)
create table mytable
(
age Nullable(Int) default 10,
name String
) ENGINE = MergeTree()
ORDER BY name
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句