Saliceran Saliceran - 1 year ago 101
SQL Question

How do I get the average row count per day of data?

I have a large table in Teradata that gets new data loaded into it daily. It has a column called

that is the date that row was loaded into the table. I'd like to write a query that will give me the average row count per day so I can see how much data generally gets loaded in a day.

Answer Source

You can count the number of rows and divide by the number of days:

select count(*) / count(distinct cal_dt)
from t;

This gives the average for each day when data was loaded.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download