Comments
christian.dinh2476 total contributions
Published May 6, 2021Updated Sep 9, 2021
Contribute to Docs
A comment is a piece of text within a program that is not executed. It can be used to provide additional information to aid in understanding the code, or to prevent execution of SQL statements.
Single-line Comments
Single line comments start with --
. Any text between --
and the end of the line will be ignored (will not be executed).
The following example uses a single-line comment as an explanation:
-- Select all:SELECT *FROM customers;
Multi-line Comments
Multi-line comments start with /*
and end with */
.
Any text between /*
and */
will be ignored.
The following example uses a multi-line comment as an explanation:
/* Select everythingfrom the customers table */SELECT *FROM customers;
The following example uses a multi-line comment to ignore many statements:
/* SELECT *FROM customers;SELECT *FROM products; */SELECT *FROM orders;
To ignore just a part of a statement, also use the /*
*/
comment.
The following example uses a comment to ignore part of a line:
SELECT id, customer_name, /* city, */ countryFROM customers;
All contributors
- christian.dinh2476 total contributions
- Anonymous contributorAnonymous contributor3071 total contributions
- christian.dinh
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.