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
Answer / naren
select count(*) from t1 where a is null or b is null or c is
null or d is null
Is This Answer Correct ? | 26 Yes | 3 No |
Answer / abinash_mishra
SELECT a_null + b_null + c_null + d_null
FROM (SELECT COUNT (DECODE (a, NULL, 1, NULL)) a_null,
COUNT (DECODE (b, NULL, 1, NULL)) b_null,
COUNT (DECODE (c, NULL, 1, NULL)) c_null,
COUNT (DECODE (d, NULL, 1, NULL)) d_null
FROM t_null);
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / naren
select
count(decode(a,null,1)),count(decode(b,null,1)),count(decode(c,null,1)),count(decode(d,null,1))
from t1
Is This Answer Correct ? | 6 Yes | 4 No |
Answer / ankesh
select sum(nvl2(col1,0,1)+sum(nvl2(col2,0,1)+<...as many
columns we have > from <table name>
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / abinash_mishra
SELECT COUNT (DECODE ( a, NULL, 'a',DECODE (b,NULL, 'b',DECODE (c, NULL, 'c', DECODE (d, NULL, 'd', NULL))))) null_count
FROM t_null;
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / 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 |
Answer / gaurav
select (count(decode(A,null,1)) + count(decode (B,null,1)) + count(decode(C,null,1) + count(decode(D,null,1))) null_count
from T
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ash
select sum(case when A is null then 1 when B is null then 1
when C is null then 1 when D is null then 1 else 0 end)as
count_null from table T
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / mani
SELECT A+B+C+D FROM
( select
count(decode(A,null,1)) A,
COUNT(DECODE (B,null,1))B,
COUNT(DECODE (C,null,1))C,
COUNT(DECODE(D,null,1)) D
from PRACTICE2);
Is This Answer Correct ? | 0 Yes | 0 No |
one of the column in my table contains the data like SAL ---- 1000 1000 2000 3000 3000 So my requirement is i want output like SAL --- 1000 2000 3000 it mean i want to delete duplicate rows only how should u write query?
What does select count (*) mean in sql?
hello..... i am an comp science engineering graduate planning to do ORACLE certification in PLSQL 9i. just wanted to know whats the possibility getting job is their openings???? is it worth doin that course n certification
how do you login to mysql using unix shell? : Sql dba
Suppose There is a string A.B....C.......D.........E........F In this string dots (.) are not having fixed count in between of string. I want the output to have string with one dot between. I.e. A.B.C.D.E.F
What is materialized view in sql?
How can one get sql*loader to commit only at the end of the load file? : aql loader
How to find last day of the month in sql query
What is left join example?
what is union? : Sql dba
How to write a query to show the details of a student from students table whose
Are stored procedures faster than queries?