Using a map type collection

Use a map when pairs of related elements must be stored as a key-value pair.

A map relates one item to another with a key-value pair. For each key, only one value may exist. Duplicates cannot be stored. Both the key and the value are designated with a data type.

Using the map type, you can store timestamp-related information in user profiles. Each element of the map is internally stored as a single column that you can modify, replace, delete, and query. Each element can have its own time-to-live that expires when the TTL ends.

Procedure

Define a teams map in the table cyclist_teams within the cycling keyspace. Each team listed in the map has an integer data type for the year a cyclist belonged to the team and a text data type for the team name. The map collection is specified with a map column name and the pair of data types enclosed in angle brackets.
The example below specifies the teams map column with <int,text> data types for the key-value pairs.
CREATE TABLE cycling.cyclist_teams (
   id UUID PRIMARY KEY, 
   lastname text, 
   firstname text, 
   teams map<int,text> );