刚刚发现,当您使用AS关键字为子查询添加别名时,Oracle不喜欢它:
AS
SELECT * FROM (SELECT * FROM products) AS p
我需要使我的SQL查询尽可能地可移植。AS在上述查询中删除关键字是否会影响其他RDBMS?
对于SQL 99 ANSI模式是表可以有一个别名 WITHOUT 的AS关键字,这样,就可以拍摄出AS它应该在每一个RDBMS工作。在小提琴上看到它:
在ISO / IEC 9075-2:1999的 7.6 节 < 表参考>中,第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>
还确认可以正常工作: