Using Array Data Types in PostgreSQL
While the PostgreSQL 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 the employee ID numbers associated with a specific dealership. For this scenario, PostgreSQL offers the ARRAY
data type, which allows us to store just that—a list of values.
Starting with Arrays
PostgreSQL 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 | Riveles suffix ...