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

SQL · Theory

Syntax

← All stacks

Theory

374/439

Syntax

MySQL statements: keyword, names, ; at the end. Keywords are not case-sensitive (select vs SELECT). String values are. Names: letters, numbers, underscore. Use backticks `order` if you must use a reserved word.

Comments — -- to end of line, or /* block */. Strings in single quotes. Double quotes depend on sql_mode ANSI_QUOTES.

Trap — semicolon missing in the CLI so the next line ‘is part of the query’. Trap: “smart quotes” from Word.

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

Exam tip

SELECT … ; -- comment. Quotes for strings, backticks for names.

Syntax — sample query

-- Syntax
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;

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

Short notes

  • DefStatement + semicolon. Keywords case-insensitive.
  • Rule'strings' in single quotes. Backticks for reserved names.
  • TrapMissing ; in the mysql client.

Questions

1

How do you comment in MySQL?

374 / 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.