Oracle中利用一個表結構拷貝成另外的表

1、將一個表的結構及數據全部拷貝成一個新表:
Sql代碼 複製代碼
  1. create table components2 as select * from components  
create table components2 as select * from components

2、只複製另外一個表的結構而不復制數據:
Sql代碼 複製代碼
  1. create table components2 as select * from components where id<1000;  
create table components2 as select * from components where id<1000;

注:在components表中id的最小值是1000,所以這裏如果選擇小於這個最小值的行,那麼就是該表的結構。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章