Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to delete Column's value in mysql workbench?

 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like this image below , here in database, null value is inserted in Image column index. how to delete Null value here?
Screenshot_2.png
[Thumbnail for Screenshot_2.png]
 
Paul Clapham
Sheriff
Posts: 21581
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you want to delete. That column? (An ALTER TABLE statement.) The rows which contain NULL in that column? (A DELETE FROM TABLE WHERE ... IS NULL statement.) Or did you have something else in mind?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sarojni agrwal wrote:how to delete Null value here?

A NULL value means that there is no value for the record in that database table column. So I don't really understand why you want to delete this value It's merely a representation of MySQL Workbench of a NULL value. So you should provide more details about what you are trying to achieve.
 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I want to delete null values from column in database because , I got NullPointerException when I find length of image in java application, well when I run both queries , it did not remove null values.

1)DELETE FROM extra WHERE 'Image' = "null";

2)ALTER TABLE extra ALTER COLUMN Image DROP DEFAULT;

how can I remove null values please ell me.

 
Dave Tolls
Ranch Hand
Posts: 2110
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IS NULL, not = 'null'.
 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does not matter because I tried NULL also , in both cases query runs successfully, but null values did not remove.
 
Tapas Chand
Ranch Hand
Posts: 583
8
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know there is nothing in that column.
So it is showing NULL in workbench.
So whatever you do, it will continue to show NULL.
 
Tapas Chand
Ranch Hand
Posts: 583
8
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my image column screen shot.
It shows BLOB where data exist, it shows NULL where there is nothing.
It is not workbench though, it is another tool for MySQL.
image.png
[Thumbnail for image.png]
column
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sarojni agrwal wrote:Does not matter because I tried NULL also , in both cases query runs successfully, but null values did not remove.

If you don't want null values in that column, why don't you have a NOT NULL constraint on this column

And if you want to delete the records with a NULL value, you need to use the appropriate syntax in your SQL statement
 
Dave Tolls
Ranch Hand
Posts: 2110
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sarojni agrwal wrote:Does not matter because I tried NULL also , in both cases query runs successfully, but null values did not remove.


No, you misunderstand.

DELETE .... WHERE <some column> IS NULL
not
DELETE .... WHERE <some column> = 'null'
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic