一、选择题(每题1分)
1.调档线Oracle发出下列lect语句:
SQL> pno, e.ename, d.loc
2 from emp e, dept d
3 where e.deptno = d.deptno
4 and ame, 1, 1) = ‘S’;
下列哪个语句是Oracle数据库中可用的ANSI兼容等价语句?
A.lect empno, ename, loc from emp join dept on emp.deptno = dept.deptno where
ame, 1, 1) = ‘S’;
B.lect empno, ename, loc from emp, dept on emp.deptno = dept.deptno where
ame, 1, 1) = ‘S’;
C.lect empno, ename, loc from emp join dept where emp.deptno = dept.deptno and
ame, 1, 1) = ‘S’;
D.lect empno, ename, loc from emp left join dept on emp.deptno = dept.deptno and
ame, 1, 1) = ‘S’;
2.你要对操纵Oracle数据库中的数据。下列哪个选项表示Oracle中lect语句的功能,并且不需要使用子查询?
A.可以用lect语句改变Oracle中的数据 B.可以用lect语句删除Oracle中的数据
C.可以用lect语句和另一个表的内容生成一个表 D.可以用lect语句对表截断
3.Oracle数据库中发出一个查询。下列哪个选项不能查询对用户定义静态表达式执行数学运算时的查询组件?
A.列子句 B.表子句 C.DUAL表 D.where子句
4.你要操纵Oracle数据,下列哪个不是SQL命令?经期喝咖啡
A.lect * from dual; B.t define
犯恶心想吐怎么回事C.update emp t ename = 6543 where ename = ‘SMITHERS’;
D.create table employees(empid varchar2(10) primary key);
5.你要在Oracle中定义SQL查询。下列哪个数据库对象不能直接从lect语句中引用?
A.表 B.序列 C.索引 D.视图
6.你要根据PRODUCT_NAME列从PROFITS表查询中过滤返回的数据。下列哪个子句包含相应过滤条件的引用?
A.lect B.from C.where D.having
7.下列代码显示了PROFITS表输出的局部:
PRODUCT_NAME PRODUCT_TYPE QTR_END_DATE PROFIT
南麂岛
------------ ------------ ------------ -------------
BARNEY DOLL TOY 31-MAR-2001 6575430.30
GAS GRILL APP 31-MAR-2001 1234023.88
PENCIL OFFICE 30-JUN-2001 34039.99
下列查询的where子句哪个能正确计算2001年1月1日到6月1日六个月内销售的所有家电总利润?
A.where product_name = ‘GAS GRILL’ and qtr_end_date between ’01-JAN-2001’ and ‘01-JUN-2001’;
B.where proeuct_type = ‘APPLIANCE’ and name = ‘GAS GRILL’ and qtr_end_date
= ’31-JAN-2001’ or ‘30-JUN-2001’;
C.where proeuct_type = ‘APPLIANCE’ and qtr_end_date between ’01-JAN-2001’ and ’01-JUN-2001;
怀孕期间能用护肤品吗
D.where proeuct_name = ‘GAS GRILL’ and qtr_end_date = ’01-JAN-2001’ or ‘01-JUN-2001’;
用下列代码所示的内容回答后面八个问题:
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
------ ---------- --------- ---- --------- ---- ---- ------
7369 SIMTH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-82 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SET-81 1500 0 30
7876 ADAMS CLERK 7788 23-DEC-82 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20刘涛资料
7934 MILLER CLERK 7782 23-JAN-82 1300 10
8.以下选项中哪个是下列查询返回的值:lect sum(sal) + sum(comm) from emp where job = ‘ANALYST’ or ename like ‘J%’ ?
A.6000 B.9925 C.9975 D.NULL
9.以下选项中哪个是下列查询返回的值:lect count(mgr) from emp where deptno = 10 ?
xx片A.1 B.2 C.3 D.NULL
10.以下选项中哪个是下列查询返回的值:lect count(*) from emp where mgr = 7700-2 ?
A.5 B.6 C.7 D.NUL
11.以下选项中哪个是下列SQL命令产生的第三个员工:lect ename, sal from emp where job= ‘SALESMAN’ order by empno desc ?
A.ALLEN B.MARTIN C.TURNER D.WARD
12.以下选项中哪个是下列SQL命令产生的第三个员工:ename, sal from emp where job= ‘SALESMAN’ order by 1 desc ?
喝的成语A.ALLEN B.MARTIN C.TURNER D.WARD
13.以下选项中哪个是发出下列查询后Oracle返回的值:lect substr(job, 1, 3) from emp where ename like upper(‘__ar%’) ?
A.ANA B.CLE C.MAN D.SAL
14.以下选项中哪个是发出下列查询后Oracle返回的值:lect trunc(months_between(min(hiredate), max(hiredate))) from emp ?
A.24 B.25 C.-24 D.-25
15.以下选项中哪个是发出下列查询后Oracle返回的值:lect * from emp where hiredate >
’23-JAN-82’ ?(选择两个答案)
A.ADAMS B.MILLER C.SCOTT D.SMITH
16.TEST表包含两个列,TESTCOL定义为数据类型NUMBER(10),TESTCOL_2定义为数据类型VARCHAR2(10)。在Oracle中发出下列语句:inrt into test(testcol, testcol_2) values (null, ‘FRANCIS’),然后对表进行下列查询:lect nvl(testcol, ‘EMPTY’) as testcol from test where testcol_2 = ‘FRANCIS’。下列选项哪个是得到的结果?
A.Oracle返回结果0 B.Oracle返回结果EMPTY
C.Oracle返回结果NULL D.Oracle返回错误结果
17.要从ORDERS表中取得数据,其中包括三个列CUSTOMER、ORDER_DATE与ORDER_AMT。可以用下列哪个where子句查询ORDERS表,取得客户LESLIE超过2700的订单?
A.where customer = ‘LESLIE’;
B.where customer = ‘LESLIE’ and order_amt < 2700;
C.where customer = ‘LESLIE’ or order_amt > 2700;
D.where customer = ‘LESLIE’ and order_amt > 2700;
18.用下列输出回答问题(假设这里的信息来自本章使用的EMP表):
EMPNO
----------