EQL and SQL: a comparison

EQL is, in many ways, similar to SQL, but has some marked differences as well.

This topic identifies EQL concepts that may be familiar to users familiar with SQL, as well as the unique features of EQL:
  • Tables with a single schema vs collections of records with more than one schema. SQL is designed around tables of records — all records in a table have the same schema. EQL is designed around one or more collections of records with heterogeneous schemas.
  • EQL Query vs SQL Query. An EQL statement requires a DEFINE or RETURN clause, which, like a SQL common table expression (or CTE), defines a temporary result set. The following differences apply, however:
    • EQL does not support a schema declaration.
    • In EQL, the scope of a CTE is the entire query, not just the immediately following statement.
    • In EQL, a RETURN is both a CTE and a normal statement (one that produces results).
    • EQL does not support recursion. That is, a statement cannot refer to itself using a FROM clause, either directly or indirectly.
    • EQL does not contain an update operation.
  • Clauses. In EQL, SELECT, FROM, WHERE, HAVING, GROUP BY, and ORDER BY are all like SQL, with the following caveats:
    • In SELECT statements, AS aliasing is optional when selecting an attribute verbatim; statements using expressions require an AS alias. Aliasing is optional in SQL.
    • In EQL, GROUP BY implies SELECT. That is, grouping attributes are always included in statement results, whether or not they are explicitly selected.
    • Grouping by a multi-assign attribute can cause a single record to participate in multiple groups. With the use of the MEMBERS extension in a GROUP BY clause, a single record can participate in multiple groups.
    • WHERE can be applied to an aggregation expression.
    • In SQL, use of aggregation implies grouping. In EQL, grouping is always explicit.
  • Other language comparisons:
    • PAGE works in the same way as many common vendor extensions to SQL.
    • In EQL, a JOIN expression's Boolean join condition must be contained within parentheses. This is not necessary in SQL.
    • EQL supports SELECT statements only. It does not support other DML statements, such as INSERT or DELETE, nor does it support DDL, DCL, or TCL statements.
    • EQL supports a different set of data types, expressions, and functions than described by the SQL standard.