Sign in

Tracks/Aggregates

Aggregates

GROUP BY, HAVING, and summary functions.

Start this track
aggregate
COUNT
SUM
AVG
MIN
MAX
GROUP BY
HAVING
conditional aggregation

0/150 solved

  1. 1—004. Count Employees
    easy
  2. 2—010. Total Salary Budget
    easy
  3. 3—011. Average Product Price
    easy
  4. 4—012. Most Expensive Product
    easy
  5. 5—013. Cheapest Product
    easy
  6. 6—014. Customer Count by Country
    easy
  7. 7—024. Total Orders per Customer
    easy
  8. 8—025. Count Unique Product Categories
    easy
  9. 9—030. Monthly Order Count
    easy
  10. 10—129. Total Amount Spent per Customer
    easy
  11. 11—130. Average Rating per Product
    easy
  12. 12—131. Most Recent Hire Date per Department
    easy
  13. 13—132. First Product Name Alphabetically per Category
    easy
  14. 14—133. COUNT(*) vs COUNT(column)
    easy
  15. 15—134. Count Distinct Customers
    easy
  16. 16—149. Count Orders by Status
    easy
  17. 17—150. Total Revenue by Department and Quarter
    easy
  18. 18—151. Customers Who Spent More Than $500
    easy
  19. 19—152. Products Ordered by More Than 2 Customers
    easy
  20. 20—153. Group Orders by Month Using DATE_TRUNC
    easy
  21. 21—160. Find Employees Earning Above Average Salary
    easy
  22. 22—302. Count Orders by Status
    easy
  23. 23—309. Total Revenue per Product
    easy
  24. 24—312. Count Products per Category
    easy
  25. 25—313. Find the Highest and Lowest Salary
    easy
  26. 26—318. Count Orders Grouped by Year and Month
    easy
  27. 27—320. Count NULL Values in a Column
    easy
  28. 28—325. All Departments Including Those with No Employees
    easy
  29. 29—328. High-Volume, High-Value Customers (HAVING with AND)
    easy
  30. 30—031. Average Salary by Department
    medium
  31. 31—033. Daily Running Revenue
    medium
  32. 32—034. Departments with 3 or More Employees
    medium
  33. 33—038. Employees Earning Above Their Department Average
    medium
  34. 34—041. Top-Earning Departments (CTE)
    medium
  35. 35—050. Order Count by Status (Conditional Aggregation)
    medium
  36. 36—052. Find Duplicate Customer Emails
    medium
  37. 37—053. Revenue Share per Category
    medium
  38. 38—058. Monthly New Customer Signups
    medium
  39. 39—060. Employees Sharing the Same Salary
    medium
  40. 40—061. Cumulative Revenue Percentage by Department
    medium
  41. 41—062. Products with Above-Average Rating
    medium
  42. 42—063. Count Employees with Missing Salary
    medium
  43. 43—065. Category Revenue Summary (Chained CTEs)
    medium
  44. 44—066. Top-Spending Customers (Derived Table)
    medium
  45. 45—067. Extract Email Domain
    medium
  46. 46—068. Revenue by Category and Order Status
    medium
  47. 47—069. 7-Day Rolling Active Users
    medium
  48. 48—070. Products with Zero Total Sales
    medium
  49. 49—071. Rank Departments by Total Payroll
    medium
  50. 50—072. Customer Lifetime Value
    medium
  51. 51—074. Products per Category as Comma-Separated List
    medium
  52. 52—075. Average Days Between Customer Orders
    medium
  53. 53—076. Monthly Order Completion Rate
    medium
  54. 54—079. Customer Cohort by First Order Month
    medium
  55. 55—080. 3-Month Moving Average Revenue
    medium
  56. 56—081. Account Running Balance
    medium
  57. 57—085. Employees Who Share the Same Manager
    medium
  58. 58—086. All Departments Including Empty Ones
    medium
  59. 59—088. Fulfilled Orders Percentage per Month
    medium
  60. 60—089. Category with the Highest Average Price
    medium
  61. 61—090. Customers Who Ordered Every Month of 2026
    medium
  62. 62—174. Employees Earning Above Their Department Average
    medium
  63. 63—177. Chained CTEs for Layered Sales Analysis
    medium
  64. 64—182. Pivot Quarterly Sales into Columns Using CASE
    medium
  65. 65—184. Comma-Separated Employee List Per Department
    medium
  66. 66—185. Aggregate Products into an Array Per Category
    medium
  67. 67—192. Find Consecutive Activity Streaks (Islands Problem)
    medium
  68. 68—196. Count New Customers Acquired Each Month
    medium
  69. 69—197. Revenue by Order Status Using CASE Inside SUM
    medium
  70. 70—198. Full Department Salary Statistics in One Query
    medium
  71. 71—205. Weekly Sales Totals Using DATE_TRUNC
    medium
  72. 72—208. User Cohort Retention by First Purchase Month
    medium
  73. 73—210. Funnel Analysis with Step-by-Step Conversion Rates
    medium
  74. 74—214. Median Salary Per Department Using PERCENTILE_CONT
    medium
  75. 75—215. Find the Most Frequently Occurring Rating (Mode)
    medium
  76. 76—216. Salary Spread by Department Using STDDEV_POP
    medium
  77. 77—217. Weighted Average Purchase Price Per Product
    medium
  78. 78—220. Pivot Monthly Revenue into Jan–Dec Columns
    medium
  79. 79—221. Multi-Level Aggregation (Aggregate of Aggregates)
    medium
  80. 80—222. Scalar Subquery in SELECT Clause
    medium
  81. 81—223. Subquery in FROM Clause (Derived Table / Inline View)
    medium
  82. 82—228. FILTER Clause with Aggregate Functions
    medium
  83. 83—229. Conditional COUNT with CASE Expression
    medium
  84. 84—234. Classify Employees into Salary Bands Using CASE
    medium
  85. 85—236. Ratio of Each Category to Total Revenue
    medium
  86. 86—238. First and Last Purchase Date per Customer
    medium
  87. 87—239. Customers Who Never Made a Second Purchase
    medium
  88. 88—240. Aggregate Orders by Weekday vs Weekend
    medium
  89. 89—241. Count Orders by Hour of Day
    medium
  90. 90—242. Products with High Average Review Rating
    medium
  91. 91—243. Customers Who Purchased from Every Category
    medium
  92. 92—244. Email Domain Frequency Analysis
    medium
  93. 93—246. Longest Gap Between Consecutive Orders per Customer
    medium
  94. 94—247. Days Since Last Order per Customer
    medium
  95. 95—248. New vs Returning Customers per Month
    medium
  96. 96—249. Repeat Purchase Rate Calculation
    medium
  97. 97—250. Customer Purchase Frequency Distribution
    medium
  98. 98—251. RFM Analysis — Recency, Frequency, Monetary Buckets
    medium
  99. 99—252. Product Co-Purchase Analysis
    medium
  100. 100—253. Sales Velocity — Units Sold per Day per Product
    medium
  101. 101—255. Supplier Lead Time Analysis
    medium
  102. 102—256. Average Order Value by Acquisition Channel
    medium
  103. 103—257. Revenue per Employee by Department
    medium
  104. 104—260. Finding Duplicate Records Across Columns
    medium
  105. 105—263. Detecting Anomalies Using Z-Score Approach
    medium
  106. 106—264. Rolling 30-Day Distinct Customer Count
    medium
  107. 107—266. Assign Sales to Fiscal Year Quarters
    medium
  108. 108—267. Count Business Days Between Two Dates
    medium
  109. 109—268. Calculate Age in Years from Birthdate
    medium
  110. 110—269. Timestamp to Date Conversion and Daily Grouping
    medium
  111. 111—272. Split Comma-Separated Tags and Count Frequency
    medium
  112. 112—274. Finding Maximum Streak of Consecutive Login Days
    medium
  113. 113—275. Customer Segments by Spending Quartile
    medium
  114. 114—278. Transactions More Than 3 Standard Deviations Above Mean
    medium
  115. 115—280. Multi-Step CTE Pipeline for Complex Analytics
    medium
  116. 116—331. Customers With Strictly Increasing Order Values
    medium
  117. 117—333. Monthly Active User Count
    medium
  118. 118—334. Churn Detection: Customers Inactive for 90+ Days
    medium
  119. 119—338. Total Revenue by Day of Week
    medium
  120. 120—342. Customer Order Gap Alert (30–60 Days)
    medium
  121. 121—343. Products Ordered by Every Customer
    medium
  122. 122—346. Average Product Rating (Minimum 5 Reviews Required)
    medium
  123. 123—347. Product Price Range Histogram
    medium
  124. 124—353. Supplier Performance: Promised vs Actual Delivery Days
    medium
  125. 125—355. Employees Sharing at Least One Project
    medium
  126. 126—357. Calculate Net Promoter Score (NPS)
    medium
  127. 127—358. Orders Where Every Line Item Is Shipped
    medium
  128. 128—359. Region × Quarter Revenue Pivot Matrix
    medium
  129. 129—361. Product Return Rate as Percentage
    medium
  130. 130—363. Employees Assigned to Multiple Departments
    medium
  131. 131—367. Assign Customer Lifetime Value Tiers
    medium
  132. 132—368. Product Co-Purchase Affinity Score
    medium
  133. 133—369. Manager Span of Control (Direct Reports Count)
    medium
  134. 134—374. Invoice Aging Bucket Report
    medium
  135. 135—375. Employee Headcount by Salary Band
    medium
  136. 136—377. Average Basket Size per Customer
    medium
  137. 137—380. Top 3 Categories by Order Count
    medium
  138. 138—096. Churned vs Retained Customers
    hard
  139. 139—097. Cohort Retention Matrix (Months 0–3)
    hard
  140. 140—098. Frequently Bought Together (Market Basket)
    hard
  141. 141—099. Running Balance with Overdraft Detection
    hard
  142. 142—100. Employee Hierarchy Depth
    hard
  143. 143—289. Monthly Sales Pivot Table (Jan–Dec)
    hard
  144. 144—292. Median Salary by Department using PERCENTILE_CONT
    hard
  145. 145—293. Fraud Detection: 3+ Transactions Within 1 Hour
    hard
  146. 146—297. Balanced Task Distribution with NTILE
    hard
  147. 147—383. Required Skills Missing per Employee
    hard
  148. 148—388. Org-Chart Budget Rollup
    hard
  149. 149—391. Project Critical Path Length
    hard
  150. 150—399. Portfolio Mean, Volatility, and 95% VaR
    hard