---
title: "使用子查询创建表"
author: "tomfish88"
date: "2013-11-22T10:25:08Z"
tags: []
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2013-11-22T10:29:11Z"
id: 1979282
url: "https://tomfish88.iteye.com/blog/1979282"
---

使用子查询创建表


create table myemp as select * from emp;

 create table myemp as select * from emp where deptno=10;

create table myemp as select * from emp 1=2;

添加字段
Alter table student add age number(5);

、修改字段
Alter table student modify age number(10); alter table table2 rename column result to result2;
12.5、删除字段
Alter table student drop column age;
12.6、清空表中数据
Truncate table student;
正常情况下删除数据，如果发现删除错了，则可以通过rollback回滚。如果使用了截断表，则表示所有的数据不可恢复了.所以速度很快（更详细的说明可查看Oracle体系结构）
12.7、删除表
Drop table student;
12.8、重命名表
Rename student to student1;


、insert 语句
表间数据拷贝 insert into dept1(id, name) select deptno, dname from dept;