CodeGuy
CodeGuy

Reputation: 28905

deleting a row where a particular column is empty

I have a table called contacts and a column called name. I'm trying to delete rows where the name field is empty.

I make the following call

delete from contacts where name=''

This doesn't work as expected; the row is not being deleted.

How do I achieve this?

Upvotes: 2

Views: 2029

Answers (2)

krubo
krubo

Reputation: 6416

Start by examining select id, name, len(name) from contacts order by name so you can find out whether there are spaces or other gobbledygook that look like an empty name but have non-zero length.

Upvotes: 1

Alanyst
Alanyst

Reputation: 1410

You might try where name is null.

Upvotes: 7

Related Questions