开发者

what is this SQL select construct called?

What is the term for the select construct in the following select statement that is in bold?

SELECT a.t1 as a, (SELECT b.n as b FROM b WHERE b.x = a.t1), c.t2 as c FROM a,c WHERE a.x = c.x

I was explaining that this can be done in oracle but when asked what it was called, I couldn't think of any term. Is there a term for this? Or is it just selecting a select result?

E开发者_运维问答DIT: expanded query to make sub-query use clear


It is a subquery. If b.n refers to a table aliased as b in the outer query, then it could be referred to as a correlated subquery.

As guigui42 notes, it is also a scalar query, since it is returning at most only one column and row. In fact, you must take care to ensure at most only one row is ever returned, or the query may crash at some later date. This is often guarded against by using TOP 1 or equivalent.


i would say "Scalar subquery"

EDIT : as RedFilter said, it is also a correlated subquery.

so it is a Scalar correlated subquery


A nested sub-query.

...notoriously poor performers if mis-used (which is quite often) as well.


This is referred to as a sub-select.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