Skip to main content

X-SQL

Overview

X-SQL is a powerful Documents Query Language which closely resembles traditional SQL, but with slight differences and improvements.

With a familar SQL syntax, it gives the ability to SELECT, INSERT, UPDATE, DELETE, COUNT documents in a collection.

Although it has similar syntax and similar statement types, the Datastore is a NoSQL Relational Database, the X-SQL only serves as an interface to interact with the CQL in a familiar manner.

Note: Not all SQL commands will work. We may also some have variation of some commands to accommodate the query.

Variables

The $ symbol indicates a variable in X-SQL similar to GraphQL. The name after the $ symbol is the name of our variable, which we can use throughout the query. After the colon is the variable's type, which must match the type of the argument we'll use it for.

Variables are great—they let us pass argument values dynamically from the client-side so we don't have to hardcode values into our query. We'll use them every time we create a query with arguments.

Example

{
"query": "SELECT * FROM articles WHERE $where SORT BY _created_at DESC LIMIT 10",
"variables": {
"where": {
"categories": "blog"
}
}
}