Introduction to MySQL statement comments

Introduction to MySQL statement comments

MySQL supports three types of comments:

1. From the '#' character from the end of the line.

2. From the '--' sequence to the end of the line. Please note that the '-- ' (double dash) comment style requires that the second dash be followed by at least one whitespace character (eg space, tab, newline, etc.).

3. From the /* sequence to the following */ sequence. The closing sequence does not have to be on the same line, so this syntax allows comments to span multiple lines.

The following example shows 3 styles of comments:

//How to write comment statements in mysqlmysql> SELECT 1+1; # This comment continues until the end of the linemysql> SELECT 1+1; -- This comment continues until the end of the linemysql> SELECT 1 /* This is a comment in the middle of a line*/ + 1;
mysql> SELECT 1+
/*
This is a multi-line comment form */
1;

The above comment syntax applies to how the mysqld server parses SQL statements. The MySQL client also performs some statement parsing before sending it to the server. (For example, it parses to determine statement boundaries in multi-statement lines).

Summarize

The above is all about the introduction of MySQL statement comment method in this article. Interested friends can refer to: MySQL optimization using connection (join) instead of subquery, MYSQL subquery and nested query optimization example analysis, MySQL in statement subquery efficiency optimization skills example, etc. If there are any deficiencies, please leave a message to point them out. The editor will reply to you in time and make corrections. I hope it will be helpful to you.

You may also be interested in:
  • Mysql Sql statement comments
  • MySql creates a table with explanation and annotates the table and fields
  • MariaDB (MySQL branch) my.cnf configuration file Chinese annotated version

<<:  React Diff Principle In-depth Analysis

>>:  Explanation of Dockerfile instructions and basic structure

Recommend

Vue sample code for online preview of office files

I'm working on electronic archives recently, ...

Full steps to create a password generator using Node.js

Table of contents 1. Preparation 2. Writing comma...

Solution to Vue data assignment problem

Let me summarize a problem that I have encountere...

Mysql slow query optimization method and optimization principle

1. For comparison of date size, the date format p...

MySQL merges multiple rows of data based on the group_concat() function

A very useful function group_concat(), the manual...

VSCode+CMake+Clang+GCC environment construction tutorial under win10

I plan to use C/C++ to implement basic data struc...

Detailed explanation of Vue's custom event content distribution

1. This is a bit complicated to understand, I hop...

How to install nginx in centos7

Install the required environment 1. gcc installat...

MySQL sorting using index scan

Table of contents Install sakila Index Scan Sort ...

Vue practice of preventing multiple clicks

Generally, click events will be divided into diff...

Detailed explanation of MySQL injection without knowing the column name

Preface I feel like my mind is empty lately, as I...

How to remove spaces or specified characters in a string in Shell

There are many methods on the Internet that, alth...