IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 Frequently Asked Questions in Interviews


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gautam512

Active User


Joined: 05 Oct 2005
Posts: 308
Location: Vizag / US

PostPosted: Wed Jan 04, 2006 11:16 am
Reply with quote

Hi All,

Here is the attached document of 100 frequently asked DB2 interview questions.

100 FAQ IN DB2


Thanks,
Gau
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Wed Jun 14, 2006 11:21 am
Reply with quote

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
View user's profile Send private message
Rajen

New User


Joined: 05 May 2005
Posts: 61

PostPosted: Tue Dec 12, 2006 7:06 pm
Reply with quote

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
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Sun Jan 14, 2007 11:23 pm
Reply with quote

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
View user's profile Send private message
ajay_diaz
Warnings : 1

New User


Joined: 12 Sep 2005
Posts: 28

PostPosted: Thu Jul 05, 2007 7:16 am
Reply with quote

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
View user's profile Send private message
Prasun De

New User


Joined: 17 Jan 2008
Posts: 28
Location: Kolkata, INDIA

PostPosted: Thu Sep 02, 2010 7:18 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Comp interview questions Mainframe Interview Questions 5
No new posts Interview Questions on Cobol DB2 program Mainframe Interview Questions 5
No new posts Mainframe Interview Questions CICS,CO... Mainframe Interview Questions 6
No new posts Viewing executing process in NDM .. q... IBM Tools 0
No new posts INCLUDE condition questions DFSORT/ICETOOL 1
Search our Forums:

Back to Top