_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › PostgreSQL覦一

Contents

1
2
3 譟壱
4 螳煙


1 #

create table array_test
(
	ref char(5)
,	array_col int[] --> 企蟆 誤.
);

2 #

insert into array_test values('val01', '{1,2,3,4,5}'); --> {}襦 螳語 ロ.
insert into array_test values('val01', '{1,2,3,4,5,6,7,8,9}');

3 譟壱 #

select * from array_test
  ref  |      array_col
-------+---------------------
 val01 | {1,2,3,4,5}
 val02 | {1,2,3,4,5,6,7,8,9}
(2 rows)
--覦一  蠏狩蠍
select
	array_col[1] as col1 --> 螳螳 覦一伎 蠏狩蠍 伎 [n]襯 .
,	array_col[2] as col2	
,	array_col[3] as col3	
,	array_col[4] as col4	
,	array_col[5] as col5	
,	array_col[6] as col6	
,	array_col[7] as col7	
,	array_col[8] as col8	
,	array_col[9] as col9	
from array_test
 col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | col9
------+------+------+------+------+------+------+------+------
    1 |    2 |    3 |    4 |    5 |      |      |      |
    1 |    2 |    3 |    4 |    5 |    6 |    7 |    8 |    9
(2 rows)

4 螳煙 #

update array_test
set 
	array_col[8] = 8
,	array_col[3] = null
where ref = 'val01';

select 
	array_col 
,	array_col[8] as col8
from array_test
where ref = 'val01';
         array_col          | col8
----------------------------+------
 {1,2,NULL,4,5,NULL,NULL,8} |    8
(1 row)
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:54

蟆壱殊 伎手鍵れ 螻 蠍願鹸 伎手鍵. (殊)