
Write a query against system objects using aggregate functions: SUM, AVG, COUNT, MAX, and MIN. Execute query to insert the results into a table. Comment code appropriately, use proper code formating, and consider the use of truncation, date stamps and indexes if applicable.