Oracle+SQL+PLSQL练习题带答案_第1页
Oracle+SQL+PLSQL练习题带答案_第2页
Oracle+SQL+PLSQL练习题带答案_第3页
Oracle+SQL+PLSQL练习题带答案_第4页
Oracle+SQL+PLSQL练习题带答案_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

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

文档简介

Java 教学网整理提供 1 Oracle SQL 下列哪个语句是 Oracle 数据库中可用的 ANSI 兼容等价语句 A select empno ename loc from emp join dept on emp deptno dept deptno where substr emp ename 1 1 S B select empno ename loc from emp dept on emp deptno dept deptno where substr emp ename 1 1 S C select empno ename loc from emp join dept where emp deptno dept deptno and substr emp ename 1 1 S D select empno ename loc from emp join dept on emp deptno dept deptno and substr emp ename 1 1 S 2 你要对操纵 Oracle 数据库中的数据 下列哪个选项表示 Oracle 中 select 语句的功能 并且不需 要使用子查询 A 可以用 select 语句改变 Oracle 中的数据 B 可以用 select 语句删除 Oracle 中的数 据 C 可以用 可以用 select 语句和另一个表的内容生成一个表语句和另一个表的内容生成一个表 D 可以用 select 语句对表截断 3 Oracle 数据库中发出一个查询 下列哪个选项不能查询对用户定义静态表达式执行数学运算时的 查询组件 A 列子句 B 表子句 C DUAL 表 D where 子句子句 4 你要操纵 Oracle 数据 下列哪个不是 SQL 命令 A select from dual B set define C update emp set ename 6543 where ename SMITHERS D create table employees empid varchar2 10 primary key 5 你要在 Oracle 中定义 SQL 查询 下列哪个数据库对象不能直接从 select 语句中引用 A 表 B 序列 C 索引 索引 D 视图 6 你要根据 PRODUCT NAME 列从 PROFITS 表查询中过滤返回的数据 下列哪个子句包含相应 过滤条件的引用 A select B from C where D having 7 下列代码显示了 PROFITS 表输出的局部 PRODUCT NAMEPRODUCT TYPEQTR END DATEPROFIT BARNEY DOLLTOY31 MAR 20016575430 30 GAS GRILLAPP31 MAR 20011234023 88 PENCILOFFICE30 JUN 200134039 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 用下列代码所示的内容回答后面八个问题 用下列代码所示的内容回答后面八个问题 EMPNOENAMEJOBMGRHIREDATESALCOMM DEPTNO 7369SIMTHCLERK790217 DEC 8080020 7499ALLENSALESMAN769820 FEB 81 160030030 7521WARDSALESMAN769822 FEB 81 125050030 Java 教学网整理提供 2 7566JONESMANAGER783902 APR 81 297520 7654MARTINSALESMAN769828 SEP 81 1250140030 7698BLAKEMANAGER783901 MAY 81 285030 7782CLARKMANAGER783909 JUN 81 245010 7788SCOTTANALYST756619 APR 87 300020 7839KINGPRESIDENT17 NOV 81 500010 7844TURNERSALESMAN769808 SET 81 1500030 7876ADAMSCLERK778823 MAY 87 110020 7900JAMESCLERK768903 DEC 8195030 7902FORDANALYST756603 DEC 81 300020 7934MILLERCLERK778223 JAN 82 130010 8 以下选项中哪个是下列查询返回的值 select sum sal sum comm from emp where job ANALYST or ename like J A 6000 B 9925 C 9975 D NULL 9 以下选项中哪个是下列查询返回的值 select count mgr from emp where deptno 10 A 1 B 2 C 3 D NULL 10 以下选项中哪个是下列查询返回的值 select count from emp where mgr 7700 2 A 5 B 6 C 7 D NUL 11 以下选项中哪个是下列 SQL 命令产生的第三个员工 select 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 返回的值 select substr job 1 3 from emp where ename like upper ar A ANA B CLE C MAN D SAL 14 以下选项中哪个是发出下列查询后 Oracle 返回的值 select trunk months between min hiredate max hiredate from emp A 24 B 25 C 24 D 25 15 以下选项中哪个是发出下列查询后 Oracle 返回的值 select 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 中发出下列语句 insert into test testcol testcol 2 values null FRANCIS 然后对表进程下列查询 select 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 D where customer LESLIE and order amt 2700 18 用下列输出回答问题 假设这里的信息来自本章使用的 EMP 表 EMPNO SMITH dog ALLEN dog WARD dog d JONES dog MARTIN dog BLAKE dog CLARK dog SCOTT dog KING dog d Java 教学网整理提供 3 TURNER dog JAMES dog FORD dog d MILLER dog 下列哪个 SQL 语句产生这个输出 A select trim trailing dog from ename as ename from emp B select rpad ename 10 dog as ename from emp C select substr ename 1 10 as ename from emp D select lpad ename 10 dog as ename from emp 19 用下列代码块回答问题 SQL select 45 as output from dual OUTPUT 45 下列哪个单行函数无法产生这个输出 A abs B ceil C floor D round 20 对表中的某一行 VARCHAR2 列包含数值 SMITHY 应用程序在右侧填充七个空格 length 函 数处理这个列值时 返回什么值 A 6 B 13 C 30 D 60 21 SQL Plus 中发出的下列语句 SQL select ceil 97 342 2 floor 97 342 3 round 97 342 4 trunk 97 342 5 from dual 下列哪个函数不返回结果 97 A ceil B floor C round D trunc 22 SQL Plus 中发出的下列语句 SQL select ceil 256 342 2 floor 256 342 3 round 256 342 4 trunk 256 342 5 from dual 下列哪个函数不返回结果 256 A ceil B floor C round D trunc 23 在 Oracle 中发出的下列查询 SQL select months between 15 MAR 83 15 MAR 97 form dual Oracle 返回什么 A 14 B 14 C 168 D 168 24 你要在 Oracle 中使用日期信息的格式掩码 下列哪种情形不适合这个格式掩码 A to date B to char C alter session set nls date format D to number 25 数据库中有两表 PRODUCT 与 STORAGE BOX 表中列出各个产品的惟一 ID 号 产品名和特 定产品所在的箱子 另一个表中列出各个存储箱 用数字标识 可以包含许多产品 但每个箱子 只能在一个地方 下列哪个语句能正确显示这个数据库中所有产品 ID 名称和箱子地址 A select p prod id p prod name b box loc from product p storage box b where p prod id b prod id and prod name WIDGET B select p prod id p prod name b box loc from product p storage box b where prod name WIDGET C select p prod id p prod name b box loc from product p storage box b where p stor box num b stor box num 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 26 开发报表时 要连接三个表的信息 这些表为 EMP DEPT 与 SALGRADE 只需要公司 10 级 以上员工相应的员工 部门地址与工资范围的记录 这个查询需要多少比较运算 A 2 B 3 C 4 D 5 27 要连接两个表 PRODUST 与 STOTAGE 的内容 列出所有包含产品的箱子地址 PRODUCT 有 三列 ID NAME 与 BOX STORAGE 有两列 BOX 与 LOC 下列哪个选项无法得到想要的结 果 Java 教学网整理提供 4 A select product id product name storage loc from product storage where product box storage box B select product id product name storage loc from product join storage on product box storage box C select product id product name storage loc from product natural join storage on product box storage box D select product id product name storage loc from product natural join storage 28 你要定义外连接 下列哪个选项正确描述了外连接语句 A 由于外连接操作允许一个表中有 NULL 值 因此连接这些表时不必指定相等性比较 B 在表 A 与 B 的外连接语句中 如果不管 B 表有无相应记录 都要显示表 A 的所有行 则可以使用右外连接 C 在表 A 与 B 的外连接语句中 如果不管 A 表有无相应记录 都要显示表 B 的所有行 则可以使用左外连接 D 尽管外连接操作允许一个表中有 尽管外连接操作允许一个表中有 NULL 值 但连接这些表时仍要指定相等性比较 值 但连接这些表时仍要指定相等性比较 29 数据库中有两个表 PRODUCT 与 STORAGE BOX 表中列出各个产品的惟一 ID 号 产品名和 特定产品所在的箱子 另一个表中列出各个存储箱 用数字标识 可以包含许多产品 但每个箱 子只能在一个地方 下列哪个语句能正确显示这个数据库中所有产品 ID 名称和箱子地址 不 管有没有指定存储箱 A select p prod id p prod name b box loc from product p left outer join storage box b on p stor bax num b stor bax num where prod name WIDGET B select p prod id p prod name b box loc from product p left outer join storage box b on p stor bax num b stor bax num where prod name WIDGET C select p prod id p prod name b box loc from product p right outer join storage box b where b stor bax num p stor bax num and prod name WIDGET D select p prod id p prod name b box loc from product p full outer join storage box b on p stor bax num b stor bax num where b stor box num is NULL 30 Oracle 中发出下列命令 SQL select e ename a street address a city a post code 2 from emp e addr a 3 where e empno a empno 4 and a state TEXAS 下列哪个选项显示等价 ANSI ISO 语句 A select e ename a street address a city a state a post code from e outer join addr a on e empno a empno where a state TEXAS B select e ename a street address a city a state a post code from e left outer join addr a on e empno a empno where a state TEXAS C select e ename a street address a city a state a post code from e right outer join addr a on e empno a empno where a state TEXAS D select e ename a street address a city a state a post code from e right outer join addr a where e empno a empno and a state TEXAS 31 检查 SQL Plus 的下列输出 PRODUCT IDPRODUCT NAME BOX LOCATION 578 XWIDGETIDAHO TENNESSEE 456 YWIDGET 下列哪个选项是产生这个结果的查询类型 A 全外连接 全外连接 B 左外连接 C 右外连接 D 等连接 32 要查询 PROFITS 表存储公司不同地区 产品类型和季度的利润信息 下列哪个 SQL 语句显示不 同地区 产品类型和季度的利润的交叉表输出 A select region product type time sum profit from profits group by region prod type time B select region product 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 group by cube region prod type time 33 对数据库运行下列哪个 group by 查询时不会从 Oracle 产生错误 A 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 Java 教学网整理提供 5 34 检查下列 SQL 的输出 SQL select a deptno a job b loc sum a sal 2 from dmp a dept b 3 where a deptno b depton 4 group by a deptno a job b loc 5 order by sum a sal 这个查询按哪个列的顺序返回输出 A A DEPTON B A JOB C B LOC D SUM A SAL 35 要查询的 PROFITS 表存储公司不同地区 产品类型和季度的利润信息 下列哪个 SQL 语句按不 同地区 产品类型和季度求出平均利润大于 100000 美元的利润 A select region prod type period avg profits from profits where avg prodit 100000 group by region prod type period B select region prod type period avg profits from profits where avg prodit 100000 order by region prod type period C select region prod type period avg profits from profits group by region prod type period having avg prodit 100000 D select region prod type period avg profits from profits group by region prod type period having avg prodit 100000 36 公司的员工费用应用程序有两表 一个是 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 e empno e ename from emp e 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 ename 2 from emp 3 where empno in 4 select empno 5 from expense 6 where vouch amt 10000 下列哪个 SQL 语句产生与上面相同的输出 改写成使用运算符 A select e ename from emp e where exists select x empno from expense x where x vouch amt 10000 and x empno e empno B select e ename from emp e where exists select x empno from expense x where x vouch amt 10000 and x empno e empno C select e ename from emp e where x empno e empno and exists select x empno from expense x where x vouch amt 10000 D select e ename from emp e expense x where x empno e empno and x vouch amt 10000 and exists select x empno from expense x where 38 用下列代码块回答问题 SQL select deptno job avg sal 2 from emp 3 group by deptno job 4 having avg sal 5 select sal 6 from emp 7 where ename MARTIN 上述语句使用下面哪种子查询 A 单行子查询 单行子查询 B 多行子查询 C from 子句子查询 D 多列子查询 39 公司销售数据库有两个表 PROFITS 存储不同地区不同季度的产品销售利润 REGIONS 存储每 个部门地区名称 该地区总部地址和该地区副总裁姓名 下列哪个查询取得 SMITHERS FUJIMORI 与 LIKKARAJU 领导的地区的玩具销售利润 Java 教学网整理提供 6 A select sum profit from profits where region in select region froms where reg head in SMITHERS FUJMORI LAKKARAJU and product TOYS 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 froms where reg head in SMITHERS FUJMORI LAKKARAJU and product TOYS D select sum profit from profits where region in select region froms where reg head in SMITHERS FUJMORI LAKKARAJU and product TOYS 40 下列代码块显示的查询包含一个子查询 SQL select dname avg sal as dept avg 2 from emp dept 3 where emp deptno dept deptno 4 group by dname having avg sal 5 select avg sal 1 4 6 from emp dept 7 where emp deptno dept deptno 8 order by avg sal 可以用下列哪个子句重新定义这个查询 删除子查询与主查询中组函数执行的重复 A group by B order by C with D having 41 用下列代码块回答问题 SQL select e deptno e ename e job e sal 2 from emp e 3 where e sal 4 select max e2 sal 5 fromemp e2 6 where nvl e deptno 99 nvl de deptno 99 DEPTNOENAMEJOBSAL 30BLAKEMANAGER2850 10CLARKMANAGER2450 20SCOTTANALYST3000 KINGPRESIDENT5000 20FORDANALYST3000 要在上述返回集的 DEPTNO 列中显示 99 可以用下列哪个 SQL 语句 A select nvl e deptno 99 e ename e sal from emp e 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 emp e2 where nvl e dept 99 nvl e2 deptno 99 C select nvl e deptno 99 e ename e sal from emp e where e deptno e sal select e2 deptno max e2 sal from emp e2 where nvl e dept 99 nvl e2 deptno 99 D select nvl e deptno 99 e ename e sal from emp e where e deptno e sal select e2 deptno max e2 sal from emp e2 where nvl e dept 99 nvl e2 deptno 99 group by e1 deptno 42 公司销售数据库包含一个 PROFITS 表 按产品名 销售地区和季度列出利润信息 如果要取得 公司五个最畅销产品清单 可以用下列哪个 SQL 语句 A select p prod name p profit from select prod name profit from profits order by profit desc where rownum 5 B select p prod name p profit from select prod name sum profit from profits group by prod name order by sum profit desc subq where p prod name subq prod name C select p prod name p profit from select prod name sum profit from profits group by prod name order by sum profit desc where rownum 5 D select p prod name p profit from select prod name sum profit from profits order by sum profit desc where rownum select profit from from profits where prod type TOY and time period D accept v period select profit from from profits where prod type TOY and time period 44 检查下列代码段中的脚本 dates sql accept v hiredate prompt enter hire date select empno ename job from emp where trunk hiredate trinc 为了使脚本正确工作 要改变哪个方面 A 变量 变量 v hiredate 应变成接受应变成接受 DATE 信息 信息 B 查询中的 trunk 函数应删除 C accept 命令中的 prompt 子句是多余的 D 这个脚本很好 45 Oracle 中要生成数据库表 下列哪个选项是无效表生成的语句 A create table cats c name varchar2 10 c weight number 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 46 试图在 Oracle 生成表时遇到下列错误 ORA 00955 name is already used by existing object 下列 哪个选项无法纠正这个错误 A 以不同的用户身份生成对象 B 删除现有同名对象 C 改变生成对象中的列名 改变生成对象中的列名 D 更名现有同名对象 47 SALES 表中的 PROFITS 列声明为 NUMBER 10 2 下列哪个值无法在这个列中存储 A 5392845 324 B 871039453 1 C 75439289 34 D 60079829 25 48 员工 KING 于 1981 年 11 月 17 日聘用 你对 Oracle 数据库发出下列查询 select vsize hiredate from emp where ename KING 下列哪个选项是返回的值 A 4 B 7 C 9 D 17 49 SALES 表中将 PRODUCT NAME 列定义为 CHAR 40 后面要在表中增加一行 PRODUCT NAME 值为 CAT TOYS 然后发出下列命令 select vsize product name from sales 下列哪个选项是返回的值 A 8 B 12 C 40 D 4000 50 JOB 表有三个列 JOB NAME JOB DESC 和 JOB WAGE 用下列命令在 JOB DESC 表中插入 新行 SQL insert into job job name job desc 2 values LUCKEY MAKES COFFEE 之后查询这个表时得到的结果 SQL select from job where job name LUCKEY JOB NAMEJOB DESCJOB WAGE LUCKEYMAKES COFFEE 35 数据是如何填信 JOB WAGE 表的 A JOB 表中的 LACKEY 行已经存在 JOB WAGE 设置为 35 B 生成表时 生成表时 JOB WAGE 列定义的列定义的 default 子句指定插入行时的值 子句指定插入行时的值 C insert 语句的 values 子句包含隐藏值 在插入行时加入 D 惟一理由是对 JOB 表发出的后一个 update 语句增加了 JOB WAGE 值 51 要把非 NULL NUMBER 10 列变成 NUMBER 6 列 发出适当 alter table 命令之后必须完成下列 哪些步骤 A 将列记录复制到临时存储地址 B 将所有行的 NUMBER 列设置为 NULL C 对 NUMBER 数据生成临时地址 D 将列记录从临时地址复制加主表中 将列记录从临时地址复制加主表中 52 发出下列语句 alter table sales drop columm profit 何时从 Oracle 中实际删除列 A 执行语句后立即删除 执行语句后立即删除 B 发出 alter table drop unused columns 命令之后 C 发出 alter table set unused columns 命令之后 D 发出 alter table modify 命令之后 53 你要把非 NULL VARCHAR2 5 列增加到 VARCHAR2 10 执行适当 alter table 命令之后必须完 成下列哪些步骤 A 将所有行的 VARCHAR2 列设置为 NULL B 对 VARCHAR2 数据生成临时地址 C 将列记录从临时地址复制回主表中 D 不用 这个语句自动执行 不用 这个语句自动执行 54 要把 SALES 表中的 PRODUCT TYPE 列的大小从 VARCHAR 5 列增加到 VARCHAR2 10 Java 教学网整理提供 8 用下列哪个语句 A 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 55 删除 Oracle 数据库中父 子关系中的父表 在删除父表时下列哪个对象不会删除 A 相关约束 B 子列 子列 C 相关触发器 D 相关索引 56 数据库中的中的 PROFITS 表中 PRODUCT NAME 与 SALE PERIOD 列建立主键 下列哪个语 句无法定义这个主键 A create table profits product 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 p

温馨提示

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

评论

0/150

提交评论