Interpreting SQL BNF

I am considering SQL syntax, in particular character string literal .

<character string literal> ::=
    [ <introducer> <character set specification> ]
    <quote> [ <character representation> ... ] <quote>
    [ { <separator> <quote> [ <character representation> ... ] <quote> }... ]

Ignoring the part [ <introducer> <character set specification> ], does this mean one or more <quote> [ <character representation> ... ] <quote>separated by a symbol <separator>?

If so, does this mean that it 'hello' 'world'should be analyzed as one <character string literal>?

For a query, SELECT 'hello' 'world'Microsoft SQL Server 2005 returns:

+-------+
| world |
+-------+
| hello |
+-------+

and MySQL 5.0 returns:

+------------+
| hello      |
+------------+
| helloworld |
+------------+

I understand that every taste of SQL is different, and that they do not all follow the standard. I'm just trying to determine if I interpret BNF correctly. Thank.

+3
source share
3 answers

, , "" "" ?

ANSI SQL, .

+2

, SQL Server, , , "" "". , :

SELECT 'hello' AS 'world'

, :

SELECT 'hello' 'world' 'now'

Line 1: Incorrect syntax near 'now'.
0

Look at the BNF for <separator> ::=.

0
source

Source: https://habr.com/ru/post/1771560/


All Articles