日期相关
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)
时间: 2024-10-29 19:46:00