This article based on built in functions. SQL has a lot of built-in functions for counting and calculations.
Editorial changes — reviews, status changes and edits — are shown to the author of this article and to the editors.