当前位置: > IT面试 >

Oracle9i笔试题面试题B

时间:2019-01-05 21:50来源:未知 作者:IT

EMP表

EMP表

列名称

定义

列名称

定义

Empno

NUMBER(4),PK

Deptno

NUMBER(2)

Ename

VARCHAR2(10)

Dname

VARCHAR2(14)

Job

VARCHAR2(9)

Loc

VARCHAR2(13)

Mgr

NUMBER(4)

 

Hiredate

DATE

 

Sal

NUMBER(7,2)

 

Comm

NUMBER(7,2)

 

Deptno

NUMBER(2),FK

 

 

  • Empno—-Employee
  • Ename—-Employee  Name
  • Job—-Job Title
  • Mgr—-Manager of Employee
  • Hiredate—-Hire date
  • Sal—-Salary(每月)
  • Comm—-Commission(销售)
  • Deptno—-Department Number
  • Dname—-Department Name
  • Loc—-Location of Operation

 

1.下面哪一个查询将以小写字母显示各个部门的名称?

a.SELECT LOW (dname) FROM dept;

b.SELECT LOWER (dname) FROM dept;

c.SELECT LOWERCASE (dname) FROM dept;

d.SELECT NOTUPPER (dname) FROM dept;

 

2.如果Sal列包含各个员工的工资, Comm列包含销售代表所得到的佣金,那么下面哪一个查询将显示各个员工的总工资?选出所有正确的答案.

a.SELECT ename,sal + NVL (comm,0) AS”Gross Salary”FROM emp;

b.SELECT ename,NVL2 (sal + com,sal,comm)”Gross “FROM emp;

c.SELECT ename,NVL (comm,0) + sal FROM emp;

d.SELECT ename,NVL (sal + com,sal) FROM emp;

 

3.下面哪一个查询将返回在部门10工作的所有人的总工资?选出所有正确的答案.

a.SELECT SUM (sal) FROM emp WHERE deptno = 10;

b.SELECT TOTAL (sal) FROM emp WHERE deptno = 10;

c.SELECT SUM (sal) FROM emp WHERE deptno = 10 GROUP BY deptno;

d.SELECT SUM (sal) FROM emp HAVING deptno = 10;

e.SELECT SUM (SAL) FROM emp HAVING deptno = 10 GROUP BY deptno;

 

4.下面哪一个查询将显示与名为King的员工在同一个部门工作的所有员工的姓名?

a.SELECT ename FROM emp WHERE ename = ‘KING’;

