In different mysql versions, many features and syntax may be different. How can we know what the syntax of the current version is like? The best way is to learn to use mysql's help. The method is very simple:
1.1 Look at the help by level
If you don’t know what the help can provide, you can look down layer by layer:
The command is as follows:
mysql>sss ? contentsnnn
You asked for helpabouthelpcategory:"Contents"
For more information, type 'help
categories:
AccountManagement
Administration
Data Definition
Data Manipulation
Data Types
Functions
FunctionsandModifiers for Usewith GROUPBY
GeographicFeatures
Langu ageStructure
Plugins
Storage Engines
Stored Routines
Table Maintenance
Transactions
Triggers
For the listed categories, you can look at the part you are interested in, for example:
mysqsssl> ? datatatattyppppes
You asked for helpabouthelpcategory: "DataTypes"
For more information, type'help< ;item>', where
topics:
AUTO_INCREMENT
BIGINT
BINARY
BIT
BLOB
BLOBDATA TYPE
BOOLEAN
. . . . . .
For the specific data types listed, you can see further details:
mysql>sss? int
Name: 'INT'
Description:
INT[(M)] [UNSIGNED][ZEROFILL]
A normal-sizeinteger.The signedrangeis-2147483648 to 2147483647.
The unsignedrangeis0to 4294967295.
1.2 Quick reference help
In practice, if we need to quickly check a certain grammar, we can use keywords for quick query. For example, if I want to know what the show command can see, I can use the following command:
mysql>sss ? showwww
Name: 'SHOW' server.Thissectiondescribes
those following:
SHOWAUTHORS
SHOWCHARACTERSET[LIKE 'pattern']
SHOWCOLLATION[LIKE 'pattern']
SHOW[FULL]COLUMNSFROM tbl_name[FROM db_name] [LIKE 'pattern']
SHOWCONTRIBUTORS
SHOWCREATEDATABASEdb _name
SHOWCREATEEVENT event_name
SHOWCREATEFUNCTION funcname
. . . . . .
I want to know the syntax of createtable, you can use the following command:
mysql>sss ? createttt tablebbb
Name: 'CREATETABLE'
Description:
Syntax:
CREATE[TEMPORARY]TABLE[IFNOT EXISTS]tbl_name
(create_definition,...)
[table_option...]
[partition_options]
Or:
CREATE[TEMPORARY]TABLE[IFNOT EXISTS]tbl_name
[(create_definition,...)]
[table_option...]
[partition_options]
select_statement
Thank you for reading. For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!