刚发现Oracle不喜欢用AS
关键字给子查询起别名:
SELECT * FROM (SELECT * FROM products) AS p
我需要让我的 SQL 查询尽可能可移植。删除AS
上述查询中的关键字是否会影响任何其他 RDBMS?
刚发现Oracle不喜欢用AS
关键字给子查询起别名:
SELECT * FROM (SELECT * FROM products) AS p
我需要让我的 SQL 查询尽可能可移植。删除AS
上述查询中的关键字是否会影响任何其他 RDBMS?
SQL 99 ANSI 的模式是该表可以有一个没有关键字的别名,因此AS
,您可以取出AS
它,它应该适用于每个 RDBMS。在小提琴上看到它:
在ISO/IEC 9075-2:1999的第7.6 节 <table reference>中,第 232 页:
<table reference> ::=
<table primary>
| <joined table>
<table primary> ::=
<table or query name> [ [ AS ] <correlation name>
[ <left paren> <derived column list> <right paren> ] ]
| <derived table> [ AS ] <correlation name>
[ <left paren> <derived column list> <right paren> ]
| <lateral derived table> [ AS ] <correlation name>
[ <left paren> <derived column list> <right paren> ]
| <collection derived table> [ AS ] <correlation name>
[ <left paren> <derived column list> <right paren> ]
| <only spec>
[ [ AS ] <correlation name>
[ <left paren> <derived column list> <right paren> ] ]
| <left paren> <joined table> <right paren>
也确认工作: