If a table has a column "dept" (declared to have nulls) and
there are 10 rows in the table of which 3 have a null value
in the dept column, what will select count(*) and select
count(distinct dept) return?

Answers were Sorted based on User's Feedback



If a table has a column "dept" (declared to have nulls) and there are 10 rows in the tab..

Answer / virender

SELECT(*) Will return 10 and SELECT (distinct dept) will
return 8.

Is This Answer Correct ?    7 Yes 2 No

If a table has a column "dept" (declared to have nulls) and there are 10 rows in the tab..

Answer / madhuri tungal

select count(*) returns 10 --- this is right. But,
select count(distinct dept) returns 7. Because null values
are not considered as distinct.

Is This Answer Correct ?    6 Yes 1 No

If a table has a column "dept" (declared to have nulls) and there are 10 rows in the tab..

Answer / keshireddy

Hmm Virender is correct

Is This Answer Correct ?    1 Yes 0 No

If a table has a column "dept" (declared to have nulls) and there are 10 rows in the tab..

Answer / i go crazy

MADHURI IS CORRECT.

Is This Answer Correct ?    1 Yes 0 No

If a table has a column "dept" (declared to have nulls) and there are 10 rows in the tab..

Answer / austin

MADHURI IS CORRECT.

Is This Answer Correct ?    1 Yes 0 No

If a table has a column "dept" (declared to have nulls) and there are 10 rows in the tab..

Answer / abhilash

SELECT(*) Will return 10 and SELECT (distinct dept) will
return 8.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

what is diffrence b/w file-aid tool and file-aid utility???

1 Answers  


how to delete perticular row from table for ex. how you will delete 3rd row from table please answer THANKS IN ADVANCE

10 Answers   IBM,


What is the difference between oracle and db2?

0 Answers  


What is a db2 schema?

0 Answers  


For a db2 column that is being defined as decimal (11, 2), discuss the cobol picture clause.

0 Answers  






The only place of VSAM KSDS in DB2 is?

2 Answers   IBM,


max number of columns in a db2 table?

6 Answers  


how will i display the duplicate record's from a table... i don't want to eliminate ...i want to display the duplicate record...for example in my table i have 10 record's like record no(1,2,3,4,2,9,6,1) in this ...so i want to receive duplicates...

1 Answers   UST,


Is it mandatory to use DCLGEN? If not, why would you use it at all?

2 Answers  


What is a plan and package in db2?

0 Answers  


What is lock contention?

1 Answers  


How we create a tables in DB2 ?Previously client has using 7 letters for user id,now he wants to increase the letters from 7 to 12 for user id.How we can do it?

6 Answers   Wipro,


Categories