【发布时间】:2015-03-07 15:15:04
【问题描述】:
只是出于好奇:SQL 标准中的列名是否有优先级?
让我们来看看这个查询:
select * from mytable m1
where col1 = 123
and exists
(
select * from mytable m2
where m2.col2 = m1.col2 and m2.col1 = 456
);
在 Oracle 中,我可以省略 col1 和 col2 上的限定符 m2,因为内部表 (m2) 优先于外部表 (m1)。该行将是
where col2 = m1.col2 and col1 = 456
并且仍然有效。这种行为是标准 SQL 吗? IE。我可以依靠此查询在任何符合标准的 dbms 中工作吗?或者这只是 Oracle(可能还有大多数其他 dbms)提供的便利性增强功能?
【问题讨论】:
标签: sql standards-compliance operator-precedence