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_list>;
  • tag_name_list: The names of the tags you want to delete. Multiple tags are separated with commas (,). * means all tags.
  • VID: The VIDs of the vertices from which you want to delete the tags. Multiple VIDs are separated with commas (,).

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: November 3, 2023