3 回答

TA贡献1883条经验 获得超3个赞
如果NEW_TABLE已经存在,则...
insert into new_table
select * from old_table
/
如果要基于OLD_TABLE中的记录创建NEW_TABLE ...
create table new_table as
select * from old_table
/
如果目的是创建一个新的但空的表,则使用WHERE子句,其条件永远不能为真:
create table new_table as
select * from old_table
where 1 = 2
/
请记住,CREATE TABLE ... AS SELECT仅创建一个与源表具有相同投影的表。新表没有原始表可能具有的任何约束,触发器或索引。那些仍然必须手动添加(如果需要)。

TA贡献1829条经验 获得超6个赞
select into在pl / sql中用于将变量设置为字段值。相反,使用
create table new_table as select * from old_table

TA贡献1825条经验 获得超6个赞
使用:
create table new_table_name
as
select column_name,[more columns] from Existed_table;
例:
create table dept
as
select empno, ename from emp;
如果表已经存在:
insert into new_tablename select columns_list from Existed_table;
- 3 回答
- 0 关注
- 832 浏览
添加回答
举报