what will be the output of the below given query, if no
matching records are found : (a.) 0 (b.) null (c.) error

select Avg(salary)
from TableA
where Deptno = 'insurance'

Answer Posted / varalakshmi

ANSWER IS B. IT GIVES NULL.

Is This Answer Correct ?    20 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi, i would like to start a new carrier in DB2 DBA.Which and what all step should i have to take..?

2678


What is temporal table in db2?

593


What is host variable?

585


Where do you specify them?

672


Give a brief description of db2 isolation levels?

591






what is a corelated subquerry?

647


List out the buffer pools in db2

615


SET is the ANSI standard for variable assignment, SELECT is not. SET can only assign one variable at a time, SELECT can make multiple assignments at once. If assigning from a query, SET can only assign a scalar value. If the query returns multiple values/rows then SET will raise an error. SELECT will assign one of the values to the variable and hide the fact that multiple values were returned (so you'd likely never know why something was going wrong elsewhere - have fun troubleshooting that one) When assigning from a query if there is no value returned then SET will assign NULL, where SELECT will not make the assignment at all (so the variable will not be changed from it's previous value) As far as speed differences - there are no direct differences between SET and SELECT. However SELECT's ability to make multiple assignments in one shot does give it a slight speed advantage over SET.

2139


How to find the number of rows in a db2 table?

640


Mention the various locks that are available in db2.

605


How can you find out the # of rows updated after an update statement?

631


How to get the ddl of a table in db2?

667


What are the rules for db2 programming?

634


How many databases can be created inside an instance in db2 ?

587


How do you stop a db2 database in linux?

558