简体   繁体   English

SELECT和FROM子句中的sub-SELECT是否符合标准?

[英]Are sub-SELECT's in SELECT and FROM clauses standard-compliant?

The title pretty much says it all. 标题基本概括了所有内容。 Under "standard-compliant" SQL I mean SQL constructs allowed in any of SQL standards. 在“符合标准的” SQL下,我指的是任何SQL标准都允许的SQL构造。

I looked through the "Understanding SQL" book, but it mentions subqueries only inside WHERE , GROUP BY , HAVING etc. clauses, not SELECT and FROM (or maybe I'm missing something). 我浏览了《 Understanding SQL》一书,但它仅提及WHEREGROUP BYHAVING等子句中的子查询,而不是SELECTFROM (或者可能缺少某些内容)。

I know MS SQL allows sub-SELECT's in SELECT and FROM . 我知道MS SQL允许SELECTFROM子SELECT。 I would like to know if it is a standard behavior. 我想知道这是否是标准行为。 Or maybe it isn't standard, but is now implemented in major SQL databases (I have very little experience with DB's other than MS SQL)? 还是它不是标准的,但是现在已经在主要的SQL数据库中实现了(除了MS SQL,我对DB的经验很少)?

Yes. 是。 You can use a subquery as a derived table wherever you can use a table in a select statement. 可以在select语句中使用表的任何地方都可以将子查询用作派生表。

SQL ANSI 92 SQL ANSI 92

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM