最好在MySQL中使用零日期'0000-00-00 00:00:00'或NULL? [英] Better to use zero-date '0000-00-00 00:00:00' or NULL in MySQL?
本文介绍了最好在MySQL中使用零日期'0000-00-00 00:00:00'或NULL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MySQL数据库上使用默认日期'0000-00-00 00:00:00'或NULL
是更好的做法吗?
Is it a better practice to use default date '0000-00-00 00:00:00' or NULL
on a MySQL database?
出于计算原因,我最好阅读默认日期为'0000-00-00 00:00:00'
I have read best to use default date '0000-00-00 00:00:00' for the reason of calculations
即 >
比日期短于日期.
如果时间未知,最好按时存储00:00
或NULL
.
Also on time best to store 00:00
or NULL
if time is not known.
推荐答案
默认值应为NOT NULL以便支持所有日期时间操作. 我还使用"0000-00-00 00:00:00"作为默认值.
a default value should be NOT NULL inorder to support all date time operations. i also uses "0000-00-00 00:00:00" as default value.
这篇关于最好在MySQL中使用零日期'0000-00-00 00:00:00'或NULL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文