oracle习题及答案
更新时间:2023-11-28 09:20:01 阅读量: 教育文库 文档下载
- Oracle面试题及答案推荐度:
- 相关推荐
1. 查询工资大于12000的员工姓名和工资
Select last_name||' '||first_name,salary from employees where salary >12000;
2. 查询员工号为176的员工的姓名和部门号
Select last_name||' '||first_name,department_id from employees where employee_id=176;
3. 选择工资不在5000到12000的员工的姓名和工资
Select last_name||' '||first_name,salary from employees where salary not between 5000 and 12000;
4. 选择雇用时间在1998-02-01到1998-05-01之间的员工姓名,job_id和雇用时间
Select last_name||' '||first_name,job_id,hire_date from employees where hire_date between '1-2月-98' and '1-5月-98';
5. 选择在20或50号部门工作的员工姓名和部门号
Select last_name||' '||first_name,department_id from employees where department_id in (20,50);
6. 选择在1994年雇用的员工的姓名和雇用时间
Select last_name||' '||first_name,hire_date from employees where hire_date like '?';
7. 选择公司中没有管理者的员工姓名及job_id
Select last_name||' '||first_name,job_id from employees where Manger_id is null;
8. 选择公司中有奖金的员工姓名,工资和奖金
Select last_name||' '||first_name,salary,commission_pct from employees where commission_pct is not null;
9. 选择员工姓名的第三个字母是a的员工姓名
Select last_name||' '||first_name from employees where last_name||' '||first_name like '___a%';
10. 选择姓名中有字母a和e的员工姓名 Select
last_name||'
'||first_name
from
employees
where
last_name||first_name like '%a%e%' or last_name||first_name like '%e%a%';
多表查询
11. 显示所有员工的姓名,部门号和部门名称。
Select e.last_name,d.department_id,d.department_name from employees e , departments d where (e.department_id=d.department_id); 12. 查询90号部门员工的job_id和90号部门的location_id
Select e.job_id,d.location_id from employees e, departments d where e.department_id=d.deparement_id and d.department_id=90; 13. 选择所有有奖金的员工的
last_name , department_name , location_id , city
Select e.last_name , d.department_name , l.location_id , city from employees
e,departments
d,locations
l
where
e.department_id=d.department_id AND d.location_id=l.location_id
AND commission_pct is not null;
14. 选择在Toronto工作的员工的
last_name , job_id , department_id , department_name
Select e.last_name , e.job_id , d.department_id , d.department_name from
employees
e,departments
d
,locations
l
where
e.department_id=d.department_id AND d.location_id=l.location_id AND l.city='Toronto';
15. 选择所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 employees kochhar Emp# 101 manager king Mgr# 100 Select e.employee_id \\\\from employees e,employees d where e.manager_id=d.employee_id(+);
6. 查询各部门员工姓名和他们的同事姓名,结果类似于下面的格式 Department_id 20 Last_name fay colleague hartstein Select e.department_id \d.last_name \e.last_name \from employees e join employees d on(d.department_id=e.department_id) d.last_name<>e.last_name;
where
分组查询
16. 组函数处理多行返回一行(true) 17. 组函数不计算空值( false)
18. where子句在分组之前对检索进行过滤 ( true) 19. 查询公司员工工资的最大值,最小值,平均值,总和
Select max(salary),min(salary),avg(salary),sum(salary) from employees; 20. 查询各job_id的员工工资的最大值,最小值,平均值,总和 Select max(salary),min(salary),avg(salary),sum(salary) from employees group by job_id;
21. 选择具有各个job_id的员工人数
Select job_id,count(*) from employees group by job_id; 22. 查询员工最高工资和最低工资的差距(DIFFERENCE) Select max(salary)-min(salary) \23. 查询各个管理者手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内
Select manager_id,min(salary) from employees where manager_id is not null group by manager_id having min(salary) >=6000;
24. 查询所有部门的名字,location_id,员工数量和工资平均值 Select
d.department_name,d.location_id,count(e.employee_id),avg(e.salary) from
employees
e,departments
group
d
where by
e.department_id(+)=d.department_id
d.location_id,d.department_name;
25. 查询公司的人数,以及在1995-1998年之间,每年雇用的人数,结果类似下面的格式
total 30 1995 3 1996 4 1997 6 1998 7 Select count(employee_id),to_char(hire_date,'yyyy') \from employees where to_char(hire_date,'yyyy') between 1995 and 1998 group by to_char(hire_date,'yyyy') order by y;
Select
子查询
26. 查询和zlotkey相同部门的员工姓名和雇用日期
Select last_name,hire_date,department_id from employees where department_id=(select
department_id
from
employees
where
lower(last_name)='zlotkey') ;
27. 查询工资比公司平均工资高的员工的员工号,姓名和工资。 Select
employee_id,last_name,salary
from
employees
where
salary>(select avg(salary) from employees );
28. 查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名
Select employee_id,last_name,department_id from employees where department_id =any (select department_id from employees where lower(last_name) like '%u%');
29. 查询在部门的location_id为1700的部门工作的员工的员工号,
正在阅读:
oracle习题及答案11-28
MapReduce统计三角形数量10-25
吃辣椒作文400字06-24
寒假培优作业 - 图文05-10
一盆栀子花作文800字07-07
我们的宠物作文350字06-30
如何培养高中生地理学科核心素养05-19
诚信是做人之本作文800字06-29
去新加坡留学需要带什么东西02-07
文明时刻记心上作文700字06-22
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 习题
- 答案
- oracle
- 浙江省衢州市仲尼中学高一信息技术《多媒体信息处理—图像处理》教案
- 基础工程试卷A(07-08)
- 2018-2019年初中信息技术浙教版《七年级下册》《第三单元 制作多媒体作品》第14课 引人
- 2015年六年级希望杯培训100题
- 何之光:《土地改革法》的夭折
- 人力资源管理制度
- 《屠猫记》读后感
- 2018年度大数据时代的互联网信息安全100分考试答案
- 领导组织变革的五维模型之取法篇课后测试
- 芜湖市汽车配件生产企业名录2018版972家 - 图文
- 2016年二年级数学下学期质量检测试题
- 基坑降水方案(正式)
- 提高任职教育院校军事学研究生培养质量探析
- 创先争优活动总结范文
- 2019年全国大联考(江苏卷)高三第二次地理试卷(含答案) - 图文
- 数值分析 龙格现象 matlab代码分享
- 电子商务网上购物毕业论文中英文资料对照外文翻译文献综述
- 中班顽皮的小雨滴教案
- 中国施工企业高级职业经理人名单
- 2018年航天精密机械组件项目可行性研究报告(编制大纲)