In this article, we will learn how to use the Comments in SQL.

Comments can be used to explain sections of SQL statements, and to make it more readable. It can also be used to prevent execution when testing alternative SQL statements.

 

Single-Line Comments

Single line comments start with two hyphens (- -).

Example

--Returns all Articles.
SELECT * FROM Article;

Multi-Line Comments

Multi-line comments start with /* and end with */.

Example

/*Returns all the columns
in the Article table.*/
SELECT * FROM Article;

 

Also, check How To Use WHILE Loop In SQL