WHERE all IS NOT NULL

后端 未结 9 1818
暖寄归人
暖寄归人 2020-12-10 10:38

How can I run a MySQL query that selects everything that is not null? It would be something like

SELECT * FROM schedule WHERE ((all)) IS NOT NULL
         


        
9条回答
  •  暖寄归人
    2020-12-10 11:02

    I've just looked at your linked question and agree with Guffa's answer that you should normalise your database.

    Linked Question Image

    The above looks more like a spreadsheet then something that belongs in an RDBMS.

    To answer your concerns about this being the way you want it displayed. You could write a pivot query and put it in a view to mimic your current table structure and use this for your display query.

    This will avoid the need for some horrific 24 column WHERE clause whenever you want to search for data or find out if it is NULL as in this question.

提交回复
热议问题