surrealql-reference

Reference SurrealQL syntax, operators, and functions for SurrealDB queries.

1|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/baladithyab/engram --skill surrealql-reference
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: surrealql-reference
Source: https://github.com/baladithyab/engram/tree/main/skills/surrealql-reference
Command: npx skills add https://github.com/baladithyab/engram --skill surrealql-reference

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive reference for SurrealQL syntax, helping developers write correct and efficient queries, especially when dealing with SurrealDB's unique features that differ from standard SQL.

Core Features & Use Cases

  • SurrealQL Syntax Guide: Detailed explanations of SELECT, UPSERT, CREATE, RELATE, DEFINE statements, and more.
  • SQL vs. SurrealQL Differences: Highlights critical distinctions like graph traversal, full-text search operators, and record links.
  • Use Case: When you need to define a new table with specific field types, indexes, and relationships in SurrealDB, this Skill can provide the exact DEFINE TABLE and DEFINE FIELD syntax required.

Quick Start

Use the surrealql-reference skill to find the correct syntax for defining a full-text search index in SurrealQL.

Frequently Asked Questions about surrealql-reference

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define a full-text search index in SurrealQL?

To define a full-text search index in SurrealQL, use the DEFINE INDEX statement with the BM25 indexing strategy on your target table fields. This enables efficient text matching and retrieval for your SurrealDB records.

What are the key differences between SurrealQL and standard SQL?

SurrealQL differs from standard SQL by introducing graph traversal, record links, and specific full-text search operators. It extends traditional SQL with unique statements like RELATE for managing graph relationships directly within the database.

How do I create graph relationships between records in SurrealDB?

To create graph relationships in SurrealDB, use the SurrealQL RELATE statement to connect record IDs. This allows you to define directed edges between nodes for efficient graph traversal queries.

When should I use the UPSERT statement instead of CREATE in SurrealQL?

Use the SurrealQL UPSERT statement when you need to update an existing record or create a new one if it does not exist, preventing duplicate key errors. Use CREATE when you specifically want to insert new records only.

Can I define schema field types and table definitions in SurrealDB?

Yes, you can define schema field types and table definitions in SurrealDB using the DEFINE TABLE and DEFINE FIELD statements. This allows strict schema enforcement and specifies data types for your database records.

What is the best way to optimize SurrealQL queries for vector search?

To optimize SurrealQL queries for vector search, use the HNSW indexing strategy when defining your index. This hierarchical navigable small world approach ensures fast approximate nearest neighbor lookups for high-dimensional data.