--一、获取当前时间,显示为 xxxx年xx月xx日 xx时xx分xx秒 的格式。(日期操作使用虚表)
select hiredate,to_char(hiredate,'yyyy-mm-dd hh24:mi:ss') from emp;
-- 二、找出入职时间在1981-06-01后入职的所有员工信息。(日期操作)
select * from emp where (to_char(hiredate,'yyyy-mm-dd'))>='1981-06-01';
--三、统计所有员工的平均奖金,没有奖金的也要计算在内,按0处理。(空值处理)
select '平均奖金是:'|| avg(nvl(comm,0)) from emp;
--四、查询所有不是经理的员工信息。
select * from emp where job <> 'MANAGER';
-- 五、找到工资小于本部门的平均工资的员工。(相关子查询)
select * from emp t where sal<(select avg(sal)from emp where t.deptno=deptno group by deptno);
Oracle 数据查询 select
最新推荐文章于 2024-07-25 08:41:32 发布