OCP-1Z0-051 第164题 UPDATE语句中使用子查询
来源:互联网 发布:淘宝3d虚拟试穿衣服 编辑:程序博客网 时间:2024/06/05 21:10
一、原题
二、题目翻译
三、题目解析
View the Exhibit and examine the structure of CUSTOMERS and SALES tables.
Evaluate the following SQL statement:
UPDATE (SELECT prod_id, cust_id, quantity_sold, time_id FROM sales)
SET time_id = '22-MAR-2007'
WHERE cust_id = (SELECT cust_id
FROM customers
WHERE cust_last_name = 'Roberts'
AND credit_limit = 600);
Which statement is true regarding the execution of the above UPDATE statement?
A. It would not execute because two tables cannot be used in a single UPDATE statement.
B. It would not execute because the SELECT statement cannot be used in place of the table name.
C. It would execute and restrict modifications to only the columns specified in the SELECT statement.
D. It would not execute because a subquery cannot be used in the WHERE clause of an UPDATE statement.
答案:C
Evaluate the following SQL statement:
UPDATE (SELECT prod_id, cust_id, quantity_sold, time_id FROM sales)
SET time_id = '22-MAR-2007'
WHERE cust_id = (SELECT cust_id
FROM customers
WHERE cust_last_name = 'Roberts'
AND credit_limit = 600);
Which statement is true regarding the execution of the above UPDATE statement?
A. It would not execute because two tables cannot be used in a single UPDATE statement.
B. It would not execute because the SELECT statement cannot be used in place of the table name.
C. It would execute and restrict modifications to only the columns specified in the SELECT statement.
D. It would not execute because a subquery cannot be used in the WHERE clause of an UPDATE statement.
答案:C
二、题目翻译
看下面的CUSTOMERS and SALES表的结构,
评估下面的SQL语句:
关于执行上面的UPDATE语句哪句话是正确的?
A.执行失败,因为两个表不能用于一个UPDATE语句。
B.执行失败,因为SELECT语句不能用于代替表名。
C.执行成功,并限制只能修改SELECT语句指定的列。
D.失败失败,因为子查询不能用于UPDATE的WHERE子句中。
评估下面的SQL语句:
关于执行上面的UPDATE语句哪句话是正确的?
A.执行失败,因为两个表不能用于一个UPDATE语句。
B.执行失败,因为SELECT语句不能用于代替表名。
C.执行成功,并限制只能修改SELECT语句指定的列。
D.失败失败,因为子查询不能用于UPDATE的WHERE子句中。
三、题目解析
UPDATE后面的SELECT语句相当于一个简单视图,也就是对这个视图进行修改,所以,只能修改select后面的的列。
0 0
- OCP-1Z0-051 第164题 UPDATE语句中使用子查询
- OCP-1Z0-051 第159题 insert语句中使用子查询
- OCP-1Z0-051 第165题 使用子查询update多列数据
- OCP-1Z0-051 第166题 使用子查询update表中的多列
- OCP-1Z0-051 第140题 子查询中使用GROUP BY注意事项
- OCP-1Z0-051 第160题 insert中使用子查询
- OCP-1Z0-051 第135题 子查询注意事项
- OCP-1Z0-051 第145题 子查询嵌套
- OCP-1Z0-051 第143题 子查询中ANY、ALL的应用
- OCP-1Z0-051 第149题 子查询中ALL的应用
- OCP-1Z0-051 第136题 子查询的使用
- OCP-1Z0-051 第148题 子查询和ANY,ALL的使用
- OCP-1Z0-051 第168题 使用子查询DELETE数据
- OCP-1Z0-051 第169题 使用子查询DELETE数据
- OCP-1Z0-051 补充题库 第8题 子查询的使用范围
- OCP-1Z0-051 第158题 select... for update语句注意事项
- OCP-1Z0-051 第8题 子查询和多表关联查询和情况
- OCP-1Z0-051 补充题库 第5题 主查询和子查询的注意事项
- linux 下线程的简单gdb调试方法
- c:foreach遍历和s:iterator遍历对比
- javascript有个特殊的对象ActiveXObject,通过它可以访问windows的本地文件系统和应用程序
- SVN在windows下安装和MyEclipse的svn插件安装
- 使用SQL Profile及SQL Tuning Advisor固定执行计划
- OCP-1Z0-051 第164题 UPDATE语句中使用子查询
- C#启动项
- JAVA虚拟机体系结构
- SQL Server中DML语句要申请的锁
- 工厂方法模式 实现计算器
- PAT A 1068. Find More Coins (30)
- rails4 5.11 Updating Articles
- 连接失败重连时间间隔可变
- CentOS6.4可以读写ntfs磁盘设备的方法