📅  最后修改于: 2020-11-26 05:31:05             🧑  作者: Mango
Alter Property是用于修改或更新特定类的Property的命令。更改属性意味着修改表的字段。在本章中,您可以学习如何更新属性。
以下语句是Alter Property Command的基本语法。
ALTER PROPERTY .
以下是上述语法中有关选项的详细信息。
<属性> -定义要更新的属性。
下表定义了更改属性的属性列表。
Attribute | Type | Description |
---|---|---|
LINKEDCLASS | String | Defines the linked class name. Use NULL to remove an existing value. |
LINKEDTYPE | String | Defines the link type. Use NULL to remove an existing value. |
MIN | Integer | Defines the minimum value as a constraint. Use NULL to remove an existing constraint. |
MANDATORY | Boolean | Defines whether the property requires a value. |
MAX | Integer | Defines the maximum value as a constraint. Use NULL to remove an existing constraint. |
NAME | String | Defines the property name. |
NOTNULL | Boolean | Defines whether the property can have a NULL value. |
REGEX | String | Defines a Regular Expression as constraint. Use NULL to remove an existing constraint. |
TYPE | String | Defines a property type. |
COLLATE | String | Sets collate to one of the defined comparison strategies. By default, it is set to case-sensitive (cs). You can also set it to case-insensitive (ci). |
READONLY | Boolean | Defines whether the property value is immutable. That is, if it is possible to change it after the first assignment. Use with DEFAULT to have immutable values on creation. |
CUSTOM | String | Defines custom properties. The syntax for custom properties is |
DEFAULT | Defines the default value or function. |
注意-如果要更改NAME或TYPE,此命令将花费一些时间来更新,具体取决于数据量。
尝试下面给出的一些查询以了解Alter属性。
执行以下查询,将Customer类中的属性名称从“ age”更改为“ born”。
orinetdb {db = demo}> ALTER PROPERTY Customer.age NAME born
如果上面的查询成功执行,您将获得以下输出。
Property altered successfully
执行以下查询以使“名称”成为类“客户”的必需属性。
orientdb {db = demo}> ALTER PROPERTY Customer.name MANDATORY TRUE
如果上面的查询成功执行,您将获得以下输出。
Property altered successfully