SQL 命令没有正确结束?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9811711/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 14:56:43  来源:igfitidea点击:

SQL Command not properly ended?

sqloracleora-00933table-alias

提问by Paul Woidke

I am using a SQL statement with a Temporary relation, and am getting the error ORA-009933: SQL command not properly ended

我正在使用具有临时关系的 SQL 语句,但出现错误 ORA-009933: SQL command not properly ended

I don't see anything wrong with the statement, so any assistance is greatly appreciated. The statement is:

我认为该声明没有任何问题,因此非常感谢任何帮助。声明是:

SELECT Temp.name,
       Temp.AvgSalary
FROM   (SELECT A.aid,
               A.aname       AS name,
               AVG(E.salary) AS AvgSalary
        FROM   Aircraft A,
               Certified C,
               Employees E) AS Temp; 

Thanks

谢谢

回答by Aprillion

oracle does not support asfor table aliases, only for column aliases and they are optional for that use => delete all askeywords ;)

oracle 不支持as表别名,仅支持列别名,并且它们对于该用途是可选的 => 删除所有as关键字;)

回答by Christian Vielma

You shouldn't put the AS temp. When putting alias to a table (or subquery) you should only write the alias. This should work:

你不应该把 AS 温度。将别名放入表(或子查询)时,您应该只写别名。这应该有效:

SELECT Temp.name, Temp.AvgSalary 
FROM ( SELECT A.aid, A.aname AS name, AVG(E.salary) AS AvgSalary 
       FROM Aircraft A, Certified C, Employees E)  Temp;

Best regards,

此致,