A couple of months or so ago, I began talking about SQL functions and what they're used for. This article picks up where I left off. It defines the two types of functions, and begins to explain them in great detail.
Let's face it, none of us function the way we want to in the real world. Sure, slap a copy of myself in the Sims and the next thing you know I am an in-shape, good looking, millionaire writer with oodles of time, a bevy of chicks from the neighborhood dropping by (and some dudes too, no matter how often I lock the door). I also have a hip house, a sauna, and a soda machine in my make believe Sim world.
Then there's me in the real world. On a fast track to being the world's fattest man (look out Guinness here I come), driving a car with no air conditioner in South Florida (aka, the Sun), and the only females that come to my door are trying to sell me cookies.
And if you are reading this article on Saturday, then guess what: you're in the same boat as me. But never fear. SQL, just like Tony Robbins, can help you out.
We left off last time with the promise of covering our good ole' pal the Function. In SQL, functions are used for counting and calculations and for saving lazy programmers time. There are two types of functions: Aggregate Functions and Scalar Functions. In this article we will discuss most of the Aggregates, such as how to get the average value of a column, count the values in a column and total them.
We'll also learn how to find both the minimum and maximum values in a column, using the min and max functions respectively. There's a lot of learnin' to do, so let's get started.