In my database table, 16 rows are inserted with null values for all columns. How can I delete these rows using SQL statement?
Something like this:
DELETE FROM my_table WHERE col1 IS NULL AND col2 IS NULL AND col3 IS NULL AND col4 IS NULL
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.
We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.