Database Reference
In-Depth Information
▼
Input
# This is a comment
SELECT prod_name
FROM products;
▼
Analysis
A
#
at the start of a line makes the entire line a comment. You can see this
format comment used in the accompanying
create.sql
and
populate.sql
scripts.
You can also create multiline comments, and comments that stop and start any-
where within the script:
▼
Input
/* SELECT prod_name, vend_id
FROM products; */
SELECT prod_name
FROM products;
▼
Analysis
/*
starts a comment, and
*/
ends it. Anything between
/*
and
*/
is comment
text. This type of comment is often used to
comment out
code, as seen in this
example. Here, two
SELECT
statements are defined, but the first won't execute
because it has been commented out.
In this chapter, you learned how to use the SQL
SELECT
statement to retrieve
a single table column, multiple table columns, and all table columns. You also
learned about commenting and saw various ways that comments can be used.
Next you learn how to sort the retrieved data.