SQL Comments

From WikiOD
Revision as of 13:42, 15 June 2021 by Admin (talk | contribs) (Text replacement - "{{note| This article is an extract of the original Stack Overflow Documentation created by contributors and released under [https://creativecommons.org/licenses/by-sa/3.0/ CC BY-SA 3.0]. This website is not affiliated with Stack Overflow }}" to "{{note| Credit:Stack_Overflow_Documentation }}")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Single-line comments[edit | edit source]

Single line comments are preceded by --, and go until the end of the line:

SELECT *
FROM Employees -- this is a comment
WHERE FName = 'John'

Multi-line comments[edit | edit source]

Multi*line code comments are wrapped in /* ... */:

/* This query
   returns all employees */
SELECT *
FROM Employees

It is also possible to insert such a comment into the middle of a line:

SELECT /* all columns: */ *
FROM Employees

Credit:Stack_Overflow_Documentation