A sequel to SQL? An intro to Malloy
The minimum enhancement I want for SQL is a version where <i>no literal values</i> are allowed in queries, as this would completely preclude SQL injection :)<p>To make that more tolerable for query planning purposes, there would have to be two types of query parameters: compile-time and run-time.<p>Next up: why not allow query clauses to come in any order?  `SELECT .. FROM .. WHERE ..;` or `FROM .. SELECT .. WHERE;` and so on.<p>Since the query parser&#x2F;planner has to see the whole thing anyways.  The parser&#x2F;planner can&#x27;t begin coding at `SELECT`, or at `WHERE`, since there might be a `GROUP BY`, or an `ORDER BY` that affect the whole query plan, so all these clauses might as well come in <i>any</i> order.  Wanna put `HAVING` first?  Sure, why not.  It&#x27;s probably best to insist that table sources all come together rather than be all over, but I think even that doesn&#x27;t <i>have</i> to be so.<p>Also, I&#x27;d like an out-of-band mechanism for expressing query planner hints.  This would be a separate string or object passed along with the query, and which does things like: identify a table source to use as the outer-most table for the query plan, for each of some or all table sources identify an index to use or temp index to create, for each of some or all joins pick a join strategy, etc.  Table sources would have to be addressed as {&lt;CTE_name&gt;, &lt;table_source_name&gt;}, naturally.  Such a thing should also allow one to specify indices that should be created on CTEs.