百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术教程 > 正文

Oracle Database 12c SQL OCA/OCP 1Z0-071题库(11-15题)

mhr18 2024-09-23 09:43 15 浏览 0 评论

QUESTION 11

You issue the following command to drop the PRODUCTS table:

SQL > DROP TABLE products;

Which three statements are true about the implication of this command? (Choose three.)

A. All data along with the table structure is deleted.

B. A pending transaction in the session is committed.

C. All indexes on the table remain but they are invalidated.

D. All views and synonyms on the table remain but they are invalidated.

E. All data in the table is deleted but the table structure remains.

答案:ABD

解析:DROP table 注意点:

  1. 删除数据以及表结构,作为DDL不可回滚,但是可以恢复(DROP table Purge 不可恢复);
  2. 有约束限制,可增加CASCADE CINSTRAINTS;
  3. 索引被删除;
  4. 视图和别名保留,但是无效。

QUESTION 12

You execute the following commands:

SQL > DEFINE hiredate = '01-APR-2011';

  SQL >SELECT 	employee_id, first_name, salary
					FROM	employees
					WHERE hire_date > '&hiredate'
					AND manager_id > &mgr_id;

For which substitution variables are you prompted for the input?

A. none, because no input required

B. both the substitution variables ''hiredate' and 'mgr_id'.

C. only hiredate'

D. only 'mgr_id'

答案:D

解析:&符号替换变量是一项SQL*PLus功能,注意点:

  1. 使用 DEFINE 语句给替换变量的赋值, 可用UNDEFINE 语句取消赋值;
  2. SET VARIFY /SET DEFINE来改变系统的默认值,这两个参数的默认值是 ON和&

QUESTION 13

View the Exhibit and examine the structure of ORDERS and ORDER_ITEMS tables.

ORDER_ID is the primary key in the ORDERS table. It is also the foreign key in the ORDER_ITEMS table wherein it is created with the ON DELETE CASCADE option.

Which DELETE statement would execute successfully?

A. DELETE orders o, order_items i
    WHERE o.order_id = i.order_id;
B. DELETE
    FROM orders
    WHERE (SELECT order_id
    FROM order_items);
C. DELETE orders
    WHERE order_total < 1000;
D. DELETE order_id
    FROM orders
    WHERE order_total < 1000;

答案:C

解析:DELETE语句用来从数据库的表中删除行,注意点:

  1. DELETE FROM table 中的FROM为可选字;
  2. WHERE子句 为可选字,如省略,则删除所有行。

QUESTION 14

Using the CUSTOMERS table, you need to generate a report that shows an increase in the credit limit by 15% for all customers. Customers whose credit limit has not been entered should have the message "Not Available" displayed.

Which SQL statement would produce the required result?

A. SELECT NVL (TO CHAR(cust_credit_limit * .15), 'Not Available') "NEW CREDIT"

FROM customers;
B. SELECT TO_CHAR (NVL(cust_credit_limit * .15), 'Not Available') "NEW CREDIT"

FROM customers;
C. SELECT NVL(cust_credit_limit * .15), 'Not Available') "NEW CREDIT"

FROM customers;
D. SELECT NVL(cust_credit_limit), 'Not Available') "NEW CREDIT"

FROM customers;

答案:A

解析:NVL函数注意点:

  1. NVL(exp1,exp2):如果exp1为NULL,则返回exp2,如果exp1非空,则返回原值exp1;
  2. NVL2(exp1,expr2,exp3):如果exp1为NULL,则返回exp3,如果exp1非空,则返回exp2。

QUESTION 15

View the exhibit and examine the structures of the EMPLOYEES and DEPARTMENTS tables.

Name                          NULL?                 Type

------------------              --------------         ----------------
EMPLOYEE_ID              NOT NULL           NUMBER(6)
FIRST_NAME                                           VARCHAR(20)
LAST_NAME                NOT NULL           VARCHAR(25)
HIRE_DATA                  NOT NULL           DATE          
JOB_ID                         NOT NULL            VARCHAR2(10)
SALARY                                                    NUMBER(10,2)
COMMISSION                                         NUMBER(6,2)
MANAGER_ID                                         NUMBER(6)
DEPARTMENT_ID                                   NUMBER(4)

You want to update EMPLOYEES table as follows:

  • Update only those employees who work in Boston or Seattle (locations 2900 and 2700).
  • Set department_id for these employees to the department_id corresponding to London (location_id 2100).
  • Set the employees' salary in location_id 2100 to 1.1 times the average salary of their department.
  • Set the employees' commission in location_id 2100 to 1.5 times the average commission of their department.

You issue the following command:

SQL > UPDATE  employees
									SET   department_id  =
                          (SELECT department_id
                               FROM departments
                               WHERE location_id =2100),
                          (salary,commission) =
                          (SELECT 1.1*AVG(salary),1.5*AVG(commission))
          									FROM employees ,departments
                            WHERE departments.location_id IN (2900,2700,2100))
                  WHERE department_ID IN
                               (SELECT department_id 
                                  FROM departments 
            										WHERE location_id =2900
            																	or location_id =2700)

