mysqlsqlsqlite

Syntax diagrams for MySQL


I absolutely love the SQL syntax diagrams from the SQLite documentation.

enter image description here

I find this diagram much easier to follow than the equivalent from the MySQL docs

UPDATE [LOW_PRIORITY] [IGNORE] table_reference
    SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...
    [WHERE where_condition]
    [ORDER BY ...]
    [LIMIT row_count]

Does anyone know if diagrams like these exist for MySQL and other dialects?


Solution

  • The Bison grammar for MySQL can be processed by a grammar converter to turn it into W3C notation. From that, Railroad Diagram Generator produces syntax diagrams like this:

    enter image description here

    The grammar still might require some tweaking in order to get what you are looking for, but maybe it provides a starting point.

    When using the above tools, please allow some time for processing. The grammar is quite large, while both the converter and the diagram generator have not been optimized for speed, also they are running on a slow server.

    The complete result can be found here: sql_yacc.xhtml