SQL Command not properly ended?

萝らか妹 提交于 2019-11-26 22:01:59

问题


I am using a SQL statement with a Temporary relation, and am getting the error 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


回答1:


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




回答2:


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

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,



来源:https://stackoverflow.com/questions/9811711/sql-command-not-properly-ended

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!