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標識符無效