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

Explain about open switch business continuity software?

0 Answers  


wht r the requirements for writing a cobol-db2 pgm ?

4 Answers   IBM,


In which column of which DB2 catalog would you find the length of the rows for all tables?

2 Answers  


Hi. I am currently working as a application developer. I would like to persue a DB2 certification exam. Can anybody please provide me the details about this exam like Syllabus, Cost and how to take the certification?

2 Answers  


Can we install 2 different versions of Db2 on same mainframe?

3 Answers  


What is query for your birthday date should be in hours,minute and seconds format?

1 Answers   Fidelity,


Plan is an executable form of sql statements,But what exactly resides inside a Plan. what are the details inside Plan.

2 Answers   IBM,


What is -904 sql code? How to resolve it?

3 Answers  


What is nvl in db2?

0 Answers  


Name some fields from SQLCA

1 Answers  


What are the Isolation levels possible ?

5 Answers  


How to get the ddl of a table in db2?

0 Answers  


Categories