「PostgreSQL」配列の最後に値を追加するサンプル

環境
PostgreSQL 13.2
Windows 10 64bit
書式
array_append( 配列, 追加する値 )
「array_append」を使用して、配列の最後に値を追加します。

操作例
SQL構文

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
select array_append(array['study','skill'],'arkgame') result
select array_append(array['study','skill'],'arkgame') result
select array_append(array['study','skill'],'arkgame') result

実行結果

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
postgres=# select array_append(array['study','skill'],'arkgame') result;
result
-----------------------
{study,skill,arkgame}
(1)
postgres=# select array_append(array['study','skill'],'arkgame') result; result ----------------------- {study,skill,arkgame} (1 行)
postgres=# select array_append(array['study','skill'],'arkgame') result;
        result
-----------------------
 {study,skill,arkgame}
(1 行)

 

PostgreSQL

Posted by arkgame