0

In my database table, 16 rows are inserted with null values for all columns. How can I delete these rows using SQL statement?

3
Contributors
2
Replies
4
Views
4 Years
Discussion Span
Last Post by darkagn
0

Something like this:

DELETE FROM my_table WHERE col1 IS NULL AND col2 IS NULL AND col3 IS NULL AND col4 IS NULL
1

To stop it from happening in the future, consider adding a primary key to the table. By definition a PK is not nullable and will help identify the records when they are inserted. For more information on primary keys see this W3Schools page on the subject.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.