栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > DBA题库

Oracle管理员及SQL面试题

DBA题库 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Oracle管理员及SQL面试题

  1. 用sqlplus连接数据库时,为什么会出Oracle not available错误?

Oracle server(即通常所说的数据库)是否启动,ORACLE_SID是否正确设置。

 

  1. 找出员工的姓中(last_name)第三个字母是a的员工名字

select last_name from s_emp where last_name like ‘_ _a%’;

 

  1. 找出员工名字中含有a和e的

select first_name from s_emp where first_name like ‘%a%’ and first_name like ‘%e%’;

比较:

select first_name from s_emp where first_name like ‘%a%e%’;

此种方式查询出来的数据,只是先出现“a”然后出现“e”的数据表记录。总的记录条数可能少于第一种方式的。

 

  1. 找出所有有提成的员工,列出名字、工资、提出,显示结果按工资从小到大,提成从小到大.

select first_name,salary,commission_pct from s_emp where commission_pct is not null order by salary desc,commission_pct;

 

  1. 42部门有哪些职位

select distinct title from s_emp where dept_id=42;

 

  1. 哪些部门不是Sales部

select id,name,region_id from s_dept where name <> ‘Sales’;

注意大小写!

 

  1. 显示工资不在1000到1550之间的员工信息:名字、工资,按工资从大到小排序。

select first_name,salary from s_emp where salary not between 1000 and 1550 order by salary desc;

需要使用到not between and 函数,不能使用 salary > 1550 and salary <1000

 

  1. 显示职位为Stock Clerk和Sales Representative,年薪在14400和17400之间的员工的信息:名字、职位、年薪。

select first_name,title,salary*12 ann_sal from s_emp where title in (‘Stock Clerk’,’Sales Representative’) and salary between 1200 and 1450;

注意把年薪的范围换算成了每月的工资salary,而不是salary*12。以提高查询效率。

 

  1. 解释select id,commission_pct from s_emp where commission_pct is null和select id,commission_pct from s_emp where commission_pct = null的输出结果。

is null判断是否为空,= null判断某个值是否等于null,null=null和null<>null都为null。

第一条语句有输出结果,就是没有提成的ID号。

第二条语句没有输出。

 

10.select语句的输出结果为

select * from s_dept;

select * from s_emp;

select * from s_region;

select * from s_customer;

……

当前用户有多少张表,结果集有多少条记录。

select ‘select * from ‘||table_name||’;’ from user_tables;

 

11.判断select first_name,dept_id from s_emp where salary > ‘1450’是否抱错,为什么?

隐式数据类型转换

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/278070.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号