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
Answer / virender
SELECT(*) Will return 10 and SELECT (distinct dept) will
return 8.
| Is This Answer Correct ? | 7 Yes | 2 No |
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 |
Answer / abhilash
SELECT(*) Will return 10 and SELECT (distinct dept) will
return 8.
| Is This Answer Correct ? | 0 Yes | 0 No |
how to get duplicate records from tables?write qurey for this?
What is the physical storage length of the data types: date, time, timestamp in the db2 database?
How can you classify the locks in db2?
Can a primary key have null values? If we try to insert a null value in a primary key column, will it work or give an error code?
How will you return the number of records in table?
What does db2 stand for?
What is the max length of sqlca?
For Null indicator we have 3 values 0,-1,-2. 0->Not nulll -1->Null -2->Value truncated If ther is any possibility to have any positive value other than 0 in Null indicator.If it is so then when we will get and what is the value?
Explain various types of locks in db2?
What is the difference between primary key & unique index ?
What is the maximum length of sqlca?
What is the use of runstats in db2?