Google News
logo
SQL Server - Quiz(MCQ)
The ________ keyword is used to access attributes of preceding tables or subqueries in the from clause.
A)
In
B)
With
C)
Lateral
D)
Having

Correct Answer :   Lateral


Explanation :

Select name, salary, avg salary from instructor I1, lateral (select avg(salary) as avg salary from instructor I2 where I2.dept name= I1.dept name);
Without the lateral clause, the subquery cannot access the correlation variable I1 from the outer query.

Advertisement