SQL CommentsSQL Comments are used to explain the sections of the SQL statements, and used to prevent the statements of SQL. In many programming languages, comments matter a lot. A Microsoft Access database does not support the comments. So, Mozilla Firefox and Microsoft Edge use the Microsoft Access database in the examples. There are three types of comments, which are given below:
Single Line CommentComments starting and ending with a single line are said as individual line comments. The line which starts with '–' is a single line comment, and that particular line is not executed. The text between -- and end of the line is ignored and cannot be executed. Syntax:
The following example uses a single-line comment: Example 1The given example uses a single-line comment to ignore the end of the line: Example 2The following example uses the single-line comment to ignore the statements: Example 3Multi-line CommentsComments that start in one line and end in different front are said as multi-line comments. The text between /* and */ is ignored in the code part. The line starting with '/*' is considered as a starting point of comment and terminated when '*/' lies at the end. Syntax: Example 1The below example uses a multi-line comment to ignore more statements: Example 2To ignore some part of a statement, use the /*....... */ comment. The following example uses a comment to ignore some part of any code: Example of SQL Multi-line Comment:ExampleThe following example uses a comment to not to be the part of a statement: ExampleInline comments:Inline comments are an extension of multi-line comments, and comments can be stated between the statements and are enclosed in between '/*' and '*/.' Syntax: SELECT * FROM /*Employees; */ Examples:In line comment -> SQL Comment IndicatorsSQL Comment Indicator is indicated according to the given examples It includes the double hyphen ( — ), braces ( { } ), and C-style ( /* . . . */ ) comment delimiters. It also includes the comments after the statement. In the below examples, we place the comments on a single line code - Examples of multi-line statements -Next TopicSQL Tutorial |