Javatpoint Logo
Javatpoint Logo

SQL Comments

SQL Comments are used to explain the sections of the SQL statements, and used to prevent the statements of SQL. In many programming languages, comments matter a lot.

A Microsoft Access database does not support the comments. So, Mozilla Firefox and Microsoft Edge use the Microsoft Access database in the examples.

There are three types of comments, which are given below:

  1. Single line comments.
  2. Multi-line comments
  3. Inline comments

Single Line Comment

Comments starting and ending with a single line are said as individual line comments. The line which starts with '–' is a single line comment, and that particular line is not executed.

The text between -- and end of the line is ignored and cannot be executed.


  • -- single-line comment
  • -- another comment
  • SELECT * FROM Customers;

The following example uses a single-line comment:

Example 1

The given example uses a single-line comment to ignore the end of the line:

Example 2

The following example uses the single-line comment to ignore the statements:

Example 3

Multi-line Comments

Comments that start in one line and end in different front are said as multi-line comments. The text between /* and */ is ignored in the code part.

The line starting with '/*' is considered as a starting point of comment and terminated when '*/' lies at the end.


Example 1

The below example uses a multi-line comment to ignore more statements:

Example 2

To ignore some part of a statement, use the /*....... */ comment.

The following example uses a comment to ignore some part of any code:

Example of SQL Multi-line Comment:


The following example uses a comment to not to be the part of a statement:


Inline comments:

Inline comments are an extension of multi-line comments, and comments can be stated between the statements and are enclosed in between '/*' and '*/.'


SELECT * FROM /*Employees; */


In line comment ->

SQL Comment Indicators

SQL Comment Indicator is indicated according to the given examples

It includes the double hyphen ( — ), braces ( { } ), and C-style ( /* . . . */ ) comment delimiters. It also includes the comments after the statement.

In the below examples, we place the comments on a single line code -

Examples of multi-line statements -

Next TopicSQL Tutorial

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA