要想早日成为数据库的大牛,学会使用帮助文档很重要,当碰到问题的时候,可以快速拿出葵花宝典这个利器解决问题,哈哈。
文档的获取,网上百度,这个可以说最方便,但是作为一个运维人员的话,有可能你远程的机器不能使用外网。
命令行帮助
? contents 显示所有可供查询的分类
mysql> ? contents
You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the following
categories:
Account Management
Administration
Compound Statements
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Help Metadata
Language Structure
Plugins
Procedures
Storage Engines
Table Maintenance
Transactions
User-Defined Functions
Utility
mysql>
敲入对应的分类即可查看具体信息,举例
mysql> ? Data Types
You asked for help about help category: "Data Types"
For more information, type 'help <item>', where <item> is one of the following
topics:
AUTO_INCREMENT
BIGINT
BINARY
BIT
BLOB
BLOB DATA TYPE
BOOLEAN
CHAR
CHAR BYTE
DATE
DATETIME
DEC
DECIMAL
DOUBLE
DOUBLE PRECISION
ENUM
FLOAT
INT
INTEGER
LONGBLOB
LONGTEXT
MEDIUMBLOB
MEDIUMINT
MEDIUMTEXT
SET DATA TYPE
SMALLINT
TEXT
TIME
TIMESTAMP
TINYBLOB
TINYINT
TINYTEXT
VARBINARY
VARCHAR
YEAR DATA TYPE
一步一步根据提示,可以知道INT数据类型的范围大小区间
mysql> help INT
Name: 'INT'
Description:
INT[(M)] [UNSIGNED] [ZEROFILL]
A normal-size integer. The signed range is -2147483648 to 2147483647.
The unsigned range is 0 to 4294967295.
URL: http://dev.mysql.com/doc/refman/5.6/en/numeric-type-overview.html
除此之外,还可以敲入关键字获取帮助文档,如? insert,? create table
mysql> ? insert
Name: 'INSERT'
Description:
Syntax:
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[PARTITION (partition_name,...)]
[(col_name,...)]
{VALUES | VALUE} ({expr | DEFAULT},...),(...),...
[ ON DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]
Or:
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[PARTITION (partition_name,...)]
SET col_name={expr | DEFAULT}, ...
[ ON DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]
Or:
INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[PARTITION (partition_name,...)]
[(col_name,...)]
SELECT ...
[ ON DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]
INSERT inserts new rows into an existing table. The INSERT ... VALUES
and INSERT ... SET forms of the statement insert rows based on
explicitly specified values. The INSERT ... SELECT form inserts rows
selected from another table or tables. INSERT ... SELECT is discussed
further in [HELP INSERT SELECT].
In MySQL 5.6.2 and later, when inserting into a partitioned table, you
can control which partitions and subpartitions accept new rows. The
PARTITION option takes a comma-separated list of the names of one or
more partitions or subpartitions (or both) of the table. If any of the
rows to be inserted by a given INSERT statement do not match one of the
partitions listed, the INSERT statement fails with the error Found a
row not matching the given partition set. See
http://dev.mysql.com/doc/refman/5.6/en/partitioning-selection.html, for
more information and examples.
URL: http://dev.mysql.com/doc/refman/5.6/en/insert.html
如果没有命令行帮助新,可以导入mysql目录下的share文件夹下的fill_help_tables.sql
感叹:大公司开发的东西,文档各方面都为我们考虑到了,看齐,要看齐