马哈鱼数据流链介绍
如果在上层语句的from子句中使用子查询或CTE的结果集,则下层结果集的影响将转移到上层。
WITH
cteReports (EmpID, FirstName, LastName, MgrID, EmpLevel)
AS
(
SELECT EmployeeID, FirstName, LastName, ManagerID, EmpLevel -- resultset1
FROM Employees
WHERE ManagerID IS NULL
)
SELECT
count(EmpID), sum(EmpLevel) -- resultset2
FROM cteReports
Employees.ManagerID -> indirect -> RS-1.RelationRows
由于在上层语句的from子句中使用了cteReports,因此影响将如下所示:
Employees.ManagerID -> indirect -> RS-1.RelationRows -> indirect -> CTE-CTEREPORTS.RelataionRows
如果忽略中间结果集,则端到端数据流为:
Employees.ManagerID -> indirect -> RS-2.COUNT(EmpID)
Employees.ManagerID -> indirect -> RS-2.SUM(EmpLevel)
数据库图示:
4、参考
马哈鱼数据血缘分析器:
马哈鱼数据血缘分析器中文网站: