Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MYSQL documentation syntax grammar

Tags:

sql

mysql

grammar

I can't seem to find, within the docs, a description of the syntax grammar they use throughout their site. This forces me into guessing, which for the most part works but others leaves me scratching my head.

Take this example. After reading the page I've come to the conclusion that the pipe '|' means OR, curley brackets {...} mean required and square brackets [...] mean optional. By that logic I could create a statement of INSERT my_table (foo) VALUE (DEFAULT) (notice the missing INTO) which doesn't seem right to me.

INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
    [INTO] tbl_name
    [PARTITION (partition_name,...)] 
    [(col_name,...)]
    {VALUES | VALUE} ({expr | DEFAULT},...),(...),...
    [ ON DUPLICATE KEY UPDATE
      col_name=expr
        [, col_name=expr] ... ]

Am I correct in thinking INTO is optional? And does anybody know where MySQL keep their page describing the syntax language they use?

I don't have access to a SQL server at the moment, so I can't test it until later.

like image 892
Twifty Avatar asked Oct 21 '25 12:10

Twifty


1 Answers

It actually exists in the docs, its called 1.2 Typographical and Syntax Conventions and can be found here https://dev.mysql.com/doc/refman/5.7/en/manual-conventions.html

like image 57
dkasipovic Avatar answered Oct 23 '25 04:10

dkasipovic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!