Search code examples
cyphermemgraphdbopencypher

Is DETACH a clause or a some kind of modifier?


I'm trying to figure out the naming convention for parts of Cypher queries. In Cypher Query Language Reference, Version 9 DETACH is listed on page 197 as a clause.

But in all examples, I've seen DETACH used only in pairs with DELETE. So it is always DETACH DELETE.

MATCH (n)
DETACH DELETE n

or

MATCH (n {name: 'Andres'})
DETACH DELETE n

Does DETACH have any other purpose or can it be used only with DELETE?


Solution

  • The terminology does seem to vary a bit here depending on what you read.

    I have seen DETACH described as a keyword in some documentation and posts, but in the openCypher specification DETACH and DETACH DELETE are each classified as clauses in the table of available clauses.

    Regardless, as far as openCypher goes, and as far as I am aware, Cypher too, DETACH is only ever used with DELETE.