10.6 Comment Syntax
w
https://dev.mysql.com/doc/refman/5.7/en/comments.html
10.6 Comment Syntax
MySQL Server supports three comment styles:
From a
#
character to the end of the line.From a
--
sequence to the end of the line. In MySQL, the--
(double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on). This syntax differs slightly from standard SQL comment syntax, as discussed in Section 1.8.2.4, “'--' as the Start of a Comment”.From a
/*
sequence to the following*/
sequence, as in the C programming language. This syntax enables a comment to extend over multiple lines because the beginning and closing sequences need not be on the same line.
The following example demonstrates all three comment styles:
mysql>SELECT 1+1; # This comment continues to the end of line
mysql>SELECT 1+1; -- This comment continues to the end of line
mysql>SELECT 1 /* this is an in-line comment */ + 1;
mysql>SELECT 1+
/*
this is a
multiple-line comment
*/
1;
Nested comments are not supported. (Under some conditions, nested comments might be permitted, but usually are not, and users should avoid them.)
MySQL Server supports some variants of C-style comments. These enable you to write code that includes MySQL extensions, but is still portable, by using comments of the following form:
/*! MySQL-specific code
*/
In this case, MySQL Server parses and executes the code within the comment as it would any other SQL statement, but other SQL servers will ignore the extensions. For example, MySQL Server recognizes the STRAIGHT_JOIN
keyword in the following statement, but other servers will not:
SELECT /*! STRAIGHT_JOIN */ col1 FROM table1,table2 WHERE ...
If you add a version number after the !
character, the syntax within the comment is executed only if the MySQL version is greater than or equal to the specified version number. The TEMPORARY
keyword in the following comment is executed only by servers from MySQL 5.1.10 or higher:
CREATE TABLE t1(a INT, KEY (a)) /*!50110 KEY_BLOCK_SIZE=1024 */;
The comment syntax just described applies to how the mysqld server parses SQL statements. The mysql client program also performs some parsing of statements before sending them to the server. (It does this to determine statement boundaries within a multiple-statement input line.)
Comments in this format, /*!12345 ... */
, are not stored on the server. If this format is used to comment stored routines, the comments will not be retained on the server.
Another variant of C-style comment syntax is used to specify optimizer hints. Hint comments include a +
character following the /*
comment opening sequence. Example:
SELECT /*+ BKA(t1) */ FROM ... ;
For more information, see Section 9.9.2, “Optimizer Hints”.
The use of short-form mysql commands such as \C
within multiple-line /* ... */
comments is not supported.
10.6 Comment Syntax的更多相关文章
- Introduction to ASP.NET Web Programming Using the Razor Syntax (C#)
1, http://www.asp.net/web-pages/overview/getting-started/introducing-razor-syntax-c 2, Introduction ...
- centos 7.0 安装nginx 1.9.10
可以参考以前安装成功的案例 centos 7.0 nginx 1.7.9成功安装过程 官网下载 http://nginx.org/en/download.html nginx下载位置 /usr/loc ...
- wordpres 自定义comment样式
http://wange.im/diy-wordpress-comment-style.html function mytheme_comment($comment, $args, $depth) { ...
- 实现textarea限制输入字数(包含中文只能输入10个,全ASCII码能够输入20个)
document.getElementById("<%=textBox1.ClientID %>").value 实现textarea限制输入字数(包含中文只能输入10 ...
- Terminologies in MVC: Part 2 (Razor Engine Syntax vs Web Form)
By Abhishek Jaiswal :) on Mar 21, 2015 In this article we learn about Razor Engine Syntax vs Web For ...
- hibernate注解(自动建表如何有表DDL注释) -- Comment用法
import java.io.Serializable; import java.sql.Date; import java.sql.Timestamp; import javax.persisten ...
- Hadoop 全分布模式 平台搭建
现将博客搬家至CSDN,博主改去CSDN玩玩~ 传送门:http://blog.csdn.net/sinat_28177969/article/details/54138163 Ps:主要答疑区在本帖 ...
- Mysql手册—SQLStatementSyntax
14.1.1 ALTER DATABASE Syntax,可用于修改数据库字符集和校验规则 查看校验规则可如下: 由于utf8的校验规则都是ci(case insensitive),所以是不区分大小写 ...
- 学习 Linux,101: 使用基本 SQL 命令
概述 在本教程中,将学习结构化查询语言 (SQL),包括: 使用基本 SQL 命令 执行基本数据操作 本教程将简要介绍您需要知道的与 LPI 102 考试相关的 SQL 概念. 回页首 数据库和 ...
随机推荐
- ubuntu 新建root用户
1. sudo passwd :设置root用户密码 2. 切换用户 方式一:su 方式二: su root 3. 新增普通用户
- MySql+EF+CodeFirst
ef+mssql详细是许多.net程序员的标配.作为一个程序员当然不能只会mssql这一个数据库,今天简单聊聊ef+mysql.推荐新人阅读. 1]首先创建一个mvc项目,如图: 创建完毕之后再nug ...
- 编辑SE16N表的函数
函数:SE16N_INTERFACE 此外还可以SE16N 输入对应的查询条件后执行debug该变量 GD-SAPEDIT = ‘X’ 和GD-EDIT = ‘X’ 来实现当前SE16N 中该表的编辑
- C#批量将数据插入SQLServer数据库
Database db = CreateDatabase(); var varConnnection = db.CreateConnection(); //获取连 ...
- Java List对象集合按对象属性分组、分组汇总、过滤等操作示例
import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Col ...
- Docker 启动与停止容器
启动已运行过的容器 docker start 容器名称|容器id 如: docker start mycentos 启动所有运行过的容器(注意:反单引号` `), docker ps -a -q 是查 ...
- Codeforces Round #426 (Div. 2) - B
题目链接:http://codeforces.com/contest/834/problem/B 题意:一共有26个门(A-Z表示),然后现在有n个人要走的门和k个守卫.每当有人要经过某个门时,门要一 ...
- boost::regex
https://blog.51cto.com/liam2199/2108548 正则表达式
- New Machine Learning Server for Deep Learning in Nuke(翻译)
最近一直在开发Orchestra Pipeline System,歇两天翻译点文章换换气.这篇文章是无意间看到的,自己从2015年就开始关注机器学习在视效领域的应用了,也曾利用碎片时间做过一些算法移植 ...
- 4--面试总结-promise
promise异步原理: 定义:promise是异步编程的解决方案,可以解决异步回调地狱的问题: 原理:三种状态两种结果的一个状态机:三种状态(pending,fulfilled,rejected)两 ...