This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

how to delete Column's value in mysql workbench?

 
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]
 
Marshal
Posts: 24950
61
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?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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.

 
Rancher
Posts: 4450
47
  • 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.
 
Ranch Hand
Posts: 624
9
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: 624
9
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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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
Rancher
Posts: 4450
47
  • 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'
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this query to delete null values in table :

 
Marshal
Posts: 67464
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Purvi Barot wrote:. . .

It is a long time since I did any SQL, but I think that query is incorrect. Maybe it should read, “delete *...
You may have a long wait for a reply from SA.
 
Campbell Ritchie
Marshal
Posts: 67464
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am told the SQL was correct after all; sorry.
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!