SQL Comments




💬 Introduction

Comments help document SQL queries, making them easier to read and maintain. SQL supports single-line and multi-line comments.

1️⃣ Single-Line Comments (–)

-- This is a single-line comment
SELECT * FROM Employees;

2️⃣ Multi-Line Comments (/* … */)

/*
This is a multi-line comment
It can span multiple lines
*/
SELECT * FROM Employees;
Tip: Use comments to explain complex queries or temporarily disable SQL code during testing.

✅ Key Takeaways

  • Single-line comment: -- comment
  • Multi-line comment: /* comment */
  • Comments do not affect query execution
  • Use comments to improve code readability and maintainability

📚 Continue Learning

💬 Questions about SQL comments? Ask in the comments below!




Leave a Comment