This section is not intended to be a course of the SQL language. Therefore, the focus will be put on the minimal set of differences that you must know in order to write queries properly.
...
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
will work. Whereas
will not. |
KEY is a reserved word
As other database vendors, SQL Cloud does have reserved words that must be surrounded with accents or square brackets
...
Expand | ||
---|---|---|
| ||
These are the rules for conditions resolution:
In other words: (order of execution)
NOTE: A lot of database vendors work in a different way as they support extra query optimizations based on indexes, etc. They analyze the query syntax and some optimizations are applied in a sort of query internal re-writing before the execution starts. Thus, the users do not know the exact way how their queries will be really resolved and many of those database vendors provide an EXPLAIN command to show the real execution order to the user. In SQL Cloud, queries are executed in the exact order described above. It is for that reason that is very important to understand the right execution order of all the conditions (WHERE and JOINS). This might result confusing for a lot of users used to popular databases supporting those internal re-writing optimizations and expecting the same behavior here. In fact, the SQL specs are agnostic in regard to how the engine will resolve the query since it is supposed that tables have records which is not true in SQL Cloud as all the bales are empty an populated in real time to answer the users' queries. Therefor users must instruct the engine about the right order to populate the tables, via the SQL query syntax. |
Aggregation conditions do not support aliases
Expand | |||||||
---|---|---|---|---|---|---|---|
| |||||||
Please pay attention to the having condition: count(*) > 2
Works! In this query the condition has been modified to uses column aliases: `Num. comments` > 2
Not works! |