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.

Answer Posted / mathan r

create table clustering
(
id1 varchar(10),
id2 varchar(10),
id3 varchar(10)

)

insert into clustering
select '1','2',null
union
select '1',null,'3'
union all
select null,'2','3'

select sum(nullable) from
(select count(case when id1 = null then '1' else '2' end) 'nullable' from clustering where id1 is null
union all
select count(case when id2 = null then '1' else '2' end)'nullable' from clustering where id2 is null
union all
select count(case when id3 = null then '1' else '2' end)'nullable' from clustering where id3 is null ) tmp

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

describe transaction-safe table types in mysql : sql dba

510


Do stored procedures prevent sql injection?

550


What will you get by the cursor attribute sql%notfound?

595


what is msql? : Sql dba

568


What is sql and db2?

535






Can we use the cursor's to create the collection in PL/SQL?

522


Why plvtab is considered as the easiest way to access the pl/sql table?

619


What do you mean by query optimization?

550


What is a relationship and what are they?

580


What port does sql server use?

510


What is the difference between function, procedure and package in pl/sql?

561


How will you distinguish a global variable with a local variable in pl/sql?

626


How does one use sql*loader to load images, sound clips and documents? : aql loader

674


What is composite data type in pl sql?

559


How do rank () and dense_rank () differ?

522