Skip to content

Latest commit

 

History

History
54 lines (44 loc) · 1.94 KB

File metadata and controls

54 lines (44 loc) · 1.94 KB
Using Advanced Data Types in Apache Cassandra® ℹ️ For technical support, please contact us via email or LinkedIn.
⬅️ Back Step 8 of 10 Next ➡️
Tuples

A tuple is a fixed-length list, where values can be of different types. To define a tuple data type, Cassandra Query Language provides construct TUPLE<type1,type2,..., typeN>, where type1 , type2 , ... , typeN can refer to same or different CQL data types, including INT, DATE, UUID and so forth.

✅ Here is an example of a TUPLE column:

ALTER TABLE users ADD full_name TUPLE<TEXT,TEXT,TEXT>;

UPDATE users 
SET full_name = ('Joe', 'The', 'Great')
WHERE id = 7902a572-e7dc-4428-b056-0571af415df3;

SELECT name, full_name FROM users;

Unlike UDTs, individual tuple components cannot be updated without updating the whole tuple. Therefore, you should always prefer UDTs to tuples.

⬅️ Back Next ➡️