Skip to content

DELETE TAG

DELETE TAG deletes a tag with the given name on a specified vertex.

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" YIELD vertex AS v;
+------------------------------------------------------------+
| v                                                          |
+------------------------------------------------------------+
| ("test" :test1{p1: "123", p2: 1} :test2{p3: "456", p4: 2}) |
+------------------------------------------------------------+
nebula> DELETE TAG test1 FROM "test";
nebula> FETCH PROP ON * "test" YIELD vertex AS v;
+-----------------------------------+
| v                                 |
+-----------------------------------+
| ("test" :test2{p3: "456", p4: 2}) |
+-----------------------------------+
nebula> DELETE TAG * FROM "test";
nebula> FETCH PROP ON * "test" YIELD vertex AS v;
+---+
| v |
+---+
+---+

Compatibility

  • In openCypher, you can use the statement REMOVE v:LABEL to delete the tag LABEL of the vertex v.
  • DELETE TAG and DROP TAG have the same semantics but different syntax. In nGQL, use DELETE TAG.

Last update: February 19, 2024