Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql query to find percentage of null values in a table

SELECT 100.0 * SUM(CASE WHEN Column1 IS NULL THEN 1 ELSE 0 END) / COUNT(*) AS Column1Percent,
100.0 * SUM(CASE WHEN Column2 IS NULL THEN 1 ELSE 0 END) / COUNT(*) AS Column2Percent,
100.0 * SUM(CASE WHEN Column3 IS NULL THEN 1 ELSE 0 END) / COUNT(*) AS Column3Percent
FROM #perc
Comment

PREVIOUS NEXT
Code Example
Sql :: htaccess allow index 
Sql :: SQL check if record exist 
Sql :: sum value by month sql 
Sql :: sql convert datetime 
Sql :: get sum sqlite android 
Sql :: sql max of two values 
Sql :: mysql case 
Sql :: how to count the number of rows in sql 
Sql :: sql server convert to guid 
Sql :: to_char oracle 
Sql :: sql select if two columns are equal 
Sql :: mysqldump database 
Sql :: postgresql must appear in the GROUP BY clause or be used in an aggregate function 
Sql :: ms sql mac 
Sql :: sql run multiple updates in one query 
Sql :: multiple count with where clause sql 
Sql :: Selecting duplicates 
Sql :: postgressum when 
Sql :: sql to array of objects 
Sql :: if null put 0 sql 
Sql :: psql get last rows 
Sql :: how to connect to postgres 
Sql :: postgres parent and child tables 
Sql :: how to join three tables in sql using joins 
Sql :: postgresql create table as select 
Sql :: php get closest location by latitude longitude 
Sql :: mysql grant user permissions 
Sql :: relation does not exist postgresql 
Sql :: mariadb create view 
Sql :: mysqli auto increment id 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =