sql DATETIME(),DATE(),TIME()

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql DATETIME(),DATE(),TIME()相关的知识,希望对你有一定的参考价值。

\!h DATETIME()
-- Example - date and time for all deliveries in the baked_goods table using the column delivery_time:
SELECT DATETIME(delivery_time)
FROM baked_goods;

\!h DATE()
-- Example - the number of baked_goods manufactured by day:
SELECT DATE(manufacture_time), count(*) as 
count_baked_goods
FROM baked_goods
GROUP BY DATE(manufacture_time);

\!h TIME()
-- Same as above but querying just time:
SELECT TIME(manufacture_time), count(*) as 
count_baked_goods
FROM baked_goods
GROUP BY TIME(manufacture_time);

以上是关于sql DATETIME(),DATE(),TIME()的主要内容,如果未能解决你的问题,请参考以下文章