View the Exhibit and examine the structure of the employees table.
Execute the following block of code:
What is the outcome?
A.
It gives an error because group functions cannot be used in anonymous blocks
B.
It executes successfully and correctly gives the result of the sum of salaries in department 60.
C.
It executes successfully and incorrectly gives the result of the sum of salaries in department 60.
D.
It gives an error because the variable name and column name are the same in the where
clause of the select statement.
Explanation:
c
C
C
C
why will the sum be incorrect?
notice the where clause. it’ll give the sum of salaries for all department
Because in comparing department_id with department_id it will not consider any of department_id as the department_id=60. So it is like writing query without where clause. If u use any other name for department_id, it will give proper result.