Multiple SQL statements together?



  • I am testing each column in a table to see if it has null values. Currently, I am using:

    select count (column) when column is not null
    

    I have a list of 20 of these for each column. Can I combine them all to run it once and then tell me the record count for each column. Any column that has 0 would be a null column



  • The where clause is redundant. You can just add all to a single query:

    select count(column1),
           count(column2),
           . . .
           count(column20)      
    from t
    

Log in to reply
 

Suggested Topics

  • 2
  • 1
  • 3
  • 2