-----------------------------------------------------------------------------
/*
SQL Server در Execution Plan آشنایی با مفهوم  
Site:        http://www.NikAmooz.com
Instagram:   https://instagram.com/nikamooz/
Telegram:	 https://telegram.me/nikamooz
Created By:  Iman Bagheri
*/
-----------------------------------------------------------------------------
 
 --Execution Plan بررسی مقدماتی 
USE AdventureWorks2019
GO
SELECT 
	SalesPersonID, YEAR(orderdate) AS OrderYear,
	COUNT(*) AS NumOrders 
FROM Sales.SalesOrderHeader 
WHERE 
	CustomerID = 29994 
GROUP BY 
	SalesPersonID, YEAR(OrderDate) 
HAVING 
	COUNT(*) > 1 
ORDER BY 
	OrderYear DESC 
GO
--------------------------------------------------------------------
/*
بررسی اجزای یک پلن
*/
SELECT 
	*
FROM Sales.SalesOrderHeader H 
INNER JOIN Sales.SalesOrderDetail D ON H.SalesOrderID=D.SalesOrderID
GO