User-defined type (UDT) overview
A user-defined type facilitates handling multiple fields of related information in a table. To reduce the number of tables for applications that require multiple tables, use a user-defined type to represent the related fields of information instead of storing the information in a separate table.
You can create, alter, or drop a user-defined type using the following commands:
The address type example demonstrates how to use a user-defined type.
The cqlsh utility includes these commands for describing a user-defined type or listing all user-defined types:
Accessing a UDT in a keyspace
When you create a user-defined type, by default, the current keyspace is its scope.
Use dot notation, for example, KEYSPACE_NAME.UDT_NAME, to create a UDT in a specific keyspace.
You can use UDTs only in CREATE TABLE or ALTER TABLE statements within the same keyspace where the UDT is defined. However, you can use UDTs in SELECT, INSERT, UPDATE statements with dot notation in any keyspace.