138. Which statement is true regarding subqueries?
A. The LIKE operator cannot be used with single- row subqueries.
B. The NOT IN operator is equivalent to IS NULL with single- row subqueries.
C. =ANY and =ALL operators have the same functionality in multiple- row subqueries.
D. The NOT operator can be used with IN, ANY, and ALL operators in multiple- row subqueries.
Answer: D答案解析:
A,LIKE操作符不能用在单行子查询中,错误,LIKE可以用于单行函数
B,NOT IN操作符相当于单选子查询的IS NULL,次两个不等价,NOT IN运算符等同于<> ALL,
C,多行子查询中的=ANY and =ALL操作符具有相同的功能,=ANY是等于任意一个,=ALL是等于所有
D,NOT操作可以用在多行子查询中的IN,ANY和ALL操作符上。
其实就是把NOT放到整个表达式之前:
WHERE NOT col IN (SELECT ...) (也可以是WHERE col not IN (SELECT ...))
WHERE NOT col = ANY (SELECT ...) (大于、小于都可以)
WHERE NOT col = ALL (SELECT ...) (大于、小于都可以)