标签:extra mon rac type color 返回 sql div logs
EXTRACT(type FROM date) 用于获取指定的日期值
mysql> SELECT EXTRACT(YEAR FROM ‘2016-07-02‘) AS col1, # 当type为YEAR时,只返回年值 -> EXTRACT(YEAR_MONTH FROM ‘2016-07-02 01:02:03‘) AS col2, # 当type为YEAR_MONTH时,返回年与月 -> EXTRACT(DAY_MINUTE FROM ‘2016-07-02 01:02:03‘) AS col3; # 当type为DAY_MINUTE时,返回日、小时、分钟 +------+--------+-------+ | col1 | col2 | col3 | +------+--------+-------+ | 2016 | 201607 | 20102 | +------+--------+-------+
标签:extra mon rac type color 返回 sql div logs
原文地址:http://www.cnblogs.com/pzk7788/p/6896506.html