Monday, January 13, 2025
HomeProgrammingWhat Is The Correct Way To Comment in SQL?

What Is The Correct Way To Comment in SQL? [closed]

In SQL, comments are used to add notes or explanations to your code without affecting its execution. There are two main ways to write comments:

1. Single-line comment: Use — before the comment text. Everything after — on that line is ignored.

See also  How to calculate percentage with a SQL statement

— This is a single-line comment
SELECT * FROM users;

2. Multi-line comment: Use /* to start the comment and */ to end it. This can span multiple lines.

/* This is a
multi-line comment */
SELECT * FROM products;

See also  Oracle Insert Statement

Both are useful for explaining complex queries or temporarily disabling parts of your code.

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x