oracle 学习

显示所有表
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;
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值