SQL命令没有正确结束?

时间:2012-03-21 19:42:31

标签: sql oracle ora-00933

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

我认为这个陈述没有任何问题,所以非常感谢任何帮助。声明是:

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; 

由于

2 个答案:

答案 0 :(得分:20)

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

答案 1 :(得分:7)

你不应该把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;

致以最诚挚的问候,