SurrealDB Docs Logo

Enter a search query

Back to home
SurrealDB

SurrealDB

SurrealQL via Surrealist

In this section, you will explore writing SurrealQL queries using Surrealist, the official query editor for SurrealDB. Surrealist is a powerful tool that allows you to write, execute, and visualize SurrealQL queries in real-time.

The Surrealist query editor provides a rich set of features, including syntax highlighting, query validation, and query execution. You can also view the query results in a tabular format, making it easy to analyze and visualize the data.

Important

Learn more about SurrealQL by exploring the SurrealQL documentation.

Getting Started

To get started with SurrealQL in Surrealist, go to the Surrealist Query Editor and start writing your SurrealQL queries. You can use the query editor to write queries, execute them, and view the results in real-time.

Setting up a connection

In order to interact with a SurrealDB database you must first create a connection. Connections store the details required to connect to a database, such as the endpoint, namespace, database, and authentication details. When you select an active connection in Surrealist, you will connect to the database and be able to interact with it using the available interface views.

After opening a connection, you can switch to another connection at any time by pressing the connection name in the top left of the interface. This will open the connection list allowing you to switch to another connection, or create a new one.

Within the connection list you will also find a special connection called Sandbox, which is always available and allows you to test and experiment without storing data persistently. This connection is useful for learning SurrealQL, testing queries, and more.

You can also create a new custom connection, this will allow you to connect to a remote SurrealDB instance, or a local instance this will also require you to set the namespace and database.

Setting a namespace and database for connections.

If you are using a connection (local or remote), before you can start writing queries, you need to set the namespace and database for the connection.

For example you can set the namespace to test and the database to test. This will set the namespace and database for the current connection.

Writing a query

Once you have a connection open you can use the SurrealQL query editor to create some data. For example, you can create a new record in the person table.

CREATE person SET name = "John", age = 30;

In the query editor, you can use syntax highlighting, code completion, and validation to help you write your queries more efficiently. To execute a query, press the run query button at the bottom of the query editor.

Learn more

To learn more about SurrealQL and how to write queries using Surrealist, check out the Surrealist documentation.

© SurrealDB GitHub Discord Community Cloud Features Releases Install