Some of the knowledge points that MySQL summarizes when doing exercises

Source: Internet
Author: User
Tags mysql client

Some of the knowledge points that MySQL summarizes when doing exercises
There are three ways to annotate 0:mysql

I inserted records in the morning has not been successful, depressed do not know why. Because many records are inserted together, some of the unused data in the middle is annotated with "--" and the result is not effective.

There is no way to find on the Internet, only to find the comment "--" wrong, need a space, should be "--".

There are three types of MySQL annotations: 1, # ... 2, "--..." 3, MySQL server support # to the end of the line 、--to the end of the line and the comment square:

Mysql> SELECT; # This comment until the end of the line
Mysql> SELECT; --this comment until the end of the line
Mysql> SELECT 1 + 1;
Mysql> SELECT 1+

1;

Note--(double length dash) Note style requires at least one space after two long strokes!

Although the server understands the syntax of the annotations just described, the syntax of the MySQL client is restriction in the notation:

Single and double quotation marks are used to mark the beginning of a quoted string, even in a comment. If the quotation marks in the note do not have another quotation mark paired with it, the parser does not consider the comment to be complete. If you run MySQL interactively, you will get confused because the prompt changes from mysql> to ' > or ' >.

A semicolon is used to indicate the end of the current SQL statement and anything that follows it represents the beginning of the next line.

Whether you run MySQL interactively or put a command in a file, and then use MySQL < Some-file to tell MySQL to read its input, this restriction exists.

I think: the best way to start a single-line comment, and do not use the--, because-make comments must have at least one space behind, sometimes forget to write the error will appear!

1:enum enumeration type, if not NULL is set and no default value is specified, the default value is the first (even if the default of the enum shown in DESC tablename is null), In addition, the default value of enum can only be one of the list, cannot be set to null default ' 2: When setting foreign keys, you must be aware that the type is exactly the same

Some of the knowledge points that MySQL summarizes when doing exercises

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.