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

How and when does the db2 enforces the unique key?

0 Answers  


Is db2 relational database?

0 Answers  


what is the difference between where clause and having clause

2 Answers   IBM,


What is a page?

2 Answers  


what needs to be done if a table is in copy pending / check pending status?

5 Answers   Xansa,


is it compulsory commitment control in journal?

0 Answers   TCS,


What is dynamic SQL?

1 Answers   ADP,


What is table space in db2?

0 Answers  


How can tablespace be moved to another dasd volume that is allocated for that tablespace?

0 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,


database DSNDB01 means a.db2 catalog b.db2 directory c.BSDS d.active logs answer with reason please

1 Answers  


how to fetch multiple records without using cursor

14 Answers   HCL,


Categories