Using a set type collection

Use the set data type to store unordered multiple items.

A set consists of a group of elements with unique values. Duplicate values are not stored distinctly. The values of a set are stored unordered; however, the elements are returned in sorted order when queried. Use the set data type to store data that has a many-to-one relationship with another column. In the example below, a set called teams stores all the teams that a cyclist has been a member of during their career.

Procedure

Define teams in a table cyclist_career_teams. Each team listed in the set has a <text> data type.
CREATE TABLE cycling.cyclist_career_teams ( id UUID PRIMARY KEY, lastname text, teams set<text> );