dbms标识符无效
嵌套查询 (Nested Queries)
A query embedded in a query. This type of relation is termed as Nested Query and the Embedded Query is termed as a subquery.
查询中嵌入的查询。 这种类型的关系称为嵌套查询,而嵌入式查询称为子查询。
For example: To find the names of employee who are department Id 103.
例如:查找部门ID为103的雇员的姓名。
For example:
例如:
SELECT E.ename
FROM Employee E
WHERE E.id IN (SELECTD.id FROM Department D WHERE D.id = 103)
相关嵌套查询 (Correlated Nested Queries)
These types of queries are nested queries which are independent or depend only on the same row of an outer query being an embedded query.
这些类型的查询是嵌套查询,它们独立或仅取决于外部查询的同一行(即嵌入式查询)。
For example: To find the names of employee who are department Id 103.
例如:查找部门ID为103的雇员的姓名。
SELECT E.ename
FROM Employee E
WHERE EXISTS (SELECT *x FROM Department D WHERE D.id = 103 AND D.id = E.id)
集合比较运算符 (Set Comparison Operators)
There are different types of set comparison operators like EXISTS, IN and UNIQUE. SQL also supports op ANY and op ALL, where op means arithmetic comparison operators such as <, <=, =, <>, >=, >. SOME are also one of the set comparison operators but it is similar to ANY.
集合比较运算符有多种类型,例如EXISTS,IN和UNIQUE。 SQL还支持op ANY和op ALL,其中op表示算术比较运算符,例如< , <= , = , <> , > = , > 。 SOME也是集合比较运算符之一,但它与ANY相似。
For example: Find Employees whose salary is greater than an employee named Shivam.
例如:查找薪水高于名为Shivam的雇员的雇员。
SELECT E.id
FROM Employee E
WHERE E.salary>ANY (SELECTE2.salary FROM Employee E2 WHERE E2.ename = 'Shivam')
翻译自: https://www.includehelp.com/dbms/nested-queries-correlated-nested-queries-and-set-comparison-operators-in-dbms.aspx
dbms标识符无效