Grouping & Aggregation (GroupBy)

Demonstrates GROUP BY with aggregate functions - executed on database side.

Execution Time

36 ms

Server-side aggregation

Categories Analyzed

10

Groups returned

Home & Garden

Products

3848

Total Stock

956,783


Average Price
$516.98
Price Range
$10.40 - $1,009.84
Average Rating
2.57

Toys & Games

Products

3800

Total Stock

956,814


Average Price
$509.97
Price Range
$10.08 - $1,009.93
Average Rating
2.56

Clothing

Products

3772

Total Stock

942,544


Average Price
$501.05
Price Range
$10.43 - $1,009.23
Average Rating
2.54

Sports & Outdoors

Products

3764

Total Stock

946,521


Average Price
$510.12
Price Range
$10.04 - $1,009.92
Average Rating
2.56

Electronics

Products

3762

Total Stock

943,438


Average Price
$510.01
Price Range
$10.33 - $1,009.87
Average Rating
2.57

Books

Products

3752

Total Stock

961,735


Average Price
$506.11
Price Range
$10.24 - $1,009.99
Average Rating
2.57

Health & Beauty

Products

451

Total Stock

114,846


Average Price
$492.86
Price Range
$13.19 - $996.94
Average Rating
3.09

Automotive

Products

444

Total Stock

112,495


Average Price
$496.87
Price Range
$11.08 - $999.12
Average Rating
2.93

Office Supplies

Products

435

Total Stock

107,702


Average Price
$507.27
Price Range
$12.03 - $999.35
Average Rating
2.92

Food & Grocery

Products

413

Total Stock

94,835


Average Price
$517.55
Price Range
$11.07 - $997.32
Average Rating
2.93

Detailed Statistics

Category Products Avg Price Min Price Max Price Total Stock Avg Rating
Home & Garden 3848 $516.98 $10.40 $1,009.84 956,783 2.57 ⭐
Toys & Games 3800 $509.97 $10.08 $1,009.93 956,814 2.56 ⭐
Clothing 3772 $501.05 $10.43 $1,009.23 942,544 2.54 ⭐
Sports & Outdoors 3764 $510.12 $10.04 $1,009.92 946,521 2.56 ⭐
Electronics 3762 $510.01 $10.33 $1,009.87 943,438 2.57 ⭐
Books 3752 $506.11 $10.24 $1,009.99 961,735 2.57 ⭐
Health & Beauty 451 $492.86 $13.19 $996.94 114,846 3.09 ⭐
Automotive 444 $496.87 $11.08 $999.12 112,495 2.93 ⭐
Office Supplies 435 $507.27 $12.03 $999.35 107,702 2.92 ⭐
Food & Grocery 413 $517.55 $11.07 $997.32 94,835 2.93 ⭐
TOTAL 24441 $506.88 $10.04 $1,009.99 6,137,713 2.73 ⭐
Query Explanation

This query uses GroupBy(p => p.Category) to group products by category, then applies aggregate functions like Count(), Average(), Min(), Max(), and Sum(). All aggregation is performed on the SQL Server side, making it extremely efficient even with large datasets.