Single-line comment in sql
- how to comment out in sql
- how to comment out in sql workbench
- how to comment out in sql shortcut
- how to comment out in sql server management studio
How to comment out multiple lines in sql
How to comment in mysql.
Problem
You'd like to comment your code in SQL.
Example
Here's the example code:
SELECT name, COUNT(*) AS count_items FROM products GROUP BY name HAVING COUNT(*) > 5 ORDER BY name DESC;Use to comment code till the end of the line.
Here is what it looks like:
-- product names along with the number of items -- products ordered by name in descending order SELECT name, COUNT(*) -- AS count_items FROM products GROUP BY name -- HAVING COUNT(*) > 5 ORDER BY name DESC;Discussion
You can write single-line comments in SQL using .
After the , you can write any comment you'd like as long as it's in one line. If you'd like to write a comment spanning multiple lines, you can use at the beginning of each comment line, just as in the example:
-- product names along with the number of items -- products ordered by name in descending orderYou can also use to comment out a whole line of code or a part of a line from some place in the middle of the line to the end of the line.
For example, you can comment out but leave the in.
COUNT(*) -- AS count_itemsNote that when you use you comme
- how to comment out in sql developer
- how to comment out in sqlite