titlesidebar_labeldescription
    SQL execution order
    SQL execution order
    Execution order for SQL clauses in QuestDB. This covers the SQL keywords you are used to as well as QuestDB’s extensions to the language.

    QuestDB attempts to implement standard ANSI SQL. We also attempt to be PostgreSQL compatible, although some of it is work in progress. QuestDB implements the following clauses in this execution order:

    1. FROM
    2. ON
    3. JOIN
    4. WHERE
    5. LATEST BY
    6. GROUP BY (optional)
    7. WITH
    8. HAVING (implicit)
    9. SELECT
    10. DISTINCT
    11. ORDER BY
    12. LIMIT

    We also implemented sub-queries. They can be used anywhere table name is used. Our sub-query implementation adds virtually zero execution cost to SQL. We encourage their use as they add flavours of functional language to old-school SQL.