Course Resources

Search

Search IconIcon to open search

Last updated Nov 17, 2024

# Select and Filter Data - SQL Comments

Comments in SQL are used to explain sections of SQL statements, or to prevent execution of SQL statements. They are helpful for documentation purposes and making code more readable.

# Types of Comments:

# Single-Line Comments

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

# Multi-Line Comments:

1
2
3
/* This is a multi-line comment
   that covers multiple lines */
SELECT * FROM Employees;

Comments are a crucial part of writing maintainable, understandable SQL code, especially in complex queries or when working in teams. They allow you to explain why a certain SQL statement is used, or to temporarily disable parts of SQL code during testing and development.

# Lessons