Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Overview of SQL Syntax > How to Enter SQL Comments >

Examples of SQL Comment Symbols

These examples illustrate different ways to use the SQL comment indicators.

Examples of the Double-Hyphen Symbol

The next example uses the double hyphen ( -- ) to include a comment after an SQL statement. The comment appears on the same line as the statement.

SELECT * FROM customer -- Selects all columns and rows

The following example uses the same SQL statement and the same comment as in the preceding example, but places the comment on a separate line:

SELECT * FROM customer
   -- Selects all columns and rows

In the following example, the user enters the same SQL statement as in the preceding example but now enters a multiple-line comment:

SELECT * FROM customer
   -- Selects all columns and rows
   -- from the customer table

Examples of the Braces Symbols

This example uses braces ( { } ) to delimit a comment after an SQL statement. In this example, the comment appears on the same line as the statement.

SELECT * FROM customer {Selects all columns and rows} 

The next example uses the same SQL statement and the same comment as in the preceding example, but the comment appears on a line by itself:

SELECT * FROM customer
   {Selects all columns and rows} 

In the following example, the same SQL statement as in the preceding example is followed by a multiple-line comment:

SELECT * FROM customer
   {Selects all columns and rows
    from the customer table}
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]