Re:Shouldn't FROM come before SELECT in SQL? (2011)
by WorldMaker on Thursday January 25, 2024 @10:57AM
(#39130898)
Given how often `SELECT ` is already the developer "default" especially in debugging and REPL work there's a good case that `SELECT ` can truly just be the implied default case and something like `FROM 1` makes perfect sense as a standalone statement.
Re:Shouldn't FROM come before SELECT in SQL? (2011)
by jacques_chester on Thursday January 25, 2024 @11:54AM
(#39131684)
Even neater.
DuckDB has an implicit "SELECT *" if you just give it "FROM tablename", which fits your example.
Re:Shouldn't FROM come before SELECT in SQL? (2011)
by chrisjc on Thursday January 25, 2024 @12:17PM
(#39131982)
But interestingly DuckDB doesn't support `SELECT 'FOO' AS BAR FROM DUAL;` or `SELECT 'FOO' AS BAR FROM 1;`.
Which I guess makes sense if it has an implicit `SELECT *`.
What would the implicit projection of `FROM DUAL;` be?
Re:Shouldn't FROM come before SELECT in SQL? (2011)
by WorldMaker on Thursday January 25, 2024 @02:35PM
(#39134049)
From my experience of Oracle `FROM DUAL;` projection would give you on a coin flip either an empty table or a stacktrace error from some Java library.
> SELECT 1;
Something like Oracle's "dual" table would handle this corner case. Or just selecting a value from itself:
or Or whathaveyou. In any case, the SELECT 1 case isn't fatal to putting FROM first, merely annoying.> Intelligent tooling can and does already solve this.
It can progressively guess as you type, but it can't provide an upfront list of alternatives for autocompletion. That is an annoyance.