Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql count null as 0

SELECT sum(CASE WHEN column_A IS NULL THEN 1 ELSE 0 END) A,
       sum(CASE WHEN column_B IS NULL THEN 1 ELSE 0 END) B
FROM my_table;
Comment

PREVIOUS NEXT
Code Example
Sql :: Check database restore status sql script 
Sql :: declarative base sqlalchemy 
Sql :: mysql select default if null 
Sql :: primary key multiple 
Sql :: change filed order in mysql 
Sql :: constraints to columns SQL 
Sql :: mysql json query 
Sql :: return result of function in postgresql 
Sql :: download sql server 2016 
Sql :: mysql backup database command line 
Sql :: average sql 
Sql :: sqlite unique 
Sql :: mysql stored procedure vs function 
Sql :: row to value to json in sql server 
Sql :: insert array postgresql 
Sql :: how to get date in sql 
Sql :: osx stop mysql service 
Sql :: sql number columns 
Sql :: how to add month in update sql 
Sql :: change data type in mysql 
Sql :: setval max id postgresql sequence 
Sql :: mysql set boolean default value 
Sql :: sql with example 
Sql :: sql get duplicates by composite 
Sql :: creating table in sql 
Sql :: how to upper case in sql 
Sql :: sql server select another database 
Sql :: select users with same username 
Sql :: query to find second highest salary 
Sql :: mongodb vs mysql 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =