欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

Scott用户的表结构

发布时间:2025/3/20 66 豆豆
生活随笔 收集整理的这篇文章主要介绍了 Scott用户的表结构 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

Oracle笔记(三) Scott用户的表结构

创建备份表
–create table emp2 as select * from emp;
更新
–select * from emp where ename='SCOTT';
–update emp set deptno=10 where ename='SCOTT';
–update emp set mgr=7833, hiredate=date'1985-01-05' where ename='SCOTT';
删除
–delete from emp where empno=7788;
插入
–Insert into EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO) Values (7788, 'SCOTT', 'ANALYST', 7566, TO_DATE('04/19/1987 ', 'MM/DD/YYYY'), 3000, 20);

2014 V1.5
SELECT的基本构成
经典格式
–select job, count(distinct deptno) from emp where mgr is not null group by job order by count(distinct deptno) desc, job;
–select job, count(distinct deptno) from emp where mgr is not null group by job order by 2 desc, job;
–select job, count(distinct deptno) uniq_deptno from emp where mgr is not null group by job order by uniq_deptno des c, job;
–select deptno, to_char(hiredate,'yyyy'), count(*) from emp group by deptno, to_char(hiredate,'yyyy');
–select deptno, to_char(hiredate,'yyyy'), count(*) from emp group by deptno, 2;
–select deptno, to_char(hiredate,'yyyy') hireyear, count(*) from emp group by deptno, hireyear;
–select deptno, to_char(hiredate,'yyyy'), count(*) from emp group by to_char(hiredate,'yyyy'), deptno;

经典格式
–select * from emp;
–select * from emp where empno>8000;
–select empno, ename, sal, comm from emp where sal<comm;
–select deptno, count(*) from emp group by deptno;
–select deptno, sum(sal) total_sal from emp where job='MANAGER' group by deptno;
–select job, count(distinct deptno) from emp where mgr is not null group by job order by job;

转载于:https://www.cnblogs.com/lujun/p/3714199.html

与50位技术专家面对面20年技术见证,附赠技术全景图

总结

以上是生活随笔为你收集整理的Scott用户的表结构的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。