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