Quiz⭐毎日コツコツ積み重ね⭐

SnowflakeのFLATTEN関数の動作 [Q20250414]

Snowflake
SQL
Snowflake Basic
2025.04.14

以下のテーブルとデータが存在する場合、実行されるクエリの結果について、正しい説明を2つ選んでください。

テーブル定義とサンプルデータ:

1 CREATE OR REPLACE TABLE persons AS
2 SELECT column1 as id, parse_json(column2) as c
3 FROM values
4 (12712555,
5 '{ name: { first: "John", last: "Smith"},
6 contact: [
7 { business:[
8 { type: "phone", content:"555-1234" },
9 { type: "email", content:"j.smith@example.com" } ] } ] }'),
10 (98127771,
11 '{ name: { first: "Jane", last: "Doe"},
12 contact: [
13 { business:[
14 { type: "phone", content:"555-1236" },
15 { type: "email", content:"j.doe@example.com" } ] } ] }') v;

実行クエリ:

1 SELECT id as "ID",
2 f.value AS "Contact",
3 f1.value:type AS "Type",
4 f1.value:content AS "Details"
5 FROM persons p,
6 lateral flatten(input => p.c, path => 'contact') f,
7 lateral flatten(input => f.value:business) f1;

(select 2 options)

0
X

Sponsored by

スポンサーを募集中。紹介コンテンツもご用意しますので、ご興味あればお問い合わせください。