PGoCareerGoCareer prep tools
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

SQL · Theory

How to Comment

← All stacks

Theory

340/439

How to Comment

-- this is a line comment (space after --). # also works in MySQL. /* block comment */ can span lines.

Don’t put secrets in comments in dumps. Nested /* */ can surprise you.

Trap — --comment without a space after -- in some clients.

On the example next to this theory: How to Comment: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.

Exam tip

-- comment and /* block */

How to Comment — sample query

-- How to Comment
CREATE TABLE demo (
  id INTEGER PRIMARY KEY,
  label TEXT NOT NULL,
  qty INTEGER DEFAULT 0
);
INSERT INTO demo (id, label, qty) VALUES
  (1, 'alpha', 2),
  (2, 'beta', 5);
SELECT label, qty FROM demo WHERE qty >= 2 ORDER BY qty DESC;

How to Comment: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.

Short notes

  • Def-- and /* */ comments. # in MySQL.
  • RuleSpace after -- .
  • TrapPassword in a commented dump line.

Questions

1

SQL line comment?

340 / 439

P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.