MySQL 内建函数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL 内建函数相关的知识,希望对你有一定的参考价值。
日期相关
mysql> select curdate(),curtime(),now(),unix_timestamp(),week(‘2017-07-24‘),year(‘2017-07-24‘),hour(‘16:15:11‘),date_format(‘2017-07-24‘,‘%m-%d,%y‘); +------------+-----------+---------------------+------------------+--------------------+--------------------+------------------+--------------------------------------+ | curdate() | curtime() | now() | unix_timestamp() | week(‘2017-07-24‘) | year(‘2017-07-24‘) | hour(‘16:15:11‘) | date_format(‘2017-07-24‘,‘%m-%d,%y‘) | +------------+-----------+---------------------+------------------+--------------------+--------------------+------------------+--------------------------------------+ | 2017-07-24 | 16:18:37 | 2017-07-24 16:18:37 | 1500884317 | 30 | 2017 | 16 | 07-24,17 | +------------+-----------+---------------------+------------------+--------------------+--------------------+------------------+--------------------------------------+ 1 row in set (0.00 sec)
其他常用
mysql> select database(),version(),user(),inet_aton(‘118.11.22.33‘),password(‘1‘),md5(‘1‘); +------------+------------+----------------+---------------------------+-------------------------------------------+----------------------------------+ | database() | version() | user() | inet_aton(‘118.11.22.33‘) | password(‘1‘) | md5(‘1‘) | +------------+------------+----------------+---------------------------+-------------------------------------------+----------------------------------+ | NULL | 5.6.34-log | root@localhost | 1980438049 | *E6CC90B878B948C35E92B003C792C46C58C4AF40 | c4ca4238a0b923820dcc509a6f75849b | +------------+------------+----------------+---------------------------+-------------------------------------------+----------------------------------+ 1 row in set (0.00 sec)
以上是关于MySQL 内建函数的主要内容,如果未能解决你的问题,请参考以下文章