SQL Comment – How to insert a comment into SQL script

Last modified date:

Comments in SQL query have a simple purpose. They keep the code well-arranged for others and also explain its logic. If you mark some text as a comment it will not be taken as an SQL command and therefore it will not be executed. SQL Comment can be written down in two ways:

  • Comment can be marked by double dash “–“. This solution is valid for 1 line only.
  • Comment can be marked by “/**/” at the start and at the end

Comment in SQL is distinguished by green color.

SQL Comment Syntaxe

First way of making a comment in SQL:

-- Comment 1
-- Comment 2

Second way of making a comment in SQL:

/* Comment 1
   Comment 2 */

Second way of commenting is preferable when the comment takes up more than 1 row.

Hint: If you are interested in SQL and would like to learn it, start with SQL Tutorials or let me know in a comment section and I will point you in the right direction.

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Category: SQL Tutorials

About Ing. Jan Zedníček - BI Developer, Finance controller

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.