Alex Rivera | Logout

Delete empty rows

Asked 2012-05-18T14:35:30.543
35

I use PostgreSQL database and in one table I have the datetime column edit_user. Some rows are blank, and these rows I would like to delete.

I tried

DELETE FROM table WHERE edit_user="";

but I got the error

LINE 1: delete from table where edit_user="";

Also, I thought in the column as a blank value could be 0000-00-00, but there isn't.

How I should execute this command correctly?

Edit
Report

2 Answers

88
DELETE FROM table WHERE edit_user IS NULL;
answered 2012-05-18T14:36:30.583
3

To delete rows empty in table

syntax:

DELETE FROM table_name 
WHERE column_name IS NULL;

example:

Table name: data ---> column name: pkdno

DELETE FROM data 
WHERE pkdno IS NULL;

Answer: 5 rows deleted. (sayso)

answered 2012-08-31T06:36:40.260

Your Answer