4 ms·
> This is valid SQL. > SELECT 1; Something like Oracle's "dual" table would handle this corner case. Or just selecting a value from itself: FROM 1 SEL
by jacques_chester 3y ago
> This is valid SQL.
> SELECT 1;
Something like Oracle's "dual" table would handle this corner case. Or just selecting a value from itself:
FROM 1 SELECT 1;
or
FROM ::integer SELECT 1;
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.
- WorldMaker 3y agoGiven 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.
- jacques_chester 3y agoEven neater. DuckDB has an implicit "SELECT *" if you just give it "FROM tablename", which fits your example.
- chrisjc 3y agoBut 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?
- WorldMaker 3y agoFrom 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.