MySQL EXTRACT() 函數可以使用以下複合單位-
YEAR_MONTH
EXTRACT() 函數中使用的這些複合單位的一些範例如下-mysql> Select EXTRACT(YEAR_MONTH from '2017-10-20'); +---------------------------------------+ | EXTRACT(YEAR_MONTH from '2017-10-20') | +---------------------------------------+ | 201710 | +---------------------------------------+ 1 row in set (0.00 sec)
mysql> Select EXTRACT(DAY_HOUR from '2017-10-20 05:46:45'); +----------------------------------------------+ | EXTRACT(DAY_HOUR from '2017-10-20 05:46:45') | +----------------------------------------------+ | 2005 | +----------------------------------------------+ 1 row in set (0.00 sec)
mysql> Select EXTRACT(DAY_MICROSECOND from '2017-10-22 05:52:45.102356'); +---------------------------------------------------------------------------+ | EXTRACT(DAY_MICROSECOND from '2017-10-22 05:52:45.102356') | +---------------------------------------------------------------------------+ | 22055245102356 | +---------------------------------------------------------------------------+ 1 row in set (0.00 sec)
以上是MySQL EXTRACT() 函數中可以使用哪些複合單元?的詳細內容。更多資訊請關注PHP中文網其他相關文章!