0
我見過的來源說,如簡單定義:查詢還是子查詢?
SELECT first_name, last_name, subject
FROM student_details
WHERE games NOT IN ('Cricket', 'Football');
的SQL語句是一個子查詢的例子,但是它不是一個簡單的查詢?我的印象是,子查詢需要第二次調用SELECT,這是正確的嗎?
我見過的來源說,如簡單定義:查詢還是子查詢?
SELECT first_name, last_name, subject
FROM student_details
WHERE games NOT IN ('Cricket', 'Football');
的SQL語句是一個子查詢的例子,但是它不是一個簡單的查詢?我的印象是,子查詢需要第二次調用SELECT,這是正確的嗎?
子查詢是查詢中的查詢 - 您的示例只是查詢。
您的消息來源http://beginner-sql-tutorial.com/sql-subquery.htm在某些方面不正確,我想。
這是一個包含一個子查詢的查詢: -
USE AdventureWorks2008R2;
GO
SELECT Ord.SalesOrderID, Ord.OrderDate,
(SELECT MAX(OrdDet.UnitPrice)
FROM AdventureWorks.Sales.SalesOrderDetail AS OrdDet
WHERE Ord.SalesOrderID = OrdDet.SalesOrderID) AS MaxUnitPrice
FROM AdventureWorks2008R2.Sales.SalesOrderHeader AS Ord
本聲明包含一個子查詢:
Select First_Name, Last_Name, Subject
From Student_Details
Where GameID not in (Select GameID from Games where RequiresHelmet = 1)
你的沒有。
'('Cricket','Football')'不是子查詢。子查詢的例子'SELECT * FROM tableName WHERE xxx NOT IN(SELECT x FROM table)'' – 2013-05-12 13:44:41