Comments are used to explain sections of SQL statements, or to prevent execution of SQL statements.
The are two ways to comment a line.
Single Line Comments
Multi-line Comments
Let us see each type below:
Single line comments start with --.
Any text between -- and the end of the line will be ignored (will not be executed).
--Select all column: SELECT * FROM Employee; |
You can also use single line comment like below.
SELECT * FROM Employee; --Select all column: |
Multi-line comments start with /* and end with */. Any text between /* and */ will be ignored.
/*Select all columns in the Employee table:*/ SELECT * FROM Employee; |
You can also use multi line comment like below.
SELECT Employeename, /*Age,*/ City FROM Employee; |
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!