How to Insert Array Data Into a Table

If we have a table with an array column of like:

create table airport ( 	
    city text, 
    airport_code char(3), 
    xyz_coordinates numeric[]  
);

We can insert data into the table with an SQL insert like the following:

insert into airport values (‘San Francisco’,’SFO’,ARRAY[23.42,-34.42, 23.34]);
insert into airport values (‘Los Angeles’,’LAX’,ARRAY[21.21,-22.26, 12.11]);
 
select * from airport;
City
San Francisco
Los Angeles
airport_code
SFO
LAX
xyz_coordinates
{23.42, -34.42, 23.34}
{21.21, -22.26, 12.11}

IN THIS PAGE