SQL / AQL - Comparison
The ArangoDB Query Language (AQL) is similar to the Structured Query Language (SQL) in its purpose. Both support reading and modifying collection data, however AQL does not support data definition operations, such as creating and dropping databases, collections and indexes.
Though some of the keywords overlap, AQL syntax differs from SQL. For instance, the SQL WHERE
and AQL FILTER
clauses are equivalent in that they both define conditions for returning results. But, SQL uses predefined sequence to determine where the WHERE
clause must occur in the statement. In AQL, clauses execute from left to right, so the position of a FILTER
clause in the query determines its precedence.
Despite such differences, anyone with an SQL background should have no difficulty in learning AQL. If you run into any problems, we have a table below showing SQL functions and commands with their AQL equivalents.
SQL / AQL - Comparison
The ArangoDB Query Language (AQL) is similar to the Structured Query Language (SQL) in its purpose. Both support reading and modifying collection data, however AQL does not support data definition operations, such as creating and dropping databases, collections and indexes.
Though some of the keywords overlap, AQL syntax differs from SQL. For instance, the SQL WHERE
and AQL FILTER
clauses are equivalent in that they both define conditions for returning results. But, SQL uses predefined sequence to determine where the WHERE
clause must occur in the statement. In AQL, clauses execute from left to right, so the position of a FILTER
clause in the query determines its precedence.
Despite such differences, anyone with an SQL background should have no difficulty in learning AQL. If you run into any problems, we have a table below showing SQL functions and commands with their AQL equivalents.
Terminology
Below is a table with the terms of both systems.
SQL | AQL |
---|---|
database | database |
table | collection |
row | document |
column | attribute |
table joins | collection joins |
primary key | primary key (automatically present on _key attribute) |
index | index |
Terminology
Below is a table with the terms of both systems.
SQL | AQL |
---|---|
database | database |
table | collection |
row | document |
column | attribute |
table joins | collection joins |
primary key | primary key (automatically present on _key attribute) |
index | index |
INSERT
The INSERT
keyword adds new documents to a collection. It uses the following syntax:
INSERT document INTO collection options
New and eager to try out ArangoDB? Start your free 2-weeks trial with ArangoDB ArangoGraph: Cloud Service for ArangoDB and run the database directly in the cloud.
In the main, AQL is a declarative language. Queries express what results you want but not how you want to get there. AQL aims to be human-readable, therefore uses keywords from the English language.
It also aims to be client independent, meaning that the language and syntax are the same for all clients, no matter what programming language the clients use. Additionally, it supports complex query patterns and the various data models ArangoDB offers.
AQL also supports several aggregation and string functions. For more information, see AQL Functions.
6 Comments
6 Comments
INSERT ... INTO
in addition to INSERT ... IN
, which is not only grammatically correct, but also even closer to SQL. In fact, IN and INTO can be used interchangeably in UPDATE, REPLACE and REMOVE statements.v2.7 features Object Literal Simplification, which can be used to shorten some of above queries and get them closer to SQL as well.
INSERT ... INTO
in addition toINSERT ... IN
, which is not only grammatically correct, but also even closer to SQL. In fact, IN and INTO can be used interchangeably in UPDATE, REPLACE and REMOVE statements.v2.7 features Object Literal Simplification, which can be used to shorten some of above queries and get them closer to SQL as well.