On Wed, Mar 26, 2014 at 7:12 PM, RSmith <rsm...@rsweb.co.za> wrote:

>
> Double quotes are not part of the standard, just allowed by most systems
> in lieu of single quotes, but you are correct about back-quotes not being
> part of the standard either, but they will be understood by most SQL
> engines to mean `NOT a string`.  (Which is why it is easier to use them in
> stead of double quotes around things that are explicitely not strings, like
> identifiers). What is in the standard seems to not always be adhered to and
> different in every Engine, but my advice was more towards making life
> easier on the programmer with respect to the SQL, not prescribing standard
> adherence at all - though I would strongly advise avid use of legibility
> punctuation and format as they are great tools for being able to comprehend
> your own SQL 6-months down the line.
>
> I'm somewhat a fan of MSSQL's brackets for the above reason - looking at a
> complex bit of SQL in MSSQL guise might look cumbersome with those very
> bold word-boundaries, but you cannot ever claim that it isn't vividly clear
> in one glance which bits are identifiers and which not, though it's hard to
> make a real case for it.


You may be right. I do have have the text of the actual standard in front
of me. My reference for double quote being part of the standard is:

http://savage.net.au/SQL/sql-92.bnf

which states its source:

Using Appendix G of "Understanding the New SQL: A Complete Guide" by J
Melton and A R Simon (Morgan Kaufmann, 1993, ISBN 0-55860-245-3) as the
source of the syntax, here is (most of) the BNF syntax for SQL-92.  The
missing parts are the Cobol, Fortran, MUMPS, Pascal and PL/I variable
definition rules.

And goes on to show the following snippets:

<double quote> ::= "

<delimited identifier> ::= <double quote> <delimited identifier body>
<double quote>

Since it is not the standard, it could be wrong, but my experience
indicates that double quotes are never "officially" a string delimiter,
only an identifier delimiter. Implementations vary, of course.

In any case, I agree with you about the MSSQL use of brackets. They stand
out and are unambiguously not a string!

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

Reply via email to