Extract Array Elements Into Rows

YugabyteDB allows columns of a table to be defined as variable-length multidimensional arrays.

The UNNEST() function can be used later to expand an array to a set of rows.

Example:

				
					
yugabyte=# CREATE TABLE stuff (names TEXT[]);
CREATE TABLE

yugabyte=# INSERT INTO stuff VALUES (ARRAY['Jim', 'Bryan', 'Mike', 'Andrius', 'Alex']);
INSERT 0 1

yugabyte=# SELECT * FROM stuff;
             names
-------------------------------
 {Jim,Bryan,Mike,Andrius,Alex}
(1 row)

yugabyte=# SELECT unnest(names) FROM stuff ORDER BY 1;;
 unnest
---------
 Alex
 Andrius
 Bryan
 Jim
 Mike
(5 rows)
				
			

Have Fun!