Difference between Subquery and Correlated Subquery

前端 未结 7 840
Happy的楠姐
Happy的楠姐 2020-11-28 05:10

Is the following piece of SQL Query a normal query or a Correlated Subquery ??

SELECT UserID,
       FirstName,
       LastName,
       DOB,
       GFName,
          


        
7条回答
  •  醉酒成梦
    2020-11-28 05:38

    In an SQL query, if the inner query executes for every row of the outer query. If the inner query is executed for once and the result is consumed by the outer query, then it is called as non co-related query.

    Correlated sub-queries usually correspond to normal join queries, i.e. join queries that have no sub-queries, and can usually be expressed as such. It is sometimes recommended that they are translated into such join queries, because most SQL DBMSs will execute them .....

提交回复
热议问题