1Z0-007 考试题
问题: 哪四个子句可以使用子查询? (选择四项。)
A. INSERT 语句的 INTO 子句中
B. SELECT 语句的 FROM 子句中
C. SELECT 语句的 GROUP BY 子句中
D. SELECT 语句的 WHERE 子句
中 E. UPDATE 语句的 SET 子句
F. INSERT 语句的 VALUES 子句中
答案:B、D、E、F
但我认为正确的答案如下:A、B、D、 E 但不是 F。不是这样吗???
Question:
In which four clauses can a subquery be used? (Choose four.)
A. in the INTO clause of an INSERT statement
B. in the FROM clause of a SELECT statement
C. in the GROUP BY clause of a SELECT statement
D. in the WHERE clause of a SELECT statement
E. in the SET clause of an UPDATE statement
F. in the VALUES clause of an INSERT statement
Answer: B, D, E, F
But I think right answers are the following: A, B, D, E BUT NOT F. Is not it so???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不,B、D、E、F 听起来是正确的。
为什么你认为 A 应该有效? INTO 正在指定目标行集,该目标行集不能是子查询。在 F 中,您可以使用返回标量值的子查询。
No, B, D, E, F sounds correct.
Why do you thik A should be valid? The INTO is designating a target rowset, which cannot be a subquery. And in F you can use subqueries which return a scalar value just fine.
首先,我们必须承认子查询返回一组值元组(行):
{(value_1_A, value_1_B, ...), (value_2_A, value_2_B, ...), ...}
A -
INTO
子句需要一个表名,而不是一组值,因此您不能使用子查询。请注意,这与 B 不同,因为您可以查询匿名表(子查询返回的一组行),但是将值插入匿名表中是没有意义的,因为匿名表不会被使用。F -
INSERT
语句的 VALUES 子句期望的正是我所说的子查询返回的一组值。正确答案是B、D、E和F。
以下是有关子查询的更多信息: http://www.techonthenet.com/oracle/subqueries.php< /a>
First of all we must acknowledge that a subquery returns a set of value tuples (rows):
{(value_1_A, value_1_B, ...), (value_2_A, value_2_B, ...), ...}
A - The
INTO
clause expects a table name, not a set of values so you may not use a subquery. Note that this is not similar to B because you are allowed to query an anonymous table (a set of rows returned by a subquery), but it makes no sense to insert values into an anonymous table that will not be used.F - The VALUES clause of the
INSERT
statement expects exactly what I said a subquery returns, a set of values.The right answer will be B, D, E and F.
Here's some more info on subqueries: http://www.techonthenet.com/oracle/subqueries.php
抢夺! ...我发现了一些非常重要的东西,这证明了我的断言...
其他DML语句中的子查询
子查询可以在DML语句中使用,例如INSERT、UPDATE 、删除
和合并。以下是 DML
语句中子查询的一些示例。
将所有员工的工资更新为
相应部门的最高工资(相关子查询):
删除工资低于部门平均工资的员工记录
(使用相关子查询):
使用以下命令向表中插入记录 :子查询:
在 INSERT 语句的 VALUES 子句中指定子查询:
您还可以在 INSERT、UPDATE 和 DELETE 语句中使用子查询来代替表名。下面是一个示例:
已创建 1 行。
Loot at! ...I found something very important,which proves my assertion...
Subqueries in Other DML Statements
Subqueries can be used in DML statements such as INSERT, UPDATE, DELETE,
and MERGE. Following are some examples of subqueries in DML
statements.
To update the salary of all employees to the maximum salary in the
corresponding department (correlated subquery):
To delete the records of employees whose salary is below the average
salary in the department (using a correlated subquery):
To insert records to a table using a subquery:
To specify a subquery in the VALUES clause of the INSERT statement:
You can also have a subquery in the INSERT, UPDATE, and DELETE statements in place of the table name. Here is an example:
1 row created.
子查询可以用在 INSERT 语句的 INTO 子句中。所以A也是正确答案。
以下查询有效:
Subquery can be used in the INTO clause of an INSERT statement. So A also correct answer.
The below query works: