显示所有表
select * from dba_tables;
desc dba_tables;
列出表中所有的字段:
desc scott.emp;
desc , describle 的简写形式,作用是显示器表的结构,使用格式:desc table;
3.使用group by 时,要查询的字段须在分组,即在group by 后。如下:
select ename, job ,sal from scott.emp group by job,ename,sal, empno having sal>2000;
ename, job, sal 须在group by 后。
4. having 检查分组后是否满足条件,须跟在group by 后,即跟group by 配合使用。而where 是用直接检查每条记录是否满足条件。
5. 多行记录插入:
insert into table(字段1,字段2.。。)(select 字段1,字段2或运算...)from table where...)
insert into scott.t1(id,name) (select t1.id+10,name from scott.t1);
6.表间数据复制;
create table scott.test
as (
select distinct empno, ename,job from scott.emp
);
7.删除整表数据。truncate 删除数据是不可以回滚的。
truncate table scott.test;