i have table T!.

A B C D
NULL 1 2 3
4 NULL 5 6
7 8 NULL 9
10 11 12 NULL.


I WANT COUNT OF NULL VALUES IN TABLE. WRITE A QUERY.

Answers were Sorted based on User's Feedback



i have table T!. A B C D NULL 1 2 3 4 NULL 5 6 7 8 NULL ..

Answer / chiranjib

SELECT SUM( CASE WHEN A IS NULL THEN 1
ELSE
CASE WHEN B IS NULL THEN 1
ELSE
CASE WHEN C IS NULL THEN 1
ELSE
CASE WHEN D IS NULL THEN 1
ELSE
0
END
END
END
END ) Tot_Null
FROM T
/

Is This Answer Correct ?    0 Yes 0 No

i have table T!. A B C D NULL 1 2 3 4 NULL 5 6 7 8 NULL ..

Answer / kishore vakiti

select sum(decode(a,null,1))+
sum(decode(b,null,1))+
sum(decode(c,null,1))+
sum(decode(d,null,1)) tot_nulls from <TAB-NAME>;

Is This Answer Correct ?    0 Yes 0 No

i have table T!. A B C D NULL 1 2 3 4 NULL 5 6 7 8 NULL ..

Answer / kavitha neditunta

select
count(decode(val,null,1)) all_null_val
FROM
(select * from t1) UNPIVOT INCLUDE NULLS ( VAL for(
all_null_val) in ( a as 'a', b as 'b', c as 'c', d as 'd') )

Is This Answer Correct ?    0 Yes 0 No

i have table T!. A B C D NULL 1 2 3 4 NULL 5 6 7 8 NULL ..

Answer / sreenu

hi naren thank for your ans.

but here i am asking total count of null records. means how
many null values are there.

see above table having 4 null values. i want display "4".

please tell me sql query

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More SQL PLSQL Interview Questions

What is an index in sql with example?

0 Answers  


How many types of triggers are there in pl sql?

0 Answers  


How many joins can you have in sql?

0 Answers  


What are the methods of filing?

0 Answers  


I i have 2 tables A & B ,A contains 10 records B contains 20 records ,what w'll be the o/p if we perform equijoin,outer join,right outer join,left outer join,full outer join,cross join seperately Can anyone help on this?

2 Answers  






What is oracle sql developer?

0 Answers  


Does pl sql work in mysql?

0 Answers  


What are %type and %rowtype for?

0 Answers  


Define commit?

0 Answers  


what is an extent ? : Sql dba

0 Answers  


What do you mean by stored procedures? How do we use it?

0 Answers  


what is sql and plsql

6 Answers  


Categories