Find the count of EMPTY or NULL columns in a MySQL table

前端 未结 4 1994
慢半拍i
慢半拍i 2021-01-21 20:04

I have around 30 columns in a MySQL table. I want to calculate how many column fields for a particular row are empty. This table is for storing user information. I want to fin

4条回答
  •  半阙折子戏
    2021-01-21 20:54

    In addition to what @dnagirl answered, I would consider doing an extra step... adding a column to the table for "anyNulls". And set it as a flag for ANY empty/null values, so you would be able to quickly query those that need to be completed for data requirements instead of just how many of each category. One record could have all fields missing vs one column in multiple rows that need to be fixed.

提交回复
热议问题