Oracle基础——简单查询练习(二)

练习基于Oracle数据库中HR用户下的employees表

  1. HR需要得到一个月薪资$12000以上的员工名(last_name)和薪水报告,请完成查询语句
select last_name, salary from employees where salary >12000;
  1. HR需要识别高收入和低收入员工群体。请显示月薪不在$5000到$12000范围内的员工名和月薪
select last_name, salary from employees where salary not between 5000 and 12000;
  1. 请查询中1994年雇员的员工名和雇佣日期
select last_name, hire_date from employees where extract(year from hire_date)=1994;
  1. 请查询没有领导的员工名和职位
select last_name,job_id from employees where manager_id is null;
  1. 请查询有奖金的员工名和月薪、奖金,并按奖金系数排降序
select last_name,salary,salary*commission_pct form employees where nvl(commission_pct,0)>0 order by commission_pct desc;
  1. 请查询月薪大于1000的员工名和月薪
select last_name,salary from employees where salary>1000;
  1. 请查询第三个字母是a的员工名
select last_name from employees where last_name like '__a%';
  1. 请查询员工名包含a或e的员工名
select last_name from employees where last_name like '%a%' or lase_name like '%e%';
  1. 请查询职位是“SA_REP”或“ST_CLERK”,且月薪不是$2500、$3500、$7000的员工信息
select * from employees where job_id in ('SA_REP','ST_CLERK') and salary not in (2500,3500,7000);
  1. 请查询奖金系数是20%的员工名、薪水和奖金系数
select last_name,salary,commission_pct from employees where commission_pct = 0.2;

你可能感兴趣的:(sql,数据库,oracle,java)