Commenting SQL code
Commenting is essential for writing SQL scripts. You need to use comments so that others can understand why your code works the way it does. If you don't include comments, it will be difficult to use and modify the code later.
Commenting helps you make clear what you are trying to accomplish with each piece of your code. There is an optimal amount of commenting that you should use. For instance, you don't want to not include any comments, but you probably don't want to include comments for every single line. In the preceding CREATE TABLE code sample, you could add a comment at the top that explains why you are creating this table, what it contains, who you are, and when you created it.
To create a single-line comment, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access