How to make a field NULL using MySQL GUI Tools?
Asked Answered
B

7

69

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).

I know I could just write a query to do it, but that defeats the entire purpose of the tool, no?

Biflagellate answered 14/11, 2008 at 6:25 Comment(0)
K
144

In MySQL Query Browser, right click on the cell and select 'Clear field content' while the focus is in another cell.

In MySQL Workbench, right click on the cell and select 'Set Field to NULL'.

Keyes answered 14/11, 2008 at 6:37 Comment(3)
In MySQL Workbench this setting is now called Set Field(s) to NULL, and is the first option in the list.Antibody
Expanding upon @MerlynMorgan-Graham's comment, this option is only visible if you right-click the cell when it does not have the text insertion point in it.Keos
William's detail is crucial. Shift+Del and others mentioned in other answers don't work for me for some reason. However, if all else fails, you can click apply and just edit the update statement (script) field to just say null.Meritocracy
J
10

In MySQL Workbench, with the cell selected, press Shift + Delete

Tested on 6.3.4.0

Juristic answered 30/5, 2016 at 19:46 Comment(0)
F
2

Right-click on that column and select the

'Set field to Null'

option from the context menu.

Fabled answered 21/7, 2020 at 19:58 Comment(0)
E
1

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.

Ema answered 14/11, 2008 at 7:10 Comment(1)
in MySQL at least, an empty string is different to NULL. Selecting and deleting the column contents sets it to be an empty string (which doesn't work at all if your column is numerical)Biflagellate
D
0
Shift + Delete 

work well in MySql Workbench 8

Decode answered 11/6, 2020 at 12:26 Comment(0)
M
-2

I make Beekeeper Studio, and also make a free and open source community edition.

If anyone is using my tool, instead of remembering a weird key combo you can clear a cell by using backspace, the cell will show as (blank). Then hit backspace again to set it to (NULL).

I think this is pretty intuitive, let me know what you think.

gif of double backspace

Matty answered 30/6 at 20:33 Comment(1)
While this does provide an answer, the question is specifically asking about the official MySQL Workbench product.Margheritamargi
P
-3

I'd try Ctrl-0 (zero), because that works in some tools.

Pseudoscope answered 14/11, 2008 at 6:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.