The misspelling of NATURAL would be caught by a warning for JOIN
without ON constraint.
True.  And other possible errors could be caught by missing AS.

Really?

In my opinion, it's actually a good idea to leave out the AS in table
aliases since SQL-92 and many or most implementations do not require
the AS, and at least one prominent implementation does not allow it.
You can leave out trailing semicolons in Javascript statements, or not put
squiggly brackets around one statement blocks in C, or not close many HTML
tags, or depend on accidental ordering in SQL etc.

You can do whatever you want for your code.  But many people appreciate
tools that proactively help find problems.  It is often very common to put
in "unnecessary" extra syntax to make it very clear what the intentions
are (eg extra parentheses even though precedence doesn't require them or
things in paragraph above).  Using AS to make your intentions very clear
is up to you and others (I always do it).

Whether you use AS here or not is a matter of taste and portability. As far as the SQL-92 standard and many/most implementations are concerned, we might just as well say "the AS in table aliases is tolerated" as "the AS in table aliases is optional". We might just as well make the argument that lint should warn about the *presence* of AS as its absence.

You mentioned that this extra AS might help avoid ambiguities and errors. The only example of this you mentioned was where aliases names with spaces are not quoted. Do you have cases of this in mind that wouldn't be syntax errors anyway? In other words, I'm looking for evidence that "missing AS" really is in the same category of "trailing semicolons, etc".

Mark
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to