Query language

SurrealDB's query language SurrealQL is a powerful and intuitive database query language. SurrealDB's query language closely resembles traditional SQL at its core:

SELECT name,
metadata
FROM user
WHERE age >= 18;

However, it comes with unique differences and improvements due to the variety of ways to query data.

SELECT name,
metadata.{
date_registered,
last_login
},
->wrote->post AS posts
FROM user
WHERE age >= 18;

SurrealQL is designed to provide developers with a seamless and intuitive way to interact with SurrealDB. It offers a familiar syntax and supports various statement types, allowing you to perform complex database operations efficiently.

Whether you are querying data, modifying records, or managing database structures, SurrealQL provides a comprehensive set of capabilities to meet your needs.

SurrealQB's query language offers several key features that make it a powerful tool:

  • Familiar syntax: A syntax similar to traditional SQL makes it easy for developers familiar with SQL to transition to SurrealDB seamlessly.

  • Advanced querying: Supports a wide range of querying capabilities, including filtering, sorting, aggregating, and joining data from multiple tables.

  • Data manipulation: Easily insert, update, and delete records in your SurrealDB database, allowing you to manage your data effectively.

  • Graph relations: Graph relation queries allow you to define and query relationships between records in your database.

  • Schema management: Provides features for creating and modifying database schemas, allowing you to define the structure of your data and enforce data integrity.

  • Performance optimisation: Incorporates optimisations specific to SurrealDB, ensuring efficient execution of queries and minimizing resource usage.

To start using SurrealQL, refer to the documentation on the various statement types and their syntax. The statements page provides comprehensive examples and explanations for each statement type, helping you understand how to construct queries and interact with SurrealDB effectively.

SurrealQL empowers you to leverage the full potential of SurrealDB and enables you to build robust and scalable applications. Let's dive into the world of SurrealQL and unlock the capabilities of SurrealDB together!

Was this page helpful?