最近在查看服务器导出的MySQL sql文件时发现如下代码:
/*!50001 CREATE VIEW `cxda_cheat_view` AS SELECT
1 AS `studentID`,
1 AS `name`,
1 AS `gender`,
1 AS `subject`,
1 AS `result`,
1 AS `detail`,
1 AS `grade`,
1 AS `politicalStatus`,
1 AS `IDNumber`,
1 AS `address`,
1 AS `remark`,
1 AS `time`,
1 AS `creator`,
1 AS `department`,
1 AS `major`,
1 AS `id`,
1 AS `dpid`*/;
在MySQL里,多行注释使用 /* */,这个是SQL的标准 ,那么MySQL语句中/*!50001是什么意思呢?
这是MySQL扩展的注释方法,这里的50001表示版本判断,如果MySQL数据库版本是5.00.01以上,该语句才会被执行,如果版本低于5.00.01,则语句被注释。