Escaping within the FROM clause

An even more powerful escape tool provided in 1010SQL is the macro escape mechanism. With macro escapes, any series of 1010data operations, no matter how large or complex, can be included in a 1010SQL statement.

The way this mechanism is implemented is fairly straightforward. The escape clause is simply appended to a table identifier in the FROM clause as a modifier, using the syntax:
table:{ops}
When the FROM clause is resolved, the table table is opened, and the 1010data operations (belonging to the Macro Language) specified by the ops are applied to the table before any further processing by 1010SQL. Below is an example:
SELECT *
    FROM pub.demo.weather.stations:{<sort col="elev" dir="up"/>};
The effect the sample above is to sort the table by elevation and return all rows. The result is exactly the same as the SQL subquery below:
SELECT *
        FROM (SELECT * FROM pub.demo.weather.stations ORDER BY elev);
The difference here is that the first FROM statement, which incorporates a 1010data Macro Language <sort> operation, is much faster than the SQL statement on the 1010data system.

It is important to note the differences in syntax between the two languages so you can build more efficient queries. If you need more information on the Macro Language and how to build 1010data expressions, take a look at the 1010data Reference Manual.