Home > Software design >  How do I find empty values in multiple columns at once using SQL Big Query?
How do I find empty values in multiple columns at once using SQL Big Query?

Time:12-22

To find for one column, I can use this.

SELECT column1

FROM `dataset.table`

WHERE column1 IS NULL OR column1 = '';

But what if i have 100 columns? Instead of going through column by column, changing column 1 to 2,3,etc.,I'm looking for one for all solution. I'm kinda new to SQL and Data Cleaning.

CodePudding user response:

Consider below approach

select *
from your_table t
where regexp_contains(to_json_string(t), r':(?:null|"")[,}]')    

above will return you all rows where any column either null or empty string

  • Related