1.

The ________ keyword is used to access attributes of preceding tables or subqueries in the from clause.(a) In(b) Lateral(c) Having(d) WithThe question was posed to me in a job interview.Enquiry is from Aggregation of Data topic in division Laying the Foundation of SQL Server

Answer»

The correct option is (b) Lateral

The 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.



Discussion

No Comment Found

Related InterviewSolutions