在视图中可以改变列名, 如
create view v_emp as
select empno as eno, empname as ename, emp.deptno as e_deptno, 
       dept.deptno as d.deptno
from emp, dept
where emp.deptno=dept.deptno;

解决方案 »

  1.   

    也可以这样:CREATE OR REPLACE VIEW test_v (a_id,a_name,b_id,b_name) AS
    SELECT t1.ID,t1.NAME,t2.ID,t2.NAME
    FROM   tablea t1, tableb t2
    where t1.id = t2.id
      

  2.   

    ab5669(王长林) , duanzilin(寻) 为正解。
      

  3.   

    duanzilin(寻) 的当然可以,但是推荐使用 ab5669(王长林) 的方式定义别名即可,后期即便需要调整视图的定义,也只需要修改select子句,不需要两处都改动。推荐使用 ab5669(王长林) 的方式
      

  4.   

    SQL> select * from tab;TNAME                          TABTYPE  CLUSTERID
    ------------------------------ ------- ----------
    A                              TABLE   
    B                              TABLE   SQL> create view v_tab as select tname table_name,tabtype tabletype from tab;View createdSQL> select * from v_tab;TABLE_NAME                     TABLETYPE
    ------------------------------ ---------
    A                              TABLE
    B                              TABLE
    V_TAB                          VIEW