
Comments
Introduction
For various reasons, it can be useful to add comments to code.
For example:
- For clarification of the code.
- To indicate what still needs to be done.
Below we see a first example of a comment
1. Line comments
When you want to place comments in 1 line, use a line comment.
For this, use two dashes:
See the example below:
2. Block comments
When you want to place comments in multiple lines, use a block comment.
For this, use /* to open, and */ to close:
See the example below:
/*
Author: SQL training
Creation date: Not so long ago
Description: Select data from movies table starting at year 2000
*/
SELECT
*
FROM
movies
WHERE
year > 2000
ORDER BY
rank DESC;
Summary
- With comments, you can add commentary to code.
- Line comments on one line:
- Block comments on multiple lines: