Comment (computer programming): Difference between revisions

Content deleted Content added
Examples: Merge Lua into double dash section
Examples: merge SQL into double dash section
Line 533:
]]
</syntaxhighlight>
 
==== Block in SQL ====
Alternatively,In asome commentvariants formatof syntaxSQL, identicalthe tocurly thebrace language "block comment" style used in the syntax for C and Java(<code>/**/</code>) is supported. Variants byinclude: [[Transact-SQL]], [[MySQL]], [[SQLite]], [[PostgreSQL]], and [[Oracle Database|Oracle]].<ref name="MSSQL">{{cite book
| title = Microsoft SQL Server 7
| first = Ronald R.
| last = Talmage
| publisher = Prima Publishing
| year = 1999
| isbn = 978-0-7615-1389-6
| url = https://archive.org/details/microsoftsqlserv00talm
}}</ref><ref name="MySQL">{{cite web | url=https://dev.mysql.com/doc/refman/8.0/en/comments.html | title=MySQL 8.0 Reference Manual | publisher=Oracle Corporation | access-date=January 2, 2020}}</ref><ref name="SQLite">{{cite web | url=https://www.sqlite.org/lang_comment.html | title=SQL As Understood By SQLite | publisher=SQLite Consortium | access-date=January 2, 2020}}</ref><ref name="PostgreSQL">{{cite web | url=https://www.postgresql.org/docs/10/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS | title=PostgreSQL 10.11 Documentation | publisher=The PostgreSQL Global Development Group | access-date=January 2, 2020}}</ref><ref name="Oracle">{{cite web | url=https://docs.oracle.com/cd/B13789_01/server.101/b10759/sql_elements006.htm | title=Oracle® Database SQL Reference | publisher=Oracle Corporation | access-date=January 2, 2020}}</ref>
 
MySQL also supports a line comment delimited by <code>#</code>.
 
===By language===
Line 735 ⟶ 748:
}
</syntaxhighlight>
 
==== SQL ====
Standard comments in SQL are in single-line-only form, using two dashes:
<syntaxhighlight lang="sql">
-- This is a single line comment
-- followed by a second line
SELECT COUNT(*)
FROM Authors
WHERE Authors.name = 'Smith'; -- Note: we only want 'smith'
-- this comment appears after SQL code
</syntaxhighlight>
Alternatively, a comment format syntax identical to the "block comment" style used in the syntax for C and Java is supported by [[Transact-SQL]], [[MySQL]], [[SQLite]], [[PostgreSQL]], and [[Oracle Database|Oracle]].<ref name="MSSQL">{{cite book
| title = Microsoft SQL Server 7
| first = Ronald R.
| last = Talmage
| publisher = Prima Publishing
| year = 1999
| isbn = 978-0-7615-1389-6
| url = https://archive.org/details/microsoftsqlserv00talm
}}</ref><ref name="MySQL">{{cite web | url=https://dev.mysql.com/doc/refman/8.0/en/comments.html | title=MySQL 8.0 Reference Manual | publisher=Oracle Corporation | access-date=January 2, 2020}}</ref><ref name="SQLite">{{cite web | url=https://www.sqlite.org/lang_comment.html | title=SQL As Understood By SQLite | publisher=SQLite Consortium | access-date=January 2, 2020}}</ref><ref name="PostgreSQL">{{cite web | url=https://www.postgresql.org/docs/10/sql-syntax-lexical.html#SQL-SYNTAX-COMMENTS | title=PostgreSQL 10.11 Documentation | publisher=The PostgreSQL Global Development Group | access-date=January 2, 2020}}</ref><ref name="Oracle">{{cite web | url=https://docs.oracle.com/cd/B13789_01/server.101/b10759/sql_elements006.htm | title=Oracle® Database SQL Reference | publisher=Oracle Corporation | access-date=January 2, 2020}}</ref>
 
MySQL also supports comments from the hash (#) character to the end of the line.
 
====XML and HTML====