b.SELECT ename FROM emp WHERE deptno = (SELECT deptno FROM emp WHERE ename = ‘KING’;

c.SELECT ename FROM emp WHERE ename = (SELECT deptno FROM emp WHERE ename = ‘KING’);

d.SELECT ename FROM emp WHERE deptno = (SELECT deptno FROM emp WHERE ename = ‘KING’);

 

5.下面哪一个查询将显示员工的平均月薪至少为1500美元的部门的名称?

a.SELECT dname,AVERAGE (sal)

FROM dept NATURAL JOIN emp

WHERE AVERAGE (sal) > 1500;

b.SELECT dname,AVERAGE (sal)

FROM dept NATURAL JOIN emp

HAVING AVERAGE (sal) > 1500;

c.SELECT dname,AVG (sal)

FROM dept NATURAL JOIN emp

WHERE AVG (sal) > 1500;

d.SELECT dname,AVG (sal)

FROM dept NATURAL JOIN emp

GROUP BY dname

HAVING AVG (sal) > 1500;

 

6.下面哪一个查询将显示各个员工号的第4个数字?

a.SELECT ename,SUBSTR (empno,4,1) FROM emp;

b.SELECT ename,LENGTH (empno,4) FROM emp;

c.SELECT ename,TRUNC (empno,4) FROM emp;

d.SELECT ename,SOUNDEX (empno,4,1) FROM emp;

 

7.下面哪一个查询将返回公司中所有员工的月薪的总和?

a.SELECT SUM (sal) FROM emp GROUP BY deptno;

b.SELECT SUM (sal) FROM emp ;

c.SELECT SUM (DISTINCT sal) FROM emp;

d.SELECT TOTAL (sal) FROM emp WHERE sal IS NOT NULL;

 

8.下面哪一个查询将只返回职务为文员(clerk)的那些员工的姓名?

a.SELECT UPPER (ename) FROM emp

WHERE LOWER (job) = ‘CLERK’;

b.SELECT LOWER (ename) FROM emp

WHERE LOWER (job) = ‘CLERK’;

c.SELECT UPPER (ename) FROM emp

WHERE LOWER (job) = ‘clerk’;

d.SELECT LOWER (ename) FROM emp

WHERE UPPER (job) = ‘clerk’;

 

9.下面哪一种说法是正确的?

a.组函数用来计算每一行的多个值,而单行函数用来计算每一行的惟一的一个值;

b.包含组函数的查询还必须包含GROUP BY子句;

c.组函数对处理的每一组行都返回一个值,而单行函数对处理的每一行返回一个值;

d.在包含单行函数的查询中不能使用HAVING子句;

 

10.下面描述的哪一种情况需要使用子查询?

a.你需要知道工资高于员工Blake的工资的所有员工;

b.你需要知道月薪超过1000美元的所有文员的姓名;

c.你需要在部门30工作的所有员工的列表;

d.你需要了解各个部门的所有员工的平均工资;

 

11.下面哪一个查询将计算当天的日期与聘用一个员工的日期之间的时间?

a.SELECT ename,MONTH_BETWEEN (SYSDATE,hiredate)

FROM emp;

b.SELECT ename,SYSDATE-hiredate

FROM emp;

c.SELECT ename, DIFF (SYSDATE,hiredate)

FROM emp;

d.SELECT ename,TO_DATE (SYSDATE,hiredate)

FROM emp;

 

12.下面查询之后的哪一个子句将使查询返回一个出错消息?

SELECT ename

FROM emp

WHERE sal>

(SELECT AVG (sal)

FROM emp

GROUP BY deptno);

a.SELECT ename

b.WHERE sal>

c.SELECT AVG (sal)

d.GROUP BY deptno

 

13.下面哪一个查询将返回职务相同的员工的数量?

a.SELECT COUNT (*),job FROM emp GROUP BY job;

b.SELECT COUNT (job) FROM emp;

c.SELECT COUNT (DISTINCT job) FROM emp;

d.SELECT SUM (job) FROM emp ;

 

14.下面哪一个查询将显示员工的最低工资?

a.SELECT MIN (ename) FROM emp;

b.SELECT LOW (ename) FROM emp;

c.SELECT LOWER (sal) FROM emp;

d.SELECT MIN (sal) FROM emp;

e.SELECT MIN (sal) FROM emp GROUP BY job;

 

15.下面哪一个查询将显示与员工Smith在同一个部门工作但是工资高于Smith的所有员工的姓名?

a.SELECT ename FROM emp

WHERE deptno = ‘SMITH’AND sal> ‘SMITH’;

b.SELECT ename FROM emp

WHERE (deptno,sal) >

(SELECT deptno,sal FROM emp

WHERE ename = ‘SMITH’);

c.SELECT ename FROM emp WHERE deptno =

(SELECT deptno FROM emp WHERE ename = ‘SMITH’)

AND sal >(SELECT sal FROM emp WHERE ename = ‘SMITH’);

d.SELECT ename FROM emp

WHERE (deptno,sal) > ANY

(SELECT deptno,sal FROM emp

WHERE ename = ‘SMITH’);

 

16.下面哪一个运算符是有效的多行运算符?

a.ANY

b.OR

c.=

d.>

 

17.下面哪些查询将显示在波士顿工作的所有员工的姓名?选择所有正确的答案.

a.SELECT ename FROM emp NATURAL JOIN dept

WHERE loc = ‘BOSTON’;

b.SELECT ename FROM emp WHERE loc = ‘BOSTON’;

c.SELECT ename FROM dept WHERE loc = ‘BOSTON’;

d.SELECT ename FROM emp WHERE deptno =

(SELECT deptno FROM dept WHERE loc ‘BOSTON’);

e.SELECT ename FROM emp WHERE deptno = ‘BOSTON’;

 

18.下面哪一个运算符与在一个多行子查询中使用IN运算符是等价的?

a. =ANY

b. =ALL

c. >ANY

d. <ANY

 

19.假定列可以包含NULL值,那么下面哪些查询将显示公司中获得佣金的员工的数量?选出所有正确的答案.

a.SELECT COUNT (comm) FROM emp;

b.SELECT COUNT (comm) FROM emp

WHERE comm IS NULL;

c.SELECT COUNT (*) FROM emp

WHERE comm IS NOT NULL;

d.SELECT COUNT (*) FROM emp

WHERE comm IS NULL;

 

20.下面哪一项是单行函数?

a.AVERAGE

b.VARIANCE

c.SUM

d.ADD_MONTHS



(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容