当我们尝试对表中存储的日期值进行此类操作时,Mysql 会将日期值假设为数字并执行算术运算。假设我们有一个名为“example”的表在“orderdate”列中有一个日期值,然后进行算术运算将澄清上述内容 -mysql> selec&
当我们尝试对表中存储的日期值进行此类操作时,Mysql 会将日期值假设为数字并执行算术运算。
假设我们有一个名为“example”的表在“orderdate”列中有一个日期值,然后进行算术运算将澄清上述内容 -
mysql> select * from example;
+------------+
| orderdate |
+------------+
| 2017-05-25 |
+------------+
1 row in set (0.00 sec)
mysql> select orderdate+10 from example;
+--------------+
| orderdate+10 |
+--------------+
| 20170535 |
+--------------+
1 row in set (0.00 sec)
mysql> select orderdate*10 from example;
+--------------+
| orderdate*10 |
+--------------+
| 201705250 |
+--------------+
1 row in set (0.00 sec)
mysql> select orderdate-10 from example;
+--------------+
| orderdate-10 |
+--------------+
| 20170515 |
+--------------+
1 row in set (0.00 sec)
mysql> select orderdate/10 from example;
+--------------+
| orderdate/10 |
+--------------+
| 2017052.5 |
+--------------+
1 row in set (0.00 sec)
--结束END--
本文标题: 加法、减法、乘法和除法运算符如何处理 MySQL 表中存储的日期值?
本文链接: https://www.lsjlt.com/news/438428.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-13
2024-05-13
2024-05-13
2024-05-13
2024-05-12
2024-05-12
2024-05-12
2024-05-12
2024-05-12
2024-05-12
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0