我要创建一个表,该表需要存储另一个表每个字段的相应信息,所以就需要该表拥有另一个表的所有字段,而却属性要完全相同,请指教如何来写SQL语句。谢谢!

解决方案 »

  1.   

    create table table_name as
    select * from table2 where 1=2
      

  2.   

    jiezhi(西域浪子)兄的回答有一些问题,他可能理解偏了。
    这样:
    create table table_dict 
    as 
     select * from dba_tab_columns 
      where owner='your_user_name'
        and table_name='Your_table_name'
      

  3.   

    谢谢jiezhi;
    再帮个忙:
    表a,表b,
    在表a的后面附上表b的全部字段,SQL又该如何写?
      

  4.   

    老大,你太贪心了好像没有这样的sql语句你可以desc b
    得到b的字段,再手工加(alter table )
      

  5.   

    sql server中有这样的语句,所以就想问问oracle中是否也能这样操作。
      

  6.   

    create table c as select * from a,b where 1=2;
    (如果有重复列名会出错)