SQL for Beginners
About Lesson

SQL Scripts

A SQL script is a collection of SQL statements that you can execute in one operation. You can use any kind of SQL commands, such as insert, select, delete, update, etc. In addition you can define and use variables, and you may also use program flow like If-Else, etc. You may also add comments to make the script easier to read and understand.

 

Using Comments

Using comments in you SQL script is important to make the script easier to read and understand.

In SQL we can use 2 different kinds of comments:

  • Single-line comment
  • Multiple-line comment

 

Single-line comment

We can comment one line at the time using “” before the text you want to comment out.

 

Syntax:

-- text_of_comment

 

Multiple-line comment

We can comment several line using “/*” in the start of the comment and “*/” in the end of the comment.

Syntax:

/* 
text_of_comment 
text_of_comment
*/