mysql text类型没有默认值,如果该字段没有值,则该字段是空,即[b]is null[/b]
使用select语句时应注意:(test是表名,description是字段名,类型是text)
[b]select * from test where description = null;[/b] 等价为
[b]select * from test where description = 'null';[/b]
即此时description 值是null才可以取出。
如果description字段没有填入值,是系统设置的,则执行
[b]select * from test where description is null;[/b]即可
使用select语句时应注意:(test是表名,description是字段名,类型是text)
[b]select * from test where description = null;[/b] 等价为
[b]select * from test where description = 'null';[/b]
即此时description 值是null才可以取出。
如果description字段没有填入值,是系统设置的,则执行
[b]select * from test where description is null;[/b]即可
本文详细介绍了 MySQL 中 TEXT 类型字段的默认值特性及其查询方式。指出 TEXT 类型不支持默认值设置,当字段为空时将返回 NULL。文章还对比了不同 SQL 语句在查询 NULL 值时的区别。
9840

被折叠的 条评论
为什么被折叠?



