Skip to content
Advertisement

how to select rows with no null values (in any column) in SQL?

I have a table called table1

It has 100 columns: {col1, col2, …,col100}

I understand how to SELECT rows not containing null values in a specific column for instance col1:

How do I SELECT all rows that do not contain null values in any column

Attempt

but this returns an error in MySQL (which I am using)

Advertisement

Answer

You need to explicitly list each column. I would recommend:

Some people might prefer a more concise (but slower) method such as:

This is not actually a simple way to express this, although you can construct the query using metadata table or a spreadsheet.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement