2017年Oracle数据库基础测试答案_第1页
2017年Oracle数据库基础测试答案_第2页
2017年Oracle数据库基础测试答案_第3页
2017年Oracle数据库基础测试答案_第4页
2017年Oracle数据库基础测试答案_第5页
免费预览已结束,剩余9页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、2017年Oracle数据库基础测试答案姓名成绩、单项选择题(每题 1分,共60分)1 .列出EMP1中,从事每个工种(JOB)的员工人数A.selectjob from emp;B. selectjob,count(*) from emp;C. select distinctjob,count(*) from emp;D. selectjob,count(*) from emp group by job;2 .查询EMP!中的数据并且显示出行号(从1开始)A.select rowid,a.* from emp a;B. select level,a.* from emp a;C. selec

2、t rownum,a.* from emp a;D. select sequence,a.* from emp a;3 . Oracle数据库中发出一个查询。下列哪个选项不能查询对用户定义静态表 达式执行数学运算时的查询组件?A.列子句 B .表子句 C . DUALD. where子句4 .你要操纵Oracle数据,下列哪个不是SQL命令?A. select * from dual;B. set defineC. update emp set ename = 6543 where ename = SMITHERS ;D. create table employees(empid varcha

3、r2(10) primary key);5 .你要在Oracle中定义SQL查询。下列哪个数据库对象不能直接从select语句中引用?A.表 B .序列C.索引 D .视图6 .你要根据PRODUCT_NAME PROFITS查询中过滤返回的数据。下列哪个 子句包含相应过滤条用的引用?A. select B . fromC. where D . having7 .下列代码显示了 PROFITS输出的局部:PRODUCT_NAMmRODUCT_TYPTR_END_DATEPROFIT 下列查询的where子句哪个能正确计算2001年1月1日至U 6月1日六个月 内销售的所有家电总利润?BARNE

4、Y DOLL TOYGAS GRILLAPPPENCILOFFICE31-MAR-200131-MAR-200130-JUN-20016575430.301234023.8834039.99A.where product_name =GAS GRILL and qtr_end_datebetween 01-JAN-2001 and 01-JUN-2001;B. where proeuct_type =APPLIANCE and name = GAS GRILL andqtr_end_date= 31-JAN-2001 or 30-JUN-2001;C.where proeuct_type =A

5、PPLIANCE and qtr_end_datebetween 01-JAN-2001 and 01-JUN-2001;D.where proeuct_name =GAS GRILL and qtr_end_date=01-JAN-2001 or 01-JUN-2001;用下列代码所示的内容回答后面八个问题:EMPNOENAMEDEPTNOJOBMGRHIREDATESALCOMM7369SIMTHCLERK790217-DEC-80800207499ALLENSALESMAN769820-FEB-811600300307521WARDSALESMAN769822-FEB-811250500

6、307566JONESMANAGER783902-APR-812975207654MARTINSALESMAN769828-SEP-8112501400307698BLAKEMANAGER783901-MAY-812850307782CLARKMANAGER783909-JUN-812450107788SCOTTANALYST756619-APR-873000207839KINGPRESIDENT17-NOV-815000107844TURNERSALESMAN769808-SET-8115000307876ADAMSCLERK778823-MAY-871100207900JAMESCLERK

7、768903-DEC-81950307902FORDANALYST756603-DEC-813000207934MILLERCLERK778223-JAN-821300108 .以下选项中哪个是下列查询返回的值:select sum(sal) + sum(comm) fromemp where job =ANALYST or ename likeJ% ?A. 6000 B . 9925 C . 9975 D. NULL9 .以下选项中哪个是下列查询返回的值:select count(mgr) from emp wheredeptno = 10 ?A. 1B, 2 C . 3 D . NULL1

8、0 .以下选项中哪个是下列查询返回的值:select count(*) from emp where mgr = 7700-2 ?A. 5 B . 6 C .7 D . NUL11 .以下选项中哪个是下列SQL#令产生的第三个员工:select ename, sal fromemp where job= SALESMA N order by empno desc ?A. ALLEN B. MARTIN C. TURNER D. WARD12 .以下选项中哪个是下列 SQL命令产生的第三个员工:ename, sal from emp where job= SALESMA N order by 1

9、 desc ?A. ALLEN B. MARTIN C . TURNER D WARD13 .以下选项中哪个是发出下列查询后 Oracle返回的值:select substr(job, 1, 3) from empwhere enamelike upper( _ar%)A. ANA B . CLE C . MAN D . SAL14 .以下选项中哪个是发出下列查询后 Oracle返回的值:selecttrunk(months_between(min(hiredate), max(hiredate) from emp ? A. 24 B . 25C. -24 D . -2515 .以下选项中哪个

10、是发出下列查询后 Oracle返回的值:select * from emp where hiredate 23-JAN-82 ?(选择两个答案)A. ADAMS B . MILLERC. SCOTT D . SMITH16 .TEST表包含两个歹U, TESTCOL义为数据类型 NUMBER(10)TESTCOL_定义 为数据类型VARCHAR2(10)在Oracle中发出下列语句:insert into test(testcol, testcol_2) values (null, FRANCIS ),然后对表进程下列查询:select nvl(testcol,EMPTY) as testco

11、l from test wheretestcol_2 = FRANCIS。下列选项哪个是得到的结果?A. Oracle 返W果 0B . Oracle 返W果 EMPTYC. Oracle返回名果NULLD. Oracle返回错误结果17.要从ORDERS中取得数据,其中包括三个歹U CUSTOMERORDER_DATE ORDER_AMTT以用下列哪个where子句查询ORDERS,取得客户LESLIE 超过2700的订单?A. where customer =B. where customer =LESLIE;LESLIE and order_amt 2700;D. where custo

12、mer = LESLIE and order_amt 2700;18 .查询出当前的数据库系统时间,精确到秒A. select to_date(sysdate,YYYY-MM-DD HH24:MI:SS) from dual;B. select to_char(sysdate,YYYY-MM-DD HH24:MI:SS) from dual;C. select date(sysdate,YYYY-MM-DD HH24:MI:SS) from dual;D. select chr(sysdate,YYYY-MM-DD HH24:MI:SS) from dual;19 .用下列代码块回答问题:SQ

13、L select(-45) as output from dual; OUTPUT-45下列哪个单行函数无法产生这个输出?A. abs() B . ceil() C . floor() D . round()20 .对表中的某一行,VARCHAR2包含数值SMITHY应用程序在右侧填充七个 空格。length()函数处理这个列值时,返回什么值?A. 6B. 13 C .30 D . 6021 .在Oracle中发出的下列查询:SQLselect months_between( 15-MAR-83 , 15-MAR-97 ) form dual; Oracle返回什么?A. 14 B . -14

14、 C . 168 D. -16822 .你要在Oracle中使用日期信息的格式掩码。下列哪种情形不适合这个格式 掩码?.to_char()D. to_number()A. to_date()BC. alter session set nls_date_format23 .数据库中有两表 PRODUCT STORAGE_BOX中歹U出各个产品的惟一 ID号、 产品名和特定产品所在的箱子。另一个表列出各个存储箱(用数字标识) 可以包含许多产品,但每个箱子只能在一个地方。下列哪个语句能正确显示 这个数据库中所有产品ID、名称和箱子地址?A. select d_id, d_name

15、, b.box_loc from product p, storage_box b d_id = d_id and prod_name= WIDGET ;B. select d_id, d_name, b.box_loc from product p, storage_box b whereprod_name- WIDGET ;C. select d_id, d_name, b.box_loc from product p, storage_box b wherep.stor_box_num = b.stor_box_num

16、 and prod_name= WIDGET ;D. select prod_id, prod_name, box_loc from product , storage_box where stor_box_num = stor_box_num and prod_name= WIDGET ;24 .开发报会时,要连接三个表面S息,这些表方 EMP DEPlt SALGRADEH 需要公司10级以上员工相应的员工、部门地址与工资范围的记录。这个查 询需要多少比较运算?A. 2B. 3 C . 4D . 525 .要连接两个表PRODUSTSTOTAGE内容,列出所有包含产品的箱子地址。 PROD

17、UCT三歹U ID、 NAMEf BOX# STORAGE两歹U BOX#! LOC 下列哪个 选项无法得到想要的结果?A. select product.id, , storage.loc from product, storage where product.box#=storage.box#;B. select product.id, , storage.loc from product join storage on product.box#=storage.box#;C. selectproduct.id,,st

18、orage.locfrom product naturaloin storage on product.box#=storage.box#;D. selectproduct.id,,storage.locfrom product naturaljoin storage;26 .数据库中有两个表 PRODUCT STORAGE_B,OX中列J出各个产品的惟一 ID 号、产品名和特定产品所在的箱子。另一个表中列出各个存储箱(用数字标 识)可以包含许多产品,但每个箱子只能在一个地方。下列哪个语句能正确 显示这个数据库中所有产品ID、名称和箱子地址,不管有没有指定存储箱? A.

19、 select d_id, d_name, b.box_loc from product p left outer join storage_box b onp.stor_bax_num = b. stor_bax_num where prod_name= WIDGET (+); B. select d_id, d_name, b.box_loc from product p left outer join storage_box b onp.stor_bax_num = b. stor_bax_num where prod_name= WIDGET ;

20、 C. select d_id, d_name, b.box_loc from product p right outer join storage_box bwhere b.stor_bax_num = p. stor_bax_num(+) and prod_name- WIDGET (+);D. select d_id, d_name, b.box_loc from product p full outer join storage_box b onp.stor_bax_num = b. stor_bax_num where b.stor_box_n

21、um is NULL ;27 .列出薪水高于所在部门平均工资的员工信息A.select deptno,ename,sal from emp a where sal(select avg(a.sal) from emp where deptno=a.deptno);B. select deptno,ename,sal from empa where sal(select avg(sal) from emp where deptno=a.deptno);C.select a.deptno,a.ename,a.sal from emp a,emp b where a.deptno=b.deptno

22、and a.salavg(b.sal);D. select a.deptno,a.ename,a.sal from emp a,emp b where a.deptno=b.deptno and b.salavg(a.sal);28 .要查询PROFITS存储公司不同地区、产品类型和季度的利润信息。下列哪 个SQL语句显示不同地区、产品类型和季度的利润的交叉表输出?A. select region, product_type, time,sum(profit) from profits group by region, prod_type, time;B. select region, pro

23、duct_type, time from profits group by rollup(region, prod_type, time);C. select region, product_type, time, from profits group by cube(region, prod_type, time);D. select region, product_type, time,sum(profit) from profits groupby cube(region, prod_type, time);29 .对数据库运行下列哪个group by查询时不会从Oracle产生错误?A

24、. select deptno, job, sum(sal) from emp group by job, deptno;B. select sum(sal), deptno, job from emp group by job, deptno;C. select deptno, job, sum(sal) from emp;D. select deptno, sum(sal), job from emp group by job, deptno;30 .检查下列SQL勺输出SQL select a.deptno,a.job,b.loc,sum(a.sal)2 from dmp a,dept

25、b3 where a.deptno = b.depton4 group by a.deptno,a.job,b.loc5 order by sum(a.sal);这个查询按哪个列的顺序返回输出?A. A.DEPTON B. A.JOB C . B.LOCD. SUM(A.SAL)31 .要查询的PROFITSg存储公司不同地区、产品类型和季度的利润信息。下列 哪个SQL句按不同地区、产品类型和季度求出平均利润大于100000美元的利润?A. selectregion,prod_type,period,avg(profits)from profitswhereavg(prodit) 100000

26、 group by region, prod_type, period;B. selectregion,prod_type,period,avg(profits)from profitswhereavg(prodit) 100000 order by region, prod_type, period;C. selectregion,prod_type,period,avg(profits)from profitsgroupby region, prod_type, period having avg(prodit) 100000;D. selectregion,prod_type,perio

27、d,avg(profits)from profitsgroupby region, prod_type, period having avg(prodit) 100000;32 .公司的员工费用应用程序有两表,一个是EMP包含所有员工数据,一个是EXPENSE包含公司每个员工提交的费用票据。下列哪个查询取得提交的费 用总和超过其工资值的员工ID与姓名?A. select e.empno, e.ename from emp e where e.sal (select sum(x.vouch_amt) from expense x) and x.empno = e.empno;B. select

28、e.empno, e.ename from empe where e.sal (select x.vouch_amt from expense x where x.empno = e.empno);C. select e.empno, e.ename from emp e where e.sal select ename2 from emp3 where empno in4 ( select empno5 from expense6 where vouch_amt 10000 );下列哪个SQL句产生与上面相同的输出,改写成使用运算符?A. select e.ename from empe w

29、here exists(select x.empno from expense x where x.vouch_amt10000)and x.empno = e.empno;B. select e.ename from empe where exists(select x.empno from expense x where x.vouch_amt10000 and x.empno = e.empno);C. select e.ename from empe where x.empno = e.empnoand exists(select x.empno from expense xwhere

30、 x.vouch_amt10000)D. select e.ename from emp e, expense x where x.empno = e.empno and x.vouch_amt10000 andexists(select x.empno from expense x where)34.用下列代码块回答问题:SQL select deptno,job,avg(sal)2 from emp3 group by deptno,job4 having avg(sal)5 ( select sal6 from emp7 where ename =MARTIN );上述语句使用下面哪种子

31、查询?A.单行子查询B .多行子查询 C . from子句子查询 D .多列子查询35 .公司销售数据库有两个表,PROFIT行储不同地区不同季度的产品销售利润,REGION旃储每个部门地区名称、该地区总部地址和该地区副总裁姓名。下列哪个查询取得SMITHERS FUJIMORI与LIKKARAJU导的地区的玩具销 售禾I润?A. select sum(profit) from profits where region in (select region froms where reg_head in(SMITHERS,FUJMORI ,LAKKARAJU) and product=TOYS

32、;B. select sum(profit) from profits where region in (select region froms where reg_head in(SMITHERS,FUJMORI ,LAKKARAJU) and product=TOYS );C. select sum(profit) from profits where region = (select region fromswhere reg_head in(SMITHERS,FUJMORI ,LAKKARAJU) and product=TOYS ;D. select sum(profit) from

33、 profits where region in (select region froms where reg_head in(SMITHERS,FUJMORI ,LAKKARAJU) and product=TOYS ;36 .查询出EM俵中COMMP段为空的记录()A. select * from emp where comm=;B. select * from emp where comm=null;C. select * from emp where nvl(comm)=0;D. select * from emp where comm is null;37 .用下列代码块回答问题:S

34、QL select e.deptno,e.ename,e.job,e.sal2 from emp e3 where e.sal =4 ( select max(e2.sal)5 fromemp e26* where nvl(e.deptno,99) = nvl(de.deptno,99);DEPTNOENAMEJOBSAL30BLAKEMANAGER285010CLARKMANAGER245020SCOTTKINGANALYSTPRESIDENT3000500020FORDANALYST3000要在上述返回集的DEPTNOW显示99,可以用下列哪个SQL语句?A. select nvl(e.d

35、eptno,99), e.ename, e.sal from empe where (e.deptno, e.sal) = (select max(e2.sal) from emp e2 where nvl(e.dept, 99)= nvl(e2.deptno, 99);B. select nvl(e.deptno,99), e.ename, e.sal from emp e where e.sal = (select max(e2.sal) from empe2 where nvl(e.dept, 99) = nvl(e2.deptno, 99);C. select nvl(e.deptno

36、,99), e.ename, e.sal from empe where (e.deptno, e.sal) = (select e2.deptno, max(e2.sal) from empe2 where nvl(e.dept, 99) = nvl(e2.deptno, 99);D. select nvl(e.deptno,99), e.ename, e.sal from empe where (e.deptno, e.sal) = (select e2.deptno,max(e2.sal) from empe2 where nvl(e.dept, 99) = nvl(e2.deptno,

37、 99) group by el.deptno);38 .公司销售数据库包含一个PROFITS,按产品名、销售地区和季度列出利润 信息。如果要取得公司五个最畅销产品清单,可以用下列哪个SQL语句:A. select d_name, fitfrom (select prod_name, profit fromprofits order by profit desc) where rownum = 5;B. select d_name, fitfrom (select prod_name, sum(profit)from profits group by p

38、rod_name order by sum(profit) desc) subq where d_name = d_name;C. select d_name, fit from (select prod name, sum(profit) from profits group by prod_nameorder by sum(profit) desc) where rownum = 5;D. select d_name, fit from (select prod_name, sum(profit) from profits

39、order by sum(profit) desc) where rownum select profit from from profits where prod type = TOY and time period =&v_period ;D. accept v_period select profit from from profits where prod_type = TOY and time_period =&v_period ;40 .查询出EMPfe中1982年及以后入职的员工信息(注:字段hiredate为入职日 期,数据类型为DATE1A. select * from em

40、p where hiredate=19820101;B. select * from empwhere hiredate=to_char(19820101,YYYYMMDD); C.select * from empwhere to_date(hiredate,YYYYMMDD)=19820101; D. select * from empwhere to_char(hiredate,YYYYMMDD)=19820101;41.Oracle中要生成数据库表,下列哪个选项是无效表生成的语句?A. create table cats(c_name varchar2(10), c_weight nu

41、mber, c_owner varchar2(10);B. create table my_cats as select * from cats where owner =ME ;C. create global temporary table temp_cats(c_name varchar2(10), c_weight number, c_owner varchar2(10);D. create table cats over 5 lbs as select c name, c weight from cats where c_weight 5;42.试图在Oracle生成表时遇到下列错误

42、:ORA-00955-names already used by existing object 。下列哪个选项无法纠正这个错误?A.以不同的用户身份生成对象。B .删除现有同名对象C.改变生成对象中的列名。D .更名现有同名对象。43.SALES表中的PROFIT/U声明为NUMBER(10, 2下列哪个值无法在这个列 中存储?A. 5392845.324B. 871039453.1C. 75439289.34 D . 60079829.2544.员工KING于1981年11月17日聘用,你对Oracle数据库发出下列查询: select vsize(hiredate) from emp w

43、here ename = KING 。下歹!J哪个选项是返回的值?A. 4B. 7 C . 9D .1745.SALES表中将PRODUCT_NAM定义为CHAR(40后面要在表中增加一行, PRODUCT_NAME CAT_TOYS然后发出下歹U命令:select vsize(product_name) from sales 。下歹!J哪个选项是返回 的值?A. 8B. 12C. 40 D . 400046 .要把非 NULL NUMBER(10)变成 NUMBER(6)。发出适当 alter table 命令 之后必须完成下列哪些步骤?A.将列记录复制到临时存储地址。B .将所有行的NUM

44、BER设置为NULLC.对NUMBER据生成临时地址。D,将列记录从临时地址复制加主表中。47 .发出下歹!J语句: alter table sales drop columm profit;何时从 Oracle中实际删除列?A执行语句后立即删除。B.发出 alter table drop unused columns 命令之后C.发出 alter table set unused columns 命令之后D.发出alter table modify命令之后48 .要把SALE族中的PRODUCT_TYPE勺大小从 VARCHAR5)歹时曾力口至U VARCHAR2(10)用下列哪个语焉?A.

45、 alter table sales add(product_type varchar2(10);B. alter table sales modify product_type varchar2(10);C. alter table sales unused column product_type varchar2(10);D. alter table sales drop column product_type;49 .数据库中的PROFITS中PRODUCT_NAM田ALE_PERIOD建立主键。下列 哪个语句无法定义这个主键?A. create table profits(produc

46、t_name varchar2(10), sale_perion varchar2(10), profit number, constraint pk_profits_01 primary key (product_name, sale_period);B. alter table profits add constraint pk_profits_01 primary key(product_name, sale_period) deferrable initially immediate;C. alter table profits add(constraint pk_profits_01

47、 primary key(product_name, sale_period);D. create table profits(product_name varchar2(10) primary key, sale_period varchar2(10) Primary key, profit number)50 .列出JONES的所有下属员工,但不包括JONES本人A. select ename from emp connect by prior empno=mgr start with ename=JONES;B. select ename from emp where enameJONE

48、S connect by prior empno=mgr start with ename=JONES;C.select ename from emp where ename=JONES connect by prior empno=mgr start with ename=JONES;D. select ename from emp where ename=JONES connect by prior empno=mgr start with enameJONES;51 .以下关于数据库文件的说法正确的是()A、数据库是由数据文件构成的,其它文件是辅助文件B、数据库中的表,索引以及日志信息都

49、是以数据的形式存储在数据文件中 的G在线重做日志文件与归档日志文件的区别是:前者在内存,后者在外存上D 数据块的大小一旦确定,就不能更改了,除非重新设定数据库52 .你要关闭SALESft中UNIT_PRIC例的非NUL必束。下列哪个语句能完成这 个操作?A. alter table sales modify(unit_prices null);B. alter table sales modify(unit_prices not null);C. alter table sales add(unit_prices null);D. alter table sales add(unit_pri

50、ces not null);53、以下()内存区不属于SGAA. PGAB.日志缓冲区C.数据缓冲区D.共享池54、()模式存储数据库中数据字典的表和视图。A. DBA B . SCOTT C . SYSTEM D. SYS55、锁用于提供()。A.改进的性能B.数据的完整性和一致性C,可用性和易于维护D.用户安全56、以下哪种备份方式需要在完全关闭数据库进行()。A.无归档日志模式下的数据库备份B.归档日志模式下的数据库备份C.使用导出实用程序进行逻辑备份D.以上都不对57.下面列举的是一些后台进程的功能:1:在数据文件头部记录检查点信息.2:在实例启动时执行恢复3:清理无用的临时段4:当用户进程失败时清理其资源.5:动态注册数据库服务到监听.6:监控

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论