mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
39 lines
1.4 KiB
SQL
39 lines
1.4 KiB
SQL
DROP TABLE IF EXISTS t_nested_tuple;
|
|
|
|
CREATE TABLE t_nested_tuple
|
|
(
|
|
endUserIDs Tuple(
|
|
_experience Tuple(
|
|
aaid Tuple(
|
|
id Nullable(String),
|
|
namespace Tuple(
|
|
code LowCardinality(Nullable(String))
|
|
),
|
|
primary LowCardinality(Nullable(UInt8))
|
|
),
|
|
mcid Tuple(
|
|
id Nullable(String),
|
|
namespace Tuple(
|
|
code LowCardinality(Nullable(String))
|
|
),
|
|
primary LowCardinality(Nullable(UInt8))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
ENGINE = MergeTree ORDER BY tuple();
|
|
|
|
SET output_format_json_named_tuples_as_objects = 1;
|
|
|
|
INSERT INTO t_nested_tuple FORMAT JSONEachRow {"endUserIDs":{"_experience":{"aaid":{"id":"id_1","namespace":{"code":"code_1"},"primary":1},"mcid":{"id":"id_2","namespace":{"code":"code_2"},"primary":2}}}};
|
|
|
|
SELECT * FROM t_nested_tuple FORMAT JSONEachRow;
|
|
SELECT endUserIDs._experience FROM t_nested_tuple FORMAT JSONEachRow;
|
|
SELECT endUserIDs._experience.aaid FROM t_nested_tuple FORMAT JSONEachRow;
|
|
SELECT endUserIDs._experience.aaid.id FROM t_nested_tuple FORMAT JSONEachRow;
|
|
SELECT endUserIDs._experience.aaid.namespace FROM t_nested_tuple FORMAT JSONEachRow;
|
|
SELECT endUserIDs._experience.aaid.namespace.code FROM t_nested_tuple FORMAT JSONEachRow;
|
|
SELECT endUserIDs._experience.aaid.primary FROM t_nested_tuple FORMAT JSONEachRow;
|
|
|
|
DROP TABLE t_nested_tuple;
|