最好在MySQL中使用零日期'0000-00-00 00:00:00'或NULL? [英] Better to use zero-date '0000-00-00 00:00:00' or NULL in MySQL?

查看:211
本文介绍了最好在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:00NULL.

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