DELETE TAG¶
DELETE TAG
deletes a tag with the given name on a specified vertex.
A vertex can have one or more tags.
- If a vertex has only one tag, the vertex CANNOT be accessed after you delete the tag. But its edges are available. The vertex will be deleted in the next compaction.
- If a vertex has multiple tags, the vertex is still accessible after you delete one of them. But all the properties defined by this deleted tag CANNOT be accessed.
Prerequisites¶
Running the DELETE TAG
statement requires some privileges for the graph space. Otherwise, NebulaGraph throws an error.
Syntax¶
DELETE TAG <tag_name_list> FROM <VID>;
tag_name_list
: Specifies the name of the tag. Multiple tags are separated with commas (,).*
means all tags.
VID
: Specifies the VID of the tag to delete.
Example¶
nebula> CREATE TAG IF NOT EXISTS test1(p1 string, p2 int);
nebula> CREATE TAG IF NOT EXISTS test2(p3 string, p4 int);
nebula> INSERT VERTEX test1(p1, p2),test2(p3, p4) VALUES "test":("123", 1, "456", 2);
nebula> FETCH PROP ON * "test";
+------------------------------------------------------------+
| vertices_ |
+------------------------------------------------------------+
| ("test" :test2{p3: "456", p4: 2} :test1{p1: "123", p2: 1}) |
+------------------------------------------------------------+
nebula> DELETE TAG test1 FROM "test";
nebula> FETCH PROP ON * "test";
+-----------------------------------+
| vertices_ |
+-----------------------------------+
| ("test" :test2{p3: "456", p4: 2}) |
+-----------------------------------+
nebula> DELETE TAG * FROM "test";
nebula> FETCH PROP ON * "test";
+-----------+
| vertices_ |
+-----------+
+-----------+
Compatibility
- In openCypher, you can use the statement
REMOVE v:LABEL
to delete the tagLABEL
of the vertexv
. DELETE TAG
andDROP TAG
have the same semantics but different syntax. In nGQL, useDELETE TAG
.
Last update:
March 13, 2023