ocp标量子查询

转载自https://www.cnblogs.com/liang-ning/p/12123043.html

Scalar Subquery Expressions

A scalar subquery expression is a subquery that returns exactly one column value from one row. The value of the scalar subquery expression is the value of the select list item of the subquery. If the subquery returns 0 rows, then the value of the scalar subquery expression is NULL. If the subquery returns more than one row, then Oracle returns an error.
标量子查询表达式是一种从一行只返回一个列值的子查询。标量子查询表达式的值就是子查询的选择列表项的值。如果子查询返回0行,则标量子查询表达式的值为NULL。如果子查询返回多于一行,Oracle将返回一个错误。

You can use a scalar subquery expression in most syntax that calls for an expression (expr). In all cases, a scalar subquery must be enclosed in its own parentheses, even if its syntactic location already positions it within parentheses (for example, when the scalar subquery is used as the argument to a built-in function).
在大多数调用表达式(expr)的语法中,都可以使用标量子查询表达式。在任何情况下,标量子查询都必须用自己的圆括号括起来,即使它的语法位置已经把它放在圆括号中(例如,当标量子查询用作内置函数的参数时)

Scalar subqueries are not valid expressions in the following places:
标量子查询在以下位置不是有效的表达式:

(1)As default values for columns
作为列的默认值

(2)As hash expressions for clusters
作为集群的散列表达式

(3)In the RETURNING clause of DML statements
在DML语句的返回子句中

(4)As the basis of a function-based index
作为基于函数的索引的基础

(5)In CHECK constraints
在检查约束

(6)In GROUP BY clauses
按group by 子句

(7)In statements that are unrelated to queries, such as CREATE PROFILE
在与查询无关的语句中,如CREATE PROFILE

关于scalar subquery expressions的ocp考题:

14、Which three are true about scalar subquery expressions?

A.A scalar subquery expression that returns zero rows evaluates to zero

B.They cannot be used in the values clause of an insert statement *

C.They can be nested.

D.A scalar subquery expression that returns zero rows evaluates to null.

E.They cannot be used in group by clauses.

F.They can be used as default values for columns in a create table statement.

Answer:B D E

20、Which two are true about scalar subquery expressions?

A.You cannot correlate them with a table in the parent statement

B.You can use them as a default value for a column.

C…You must enclose them in parentheses.

D.They can return at most one row.

E.They can return two columns.

Answer: C D

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值