MySQL 文本列的默认值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5242990/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:01:57  来源:igfitidea点击:

Default value for a text column

mysql

提问by Shaun

I have a column in my table having data type as TEXT.

我的表中有一个数据类型为TEXT.

How can I give it a default NULLvalue, so that when there is not entry in the column it doesn't consume memory.

我怎样才能给它一个默认NULL值,以便当列中没有条目时它不会消耗内存。

I was reading a similar question on a forum where they said column should be allowed for null values; I did that but it doesn't work..

我在论坛上阅读了一个类似的问题,他们说列应该允许为空值;我这样做了,但它不起作用..

回答by BoltClock

TEXTdoes not support default values of anything but NULL. As such, it's implicitly DEFAULT NULL, so you should not need to change anything.

TEXT不支持任何默认值,但NULL. 因此,它是隐式的DEFAULT NULL,因此您不需要更改任何内容。