๐Ÿ˜œ

์ญˆ๋‚˜์•„๋น  ๋ธ”๋กœ๊ทธ

JUNA
STUDIO

[PostgreSql] Using json_array_elements()

๋ฐœํ–‰์ผ: Feb, 2025
์กฐํšŒ์ˆ˜: 1
๋‹จ์–ด์ˆ˜: 48

Table of Contents

Introduction

The json_array_elements() function in PostgreSQL allows you to extract elements from a JSON array property and return them as separate rows.


Example Query

WITH test AS (
  SELECT '{"array": [ "v1", "v2", "v3", "v4", "v5" ]}'::json AS json
)
SELECT j.* FROM test, json_array_elements(json -> 'array') j;

Expected Output

The above query will return each element of the JSON array as a separate row.

Query Result


Tags: #jPostgreSQL#JSON#json_array_elements#SQL#database
JUNA BLOG VISITORS
Today
7
 (
updown
-7
)
Total
657
 (
updown
+7
)

ยฉ 2025 juniyunapapa@gmail.com.