Back to Code Snippets


Delete NULL lines SQL

Clean a table removing lines where all cols values are NULL

Execute this SQL

WITH t AS (
VALUES (NULL, NULL),
  ('john', 'smith'),
  ('mike', NULL),
  (NULL, 'jones'),
  (NULL, NULL)
) FROM t
EXCEPT
FROM t
WHERE COLUMNS(*) IS NULL ;

Copy code

MAUVIERE

Expand

Share link