What is outcome?

A. It generates an error because multiple columns (SALARY, COMMISSION) cannot be specified together in an UPDATE statement.

B. It generates an error because a subquery cannot have a join condition in a UPDATE statement.

C. It executes successfully and gives the desired update

D. It executes successfully but does not give the desired update

答案:D

解析:WHERE子句有问题,WHERE departments.location_id IN (2900,2700,2100)。


后续陆续更新,转载请注明出处。

本人水平有限,欢迎指正

相关推荐

使用 Docker 部署 Java 项目(通俗易懂)

前言:搜索镜像的网站(推荐):DockerDocs1、下载与配置Docker1.1docker下载(这里使用的是Ubuntu,Centos命令可能有不同)以下命令,默认不是root用户操作,...

Spring Boot 3.3.5 + CRaC:从冷启动到秒级响应的架构实践与踩坑实录

去年,我们团队负责的电商订单系统因扩容需求需在10分钟内启动200个Pod实例。当运维组按下扩容按钮时,传统SpringBoot应用的冷启动耗时(平均8.7秒)直接导致流量洪峰期出现30%的请求超时...

《github精选系列》——SpringBoot 全家桶

1简单总结1SpringBoot全家桶简介2项目简介3子项目列表4环境5运行6后续计划7问题反馈gitee地址:https://gitee.com/yidao620/springbo...

Nacos简介—1.Nacos使用简介

大纲1.Nacos的在服务注册中心+配置中心中的应用2.Nacos2.x最新版本下载与目录结构3.Nacos2.x的数据库存储与日志存储4.Nacos2.x服务端的startup.sh启动脚...

spring-ai ollama小试牛刀

序本文主要展示下spring-aiollama的使用示例pom.xml<dependency><groupId>org.springframework.ai<...

SpringCloud系列——10Spring Cloud Gateway网关

学习目标Gateway是什么?它有什么作用?Gateway中的断言使用Gateway中的过滤器使用Gateway中的路由使用第1章网关1.1网关的概念简单来说,网关就是一个网络连接到另外一个网络的...

Spring Boot 自动装配原理剖析

前言在这瞬息万变的技术领域,比了解技术的使用方法更重要的是了解其原理及应用背景。以往我们使用SpringMVC来构建一个项目需要很多基础操作:添加很多jar,配置web.xml,配置Spr...

疯了!Spring 再官宣惊天大漏洞

Spring官宣高危漏洞大家好,我是栈长。前几天爆出来的Spring漏洞,刚修复完又来?今天愚人节来了,这是和大家开玩笑吗?不是的,我也是猝不及防!这个玩笑也开的太大了!!你之前看到的这个漏洞已...

「架构师必备」基于SpringCloud的SaaS型微服务脚手架

简介基于SpringCloud(Hoxton.SR1)+SpringBoot(2.2.4.RELEASE)的SaaS型微服务脚手架,具备用户管理、资源权限管理、网关统一鉴权、Xss防跨站攻击、...

SpringCloud分布式框架&amp;分布式事务&amp;分布式锁

总结本文承接上一篇SpringCloud分布式框架实践之后,进一步实践分布式事务与分布式锁,其中分布式事务主要是基于Seata的AT模式进行强一致性,基于RocketMQ事务消息进行最终一致性,分布式...

SpringBoot全家桶:23篇博客加23个可运行项目让你对它了如指掌

SpringBoot现在已经成为Java开发领域的一颗璀璨明珠,它本身是包容万象的,可以跟各种技术集成。本项目对目前Web开发中常用的各个技术,通过和SpringBoot的集成,并且对各种技术通...

开发好物推荐12之分布式锁redisson-sb

前言springboot开发现在基本都是分布式环境,分布式环境下分布式锁的使用必不可少,主流分布式锁主要包括数据库锁,redis锁,还有zookepper实现的分布式锁,其中最实用的还是Redis分...

拥抱Kubernetes,再见了Spring Cloud

相信很多开发者在熟悉微服务工作后,才发现:以为用SpringCloud已经成功打造了微服务架构帝国,殊不知引入了k8s后,却和CloudNative的生态发展脱轨。从2013年的...

Zabbix/J监控框架和Spring框架的整合方法

Zabbix/J是一个Java版本的系统监控框架,它可以完美地兼容于Zabbix监控系统,使得开发、运维等技术人员能够对整个业务系统的基础设施、应用软件/中间件和业务逻辑进行全方位的分层监控。Spri...

SpringBoot+JWT+Shiro+Mybatis实现Restful快速开发后端脚手架

作者:lywJee来源:cnblogs.com/lywJ/p/11252064.html一、背景前后端分离已经成为互联网项目开发标准,它会为以后的大型分布式架构打下基础。SpringBoot使编码配置...

取消回复欢迎 发表评论: