शुरू करेंमुफ़्त में शुरू करें

CUBE के साथ सभी aggregations देखें

CUBE ऑपरेटर सभी संयोजनों की cross aggregation देता है और इससे पंक्तियों की संख्या बहुत बड़ी हो सकती है। यह ऑपरेटर non-hierarchical डेटा के साथ सबसे अच्छा काम करता है, जहाँ आप स्वतंत्र aggregations के साथ-साथ संयुक्त aggregations में भी रुचि रखते हैं.

इस परिदृश्य में, हम IncidentRollup टेबल में सुरक्षा घटनाओं (security incidents) की कुल संख्या ढूँढ़ना चाहते हैं, लेकिन किसी सही hierarchy का पालन नहीं करेंगे। इसकी बजाय, हम कई असंबद्ध attributes को aggregate करने पर ध्यान देंगे.

यह अभ्यास पाठ्यक्रम का हिस्सा है

SQL Server में Time Series Analysis

पाठ्यक्रम देखें

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

SELECT
	-- Use the ORDER BY clause as a guide for these columns
    -- Don't forget that comma after the third column if you
    -- copy from the ORDER BY clause!
	ir.___,
	c.___,
	c.___,
	SUM(ir.NumberOfIncidents) AS NumberOfIncidents
FROM dbo.IncidentRollup ir
	INNER JOIN dbo.Calendar c
		ON ir.IncidentDate = c.Date
WHERE
	ir.IncidentTypeID IN (3, 4)
GROUP BY
	-- GROUP BY should include all non-aggregated columns
	ir.___,
	c.___,
	c.___
-- Fill in your grouping operator
WITH ___
ORDER BY
	ir.IncidentTypeID,
	c.CalendarQuarterName,
	c.WeekOfMonth;
कोड संपादित करें और चलाएँ