Обсуждение: Show table and columns with null value and count

Поиск
Список
Период
Сортировка

Show table and columns with null value and count

От
Zied Kharrat
Дата:
Hello,

I have a table which contains many data.
I want to execute an sql request to show for every table, the name of the column, how many null value in this column, and total number of rows in this column.
Could you help me?

Many thanks

Re: Show table and columns with null value and count

От
"David G. Johnston"
Дата:
On Thu, Aug 5, 2021 at 7:09 AM Zied Kharrat <khzied@gmail.com> wrote:
I have a table which contains many data.
I want to execute an sql request to show for every table, the name of the column, how many null value in this column, and total number of rows in this column.
Could you help me?
 

If you need an exact number you will need to write some dynamic SQL using the system catalogs to take inventory of the tables and columns in the database.

If you can live with estimates you can simply query the statistics that are kept by the system that it uses during query planning:

David J.