如何使用 MySQL GUI 工具使字段为 NULL?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/289362/
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
How to make a field NULL using MySQL GUI Tools?
提问by nickf
I'm using the MySQL Query Browser (part of the MySQL GUI Tools) and need to change a field to NULL, but I can't figure out how to do it - if I delete the value it tries to update it to ''
. Typing "NULL" makes it try to update to 'NULL'
(a string).
我正在使用 MySQL 查询浏览器(MySQL GUI 工具的一部分)并且需要将一个字段更改为 NULL,但我不知道该怎么做 - 如果我删除了它尝试将其更新为''
. 键入“NULL”使其尝试更新为'NULL'
(字符串)。
I know I could just write a query to do it, but that defeats the entire purpose of the tool, no?
我知道我可以只写一个查询来做到这一点,但这违背了该工具的全部目的,不是吗?
回答by Jonas Kongslund
In MySQL Query Browser, right click on the cell and select 'Clear field content' while the focus is in another cell.
在 MySQL 查询浏览器中,右键单击单元格并选择“清除字段内容”,同时焦点位于另一个单元格中。
In MySQL Workbench, right click on the cell and select 'Set Field to NULL'.
在 MySQL Workbench 中,右键单击单元格并选择“将字段设置为 NULL”。
回答by Israel Rodriguez
In MySQL Workbench, with the cell selected, press Shift + Delete
在 MySQL Workbench 中,选中单元格后,按 Shift + Delete
Tested on 6.3.4.0
在 6.3.4.0 上测试
回答by Klathzazt
Removing the contents:
删除内容:
This works for some tools (sorry to hear it doesn't for yours). This may not appear as null but will when you perform a query.
这适用于某些工具(很抱歉听到它不适用于您的工具)。这可能不会显示为 null,但会在您执行查询时显示。
回答by Phil Jenkins
I'd try Ctrl-0 (zero), because that works in some tools.
我会尝试 Ctrl-0(零),因为它适用于某些工具。