MySQL 我可以在位类型列中插入什么值?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15751207/
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 17:08:50  来源:igfitidea点击:

What value could I insert into a bit type column?

mysqlsqlbooleanbit

提问by James Chen

statue typethe situationI am trying to insert or edit the bit value to "0" or "1", but either returns me a blank.

雕像类型情况我试图将位值插入或编辑为“0”或“1”,但要么返回空白。

Could someone tells me how to insert the value in it?

有人能告诉我如何在其中插入值吗?

Also, Is that possible to not use bit type but Boolean? I see there's a Boolean type in the list of types

另外,是否可以不使用位类型而是使用布尔类型?我看到类型列表中有一个布尔类型

Thanks

谢谢

Hi, I have uploaded the picture, the cell in the table is blank, but I have tried several times, add, update, all take effect, but cell keeps blank...

你好,我已经上传了图片,表格中的单元格是空白的,但是我试了几次,添加,更新,都生效了,但是单元格一直空白...

回答by Kermit

Generally speaking, for booleanor bitdata types, you would use 0or 1like so:

一般来说,对于booleanorbit数据类型,您会使用0or1喜欢这样:

UPDATE tbl SET bitCol = 1 WHERE bitCol = 0

See also:

也可以看看:

回答by Alcides Queiroz Aguiar

If you're using SQL Server, you can set the value of bit fields with 0 and 1

如果您使用的是 SQL Server,则可以使用以下命令设置位字段的值 0 and 1

or

或者

'true' and 'false'(yes, using strings)

'true' and 'false'(是的,使用字符串)

...your_bit_field='false'... => equivalent to 0

回答by Fer

Your issue is in PHPMyAdmin itself. Some versions do not display the value of bit columns, even though you did set it correctly.

您的问题在于 PHPMyAdmin 本身。某些版本不显示位列的值,即使您设置正确。