View previous topic :: View next topic
|
Author |
Message |
Gautam512
Active User
Joined: 05 Oct 2005 Posts: 308 Location: Vizag / US
|
|
|
|
Hi All,
Here is the attached document of 100 frequently asked DB2 interview questions.
100 FAQ IN DB2
Thanks,
Gau |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
Your document is really nice.
It seems that the answer to quetion # 20 seems to be wrong.
Quote: |
20. What is the result of this query if no rows are selected?
SELECT SUM(SALARY)
FROM EMP
WHERE QUAL='MSC';
A. NULL
|
|
|
Back to top |
|
|
Rajen
New User
Joined: 05 May 2005 Posts: 61
|
|
|
|
Hi Parikshit,
Really nice observation.
I guess this answer is partly right.
We have query as below.
SELECT SUM(SALARY)
FROM EMP
WHERE QUAL='MSC';
Now this will return NULL only if
1)All the rows fetched by Where condition has value of column SALARY equal to NULL. For example if the result table contains 10 rows and all these 10 rows are having SALARY value NULL then the above query will return NULL
2) Now if any of the rows in the result table is having ZERO (0) value then it will return ZERO.
So its like NULL + NULL + NULL + NULL = NULL and
NULL + NULL + NULL + 0 = 0.
Please correct me if i am wrong.
Thanks,
Rajen. |
|
Back to top |
|
|
sachin_star3 Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 78 Location: pune
|
|
|
|
hi
sorry you are wronge
In coloumn function when no row written ie. in where clause condition not satishfied then output is NULL.(NOT RELATION ABOUT THE COLOUMN IS NULL OR NOT) EXCEPT COUNT FUNCTION,IN COUNT WHEN NO ROW FECHED i.e conition in where clause is not satishfied ,THEN ANS IS ZERO
AND ABOUT NULL COLOUMN :- ALL COLOUMNS FUNCTION NOT COUNT THE ROW WHERE THERE IS NULL , BUT EXCEPT COUNT(*) FUNCTIONS ALSO COUNT THE NULL COLOUMN BECAUSE IT IS ACTE4D ON ROW NOT COLOUMN
FROM-SACHIN
PUNE |
|
Back to top |
|
|
ajay_diaz Warnings : 1 New User
Joined: 12 Sep 2005 Posts: 28
|
|
|
|
Question 43 is:
How do you simulate the EXPLAIN of an embedded SQL statement in SPUFI/QMF? Give an example with a host variable in WHERE clause.)
A. Use a question mark in place of a host variable ( or an unknown value ). e.g.
SELECT EMP_NAME
FROM EMP
WHERE EMP_SALARY > ?
I tried doing that but I am getting error message
Invalid use of "?".
Can anybody please help?
Thanks
Ajay |
|
Back to top |
|
|
Prasun De
New User
Joined: 17 Jan 2008 Posts: 28 Location: Kolkata, INDIA
|
|
|
|
ajay_diaz wrote: |
Question 43 is:
How do you simulate the EXPLAIN of an embedded SQL statement in SPUFI/QMF? Give an example with a host variable in WHERE clause.)
A. Use a question mark in place of a host variable ( or an unknown value ). e.g.
SELECT EMP_NAME
FROM EMP
WHERE EMP_SALARY > ?
I tried doing that but I am getting error message
Invalid use of "?".
Can anybody please help?
Thanks
Ajay |
Ajay,
It should work if you use the sql like the below :
EXPLAIN ALL FOR
SELECT EMP_NAME
FROM EMP
WHERE EMP_SALARY > ? |
|
Back to top |
|
|
|