Skip to content

SQL Comments

Syntax

Comments in SQL can be written as single-line or multi-line notes.

-- This is a single-line comment
/* This is a
multi-line comment */

Example

-- Single-line comment: Select all columns
SELECT *
FROM employees;
/* Output:
| id | name | age | department |
|----|------------|-----|------------|
| 1 | John Doe | 30 | Sales |
| 2 | Jane Smith | 25 | Marketing |
| 3 | Alice Brown| 40 | HR |
*/
/* Multi-line comment:
Select specific columns
from the employees table */
SELECT name, department
FROM employees;
/* Output:
| name | department |
|-------------|------------|
| John Doe | Sales |
| Jane Smith | Marketing |
| Alice Brown | HR |
*/