Working with tuples

We saw that collections are a versatile tool for working with multiple values in a single column. One limitation of collections, however, is that all elements of a collection must be of the same type. If we want to store values of different types in the same collection, we can instead turn to tuples.

Unlike collections, which can store an arbitrary number of elements, a tuple column stores a fixed number of elements, each of which has a predefined type. So, while we gain the flexibility to store elements of different types in the same column, we give up flexibility in the number of elements stored.

Creating a tuple column

Let's say we'd like to allow users to add some information about their education to their profile. In particular, ...

Get Learning Apache Cassandra now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.