oracle中的表别名怎么,Oracle 表别名

在Oracle里使用表别名应注意:

1.在Oracle里,列的别名可以使用as,而表的别名不能使用as。否则报错,如:

select employees_id, last_name, a.department_id, department_name

from employees as a, departments as b

where a.department_id = b.department_id;

ERROR at line 2:

ORA-00933:SQL command not properly ended

2.在Oracle里,对表使用别名后,凡是用到表名的地方都只能使用别名。

否则报错,如:

select employees_id, last_name, a.department_id, department_name

from employees a, departments b

where employees.department_id = b.department_id;

ERROR at line 3:

ORA-00904:"EMPLOYEES"."DEPARTMENT_ID": invalid identifier

你可能感兴趣的:(oracle中的表别名怎么)