2010年(6)
分类: DB2/Informix
2010-07-10 10:37:32
INFORMIX SQL语句笔记(八)注释
2008-10-23
以下INFORMIX SQL语句均经过测试,如非特别注明,测试版本为IDS11.5开发版。每一期结合一个具体应用详细介绍。
一、SQL注释示例
SQL 注释的示例
这些示例说明了使用 SQL 注释指示符的不同方式。
以下示例使用了每种注释指示符的样式,包括双连字符(--)、花括号({ })和 C 样式(/* . . . */)注释定界符以在 SQL 语句之后包含注释。该注释与语句显示在同一行。
SELECT * FROM customer; -- Selects all columns and rows
SELECT * FROM customer; {Selects all columns and rows}
SELECT * FROM customer; /*Selects all columns and rows*/
下面的三个示例使用与先前的示例相同的 SQL 语句和相同的注释,但注释自成一行,具体如下:
SELECT * FROM customer;
-- Selects all columns and rows
SELECT * FROM customer;
{Selects all columns and rows}
SELECT * FROM customer;
/*Selects all columns and rows*/
在以下示例中,用户输入与先前的示例相同的 SQL 语句,但是每个语句后跟多行注释(或对于双连字符有两行注释),具体如下:
SELECT * FROM customer;
-- Selects all columns and rows
-- from the customer table
SELECT * FROM customer;
{Selects all columns and rows
from the customer table}
SELECT * FROM customer;
/*Selects all columns and rows
from the customer table*/
任何这些样式中的注释还可以出现在 SQL 语句中,具体如下:
SELECT * -- Selects all columns and rows
FROM customer; -- from the customer table
SELECT * {Selects all columns and rows}
FROM customer; {from the customer table}
SELECT * /*Selects all columns and rows*/
FROM customer; /*from the customer table*/
如果使用由成对的开始和结束指示符定界的花括号或 C 样式,那么关闭的注释指示符必须是与开始注释指示符相同的样式。