Oracle Database 12c SQL OCA/OCP 1Z0-071题库(11-15题)
sinye56 2024-09-16 14:35 4 浏览 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 注意点:
- 删除数据以及表结构,作为DDL不可回滚,但是可以恢复(DROP table Purge 不可恢复);
- 有约束限制,可增加CASCADE CINSTRAINTS;
- 索引被删除;
- 视图和别名保留,但是无效。
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功能,注意点:
- 使用 DEFINE 语句给替换变量的赋值, 可用UNDEFINE 语句取消赋值;
- 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语句用来从数据库的表中删除行,注意点:
- DELETE FROM table 中的FROM为可选字;
- 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函数注意点:
- NVL(exp1,exp2):如果exp1为NULL,则返回exp2,如果exp1非空,则返回原值exp1;
- 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)。
后续陆续更新,转载请注明出处。
本人水平有限,欢迎指正
相关推荐
- Linux在线安装JDK1.8
-
首先在服务器pingwww.baidu.com查看是否可以连网然后就可以在线下载一、下载安装JDK1.81、在下载安装的同时做好一些准备工作...
- Linux安装JDK,超详细
-
1、了解RPMRPM是Red-HatPackageManager(RPM软件包管理器)的缩写,这一文件格式名称虽然打上了RedHat的标志,但是其原始设计理念是开放式的,现在包括OpenLinux...
- Linux安装jdk1.8(超级详细)
-
前言最近刚购买了一台阿里云的服务器准备要搭建一个网站,正好将网站的一个完整搭建过程分享给大家!#一、下载jdk1.8首先我们需要去下载linux版本的jdk1.8安装包,我们有两种方式去下载安装...
- Linux系统安装JDK教程
-
下载jdk-8u151-linux-x64.tar.gz下载地址:https://www.oracle.com/technetwork/java/javase/downloads/index.ht...
- 干货|JDK下载安装与环境变量配置图文教程「超详细」
-
1.JDK介绍1.1什么是JDK?SUN公司提供了一套Java开发环境,简称JDK(JavaDevelopmentKit),它是整个Java的核心,其中包括Java编译器、Java运行工具、Jav...
- Linux下安装jdk1.8
-
一、安装环境操作系统:CentOSLinuxrelease7.6.1810(Core)JDK版本:1.8二、安装步骤1.下载安装包...
- Linux上安装JDK
-
以CentOS为例。检查是否已安装过jdk。yumlist--installed|grepjdk或者...
- Linux系统的一些常用目录以及介绍
-
根目录(/):“/”目录也称为根目录,位于Linux文件系统目录结构的顶层。在很多系统中,“/”目录是系统中的唯一分区。如果还有其他分区,必须挂载到“/”目录下某个位置。整个目录结构呈树形结构,因此也...
- Linux系统目录结构
-
一、系统目录结构几乎所有的计算机操作系统都是使用目录结构组织文件。具体来说就是在一个目录中存放子目录和文件,而在子目录中又会进一步存放子目录和文件,以此类推形成一个树状的文件结构,由于其结构很像一棵树...
- Linux文件查找
-
在Linux下通常find不很常用的,因为速度慢(find是直接查找硬盘),通常我们都是先使用whereis或者是locate来检查,如果真的找不到了,才以find来搜寻。为什么...
- 嵌入式linux基本操作之查找文件
-
对于很多初学者来说都习惯用windows操作系统,对于这个系统来说查找一个文件简直不在话下。而学习嵌入式开发行业之后,发现所用到的是嵌入式Linux操作系统,本想着跟windows类似,结果在操作的时...
- linux系统查看软件安装目录的方法
-
linux系统下怎么查看软件安装的目录?方法1:whereis软件名以查询nginx为例子...
- Linux下如何对目录中的文件进行统计
-
统计目录中的文件数量...
- Linux常见文件目录管理命令
-
touch用于创建空白文件touch文件名称mkdir用于创建空白目录还可以通过参数-p创建递归的目录...
- Linux常用查找文件方法总结
-
一、前言Linux系统提供了多种查找文件的命令,而且每种查找命令都具有其独特的优势,下面详细总结一下常用的几个Linux查找命令。二、which命令查找类型:二进制文件;...
你 发表评论:
欢迎- 一周热门
- 最近发表
- 标签列表
-
- oracle忘记用户名密码 (59)
- oracle11gr2安装教程 (55)
- mybatis调用oracle存储过程 (67)
- oracle spool的用法 (57)
- oracle asm 磁盘管理 (67)
- 前端 设计模式 (64)
- 前端面试vue (56)
- linux格式化 (55)
- linux图形界面 (62)
- linux文件压缩 (75)
- Linux设置权限 (53)
- linux服务器配置 (62)
- mysql安装linux (71)
- linux启动命令 (59)
- 查看linux磁盘 (72)
- linux用户组 (74)
- linux多线程 (70)
- linux设备驱动 (53)
- linux自启动 (59)
- linux网络命令 (55)
- linux传文件 (60)
- linux打包文件 (58)
- linux查看数据库 (61)
- linux获取ip (64)
- 关闭防火墙linux (53)