• And, a question on type casting. I notice you use explicit type casting with

    Cast(Ceiling(Cast(YearDay as real)/Cast(7 as real))as int)

    and similar functions. I think the same result would be accomplished with the implicit typecasting of

    ceiling(YearDay/7.0)

    and be a little easier to read.

    Of course I am not a "real" programmer as I write code to do my job rather than as my job (though I'm considering a career change from Data Analysis to DB Developer). So it may be that real programmers find it better to explicitly control the data type rather than trusting to implicit data typing "rules".