Using Array Data Types in Postgres
While the Postgres data types that we have explored so far allow us to store many different types of data, occasionally we will want to store a series of values in a table. For example, we might want to store a list of the products that a customer has purchased, or we might want to store a list of the employee ID numbers associated with a specific dealership. For this scenario, Postgres offers the ARRAY
data type, which allows us to store just that – a list of values.
Starting with Arrays
Postgres arrays allow us to store multiple values in a field in a table. For example, consider the following first record in the customers
table:
customer_id | 1 title | NULL first_name | Arlena last_name ...