mysql 查看help手册

作用:解决 记得函数,不记得语法的窘境

查看总的目录


 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> ? functions
//其下的分类
You asked for help about help category: "Functions"
For more information, type 'help <item>', where <item> is one of the following
categories:
   Bit Functions
   Comparison operators
   Control flow functions
   Date and Time Functions
   Encryption Functions
   Information Functions
   Logical operators
   Miscellaneous Functions
   Numeric Functions
   String Functions

再接着来

mysql> ? string functions
//截一段
You asked for help about help category: "String Functions"
For more information, type 'help <item>', where <item> is one of the following
topics:
   ASCII
   BIN
   BINARY OPERATOR
   BIT_LENGTH
   CAST
   CHAR FUNCTION
   CHARACTER_LENGTH
   CHAR_LENGTH
   CONCAT
   CONCAT_WS
   CONVERT
   ELT
   EXPORT_SET
   EXTRACTVALUE

接着即是相应的说明

mysql> ? convert


Name: 'CONVERT'
Description:
Syntax:
CONVERT(expr,type), CONVERT(expr USING transcoding_name)

The CONVERT() and CAST() functions take an expression of any type and
produce a result value of a specified type.

CAST() and CONVERT(... USING ...) are standard SQL syntax. The
non-USING form of CONVERT() is ODBC syntax.

CONVERT() with USING converts data between different character sets. In
MySQL, transcoding names are the same as the corresponding character
set names. For example, this statement converts the string 'abc' in the
default character set to the corresponding string in the utf8 character
set:

SELECT CONVERT('abc' USING utf8)

The type for the result can be one of the following values:

o BINARY[(N)]

o CHAR[(N)]

o DATE

o DATETIME

o DECIMAL[(M[,D])]

o SIGNED [INTEGER]

o TIME

o UNSIGNED [INTEGER]

BINARY produces a string with the BINARY data type. See
http://dev.mysql.com/doc/refman/5.5/en/binary-varbinary.html for a
description of how this affects comparisons. If the optional length N
is given, BINARY(N) causes the cast to use no more than N bytes of the
argument. Values shorter than N bytes are padded with 0x00 bytes to a
length of N.

CHAR(N) causes the cast to use no more than N characters of the
argument.

URL: http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html

Examples:
SELECT enum_col FROM tbl_name ORDER BY CAST(enum_col AS CHAR)

所以,简单来说,比如不知道 date怎么用,就是

? date
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值