MySQL注释(转)

MySQL支持3种注释风格:

1、从‘#’字符从行尾。

2、从‘-- ’序列到行尾。请注意‘-- ’(双破折号)注释风格要求第2个破折号后面至少跟一个空格符(例如空格、tab、换行符等等)。

3、从/*序列到后面的*/序列。结束序列不一定在同一行中,因此该语法允许注释跨越多行。

下面的例子显示了3种风格的注释:

SELECT 1+1;     # This comment continues to the end of line
SELECT 1+1;     -- This comment continues to the end of line
SELECT 1 /* this is an in-line comment */ + 1;
SELECT 1+
/*
this is a
multiple-line comment
*/

4、题外话:

如果使用了Mycat的读写分离组件,那么注释也能起到一定作用,比如要连接主库时,Mycat的做法就是从注释入手,指定主库。

 

参考:

http://www.cnblogs.com/end/archive/2011/03/31/2001109.html

posted @ 2017-10-30 08:23  EasonJim  阅读(265)  评论(0编辑  收藏  举报