Skip to content
Daniël van Eeden edited this page Mar 13, 2024 · 7 revisions

Standard SQL supports two types of comments:

-- single line comment

/* multi line
   block comment */

These are supported by all dialects.

Nested block comments

According to standard, block comments can also be nested, like:

/* main comment
   /* sub-comment */
*/

This is however only supported by some dialects:

  • DB2i
  • PostgreSQL
  • Transact-SQL
  • MariaDB and MySQL docs mention that nested comments might be supported in some places, but their support is deprecated and one is advised not to use them.

Hash comments

Some dialects additionally support shell-style hash-comments:

# a comment

Double forward slash comments

Some dialects additionally support c-style slash-comments:

// a comment
  • Snowflake

Links to comment syntax in all dialects

Clone this wiki locally