/*!select count(*) from mysql.user*/;+----------+| count(*) |+----------">

mysql的注释符有哪些

来源:这里教程网 时间:2026-02-28 14:55:18 作者:

本教程操作环境:windows7系统、mysql5.7.27版本、Dell G3电脑。

MySQL注释符有三种:

1、

#注释内容
,表示单行注释

2、"

--  注释内容
" (注意--后面有一个空格)

3、

/*注释内容*/

示例如下所示:

MySQL [(none)]> /*!select count(*) from mysql.user*/;
+----------+
| count(*) |
+----------+
|        7 |
+----------+
1 row in set (0.07 sec)
  
MySQL [(none)]> /* !select count(*) from mysql.user*/;
ERROR:
No query specified
  
MySQL [(none)]> /* select count(*) from mysql.user*/;
ERROR:
No query specified
  
  
MySQL [(none)]> select @@version;
+--------------+
| @@version    |
+--------------+
| 5.7.27-5-log |
+--------------+
1 row in set (0.06 sec)
  
  
MySQL [(none)]> /*!50727 select count(*) from mysql.user*/;
+----------+
| count(*) |
+----------+
|        7 |
+----------+
1 row in set (0.08 sec)
  
MySQL [(none)]> /*!50728 select count(*) from mysql.user*/;
Query OK, 0 rows affected (0.06 sec)

MySQL服务器版本是5.7.27,当MySQL服务器版本大于或等于5.7.28时,最后的SQL语句才会被执行。

【相关推荐:mysql视频教程】

相关推荐