EXTRACT()("提取"的意思) 函数用于返回日期/时间的单独部分,比如年、月、日、小时、分钟等等。
就是返回出来具体的年,月,日
2008-12-29 16:25:46.635
1 SELECT EXTRACT(YEAR FROM OrderDate) AS OrderYear, 2 EXTRACT(MONTH FROM OrderDate) AS OrderMonth, 3 EXTRACT(DAY FROM OrderDate) AS OrderDay 4 FROM Orders
OrderYear | OrderMonth | OrderDay |
---|---|---|
2008 | 12 | 29 |