Predefined columns are non-primary key columns that are predefined with specific data types. This topic describes how to use predefined columns.
- Add predefined columns when you create a data table. For more information, see Create tables.
- Add predefined columns after a data table is created. For more information, see Predefined columns in Tablestore SDK for Java or Predefined columns in Tablestore SDK for Go.
After you add a predefined column to a data table, you can use the predefined column as a primary key column or attribute column of the secondary index. You must use one or more of the predefined columns as the attribute columns of the secondary index.
For example, if a data table contains three primary key columns, two predefined columns, and two attribute columns, you can create a secondary index with the following attributes. The three primary key columns can only be used as the primary key columns of the secondary index, the two predefined columns can be used as the primary key columns or attribute columns of the secondary index, and the two attribute columns cannot be used for the secondary index.