Skip
Arish's avatar

19. Single-Line Comments


SQL Comments

Comments help document your SQL code. They're ignored during execution.

Single-Line Comments

Use -- (two dashes):

sql
1-- This is a comment
2SELECT * FROM students;
3
4SELECT * FROM students; -- Get all students

Example

sql
1-- Find all Python students
2SELECT * FROM students
3WHERE course = 'Python';

Best Practices

  • Explain complex logic
  • Document table purposes
  • Note query intentions