---
title: "Writing and Running openCypher in GSQL Shell"
component: "gsql-ref"
version: "3.11"
module: "openCypher-in-gsql"
html_url: "/gsql-ref/3.11/openCypher-in-gsql/openCypher-in-gsql-web-shell"
canonical_url: "https://www.tigergraph.com/docs/gsql-ref/3.11/openCypher-in-gsql/openCypher-in-gsql-web-shell"
markdown_url: "https://www.tigergraph.com/docs/gsql-ref/3.11/openCypher-in-gsql/openCypher-in-gsql-web-shell.md"
---

[View as HTML](https://www.tigergraph.com/docs/gsql-ref/3.11/openCypher-in-gsql/openCypher-in-gsql-web-shell)

# Writing and Running openCypher in GSQL Shell

You can run openCypher queries in a GSQL shell, e.g., a GSQL Web Shell from TigerGraph Cloud.

OpenCypher queries run the same way that GSQL queries do, either as anonymous interpreted procedures or as installed named procedures.

Follow these two simple rules:

1. Use the keyword `OPENCYPHER` to specify the query type when you `CREATE` or `INTERPRET` a query:  
   * `INTERPRET OPENCYPHER QUERY`  
   * `CREATE OPENCYPHER QUERY`
2. Replace the body of the query procedure with OpenCypher instead of GSQL. End with a `RETURN` clause.

For more details on the current openCypher support, see [openCypher in GSQL](https://www.tigergraph.com/docs/gsql-ref/3.11/openCypher-in-gsql/openCypher-in-gsql.md).

## Example: Interpreted Query

```gsql
INTERPRET OPENCYPHER QUERY () FOR GRAPH communication_mau {
MATCH (u:user)
WHERE u.id = "test"
RETURN u
}
```

> [!NOTE]
> `INTERPRET QUERY` does not support `DISTRIBUTED` query mode.

## Example: Installed Query

1. Create an openCypher query.  
```gsql  
CREATE DISTRIBUTED OPENCYPHER QUERY get_user_by_id2() FOR GRAPH communication_mau {  
MATCH (u:user)  
WHERE u.id = "test"  
RETURN u  
}  
```  
Note that the query body is the same when creating or interpreting a query. Only the header changed.
2. Install the query.  
```gsql  
INSTALL QUERY get_user_by_id2  
```
3. Run the installed query.  
```gsql  
RUN QUERY get_user_by_id2()  
```  
Note that you don't need to specify `OPENCYPHER` when you install or run the query. In particular, `INSTALL QUERY ALL` will work on a combination of GSQL and openCypher queries.
