Use ALTER TABLE
statements to either add new
fields to a table definition, or delete a currently existing
field definition.
You cannot modify an existing field directly. Instead, you must delete the field, then add the field back using the new definition. Note that this will cause all existing data associated with the current field to be deleted.
To add a field to an existing table, use the
ADD
statement:
ALTER TABLE table-name (ADD field-definition)
See Field Definitions for a description of what should appear in field-definitions, above. For example:
ALTER TABLE Users (ADD age INTEGER)
You can also add fields to nested records. For example, if you have the following table definition:
CREATE TABLE u (id INTEGER, info record(firstName String)), PRIMARY KEY(id))
then you can add a field to the nested record by using dot notation to identify the nested table, like this:
ALTER TABLE u(ADD info.lastName STRING)