Finding the average number of documents in folders

I found an example that used syntax where I could find the average based on a group count.  In this case, the group by is the folder’s tracking id (ParentTracking_ID) assigned to the document.

SELECT AVG(docs.RecordCount) as 'Avg Documents in Folder',Count(docs.RecordCount) as 'Total Folders' From
  (SELECT RecordCount = count(Tracking_ID) From Documents Group By ParentTracking_ID ) docs
  Where docs.RecordCount >= 5

Example Data:

Min # of Documents in Folder

Where docs.RecordCount >= #

Average # of Documents in Folder

AVG(docs.RecordCount)

Total Folders

Count(docs.RecordCount)

5

24

895,188

50

78

85,910

100

122

19,491

200

282

487

500

875

19

1,000

2,146

3

2,000

4,153

1

3,000

4,153

1

4,000

4,153

1

5,000

0

0