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 the difference between plan and package in db2?

0 Answers  


is there any restrictions for unions ?

4 Answers   Patni,


How to update more then one record using update?

5 Answers   IBM,


What is a DB2 bind?

1 Answers   Logica CMG,


How can we define a table? How can we apply SEARCH ALL on it ?

1 Answers  






What are the various locks available?

5 Answers   CTS,


What is the error code -803 ?

3 Answers  


Write a query to extract first 5 characters of a name in the column Stud_Name?

1 Answers   RBS,


How can the duplicate values be eliminated from db2 select?

0 Answers  


What is lock escalation?

2 Answers  


How to solved 818 error

4 Answers   Keane India Ltd, Wipro,


What is the picture clause of null indicator variable?

0 Answers  


Categories