[PostgreSql] Using json_array_elements()

발행일: Feb, 2025
조회수: 0
단어수: 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


태그#jPostgreSQL#JSON#json_array_elements#SQL#database

JUNA BLOG VISITORS

오늘0
Total0