
PUZZLE 29 FIND THE MODE COMPUTATION 123
PUZZLE
29 FIND THE MODE COMPUTATION
The only descriptive statistical function in SQL is the simple average,
AVG(). While it is a common statistic, it is not the only one. The mean,
the median, and the mode are all ways of measuring “central tendency”
in a set of values. The mode is the most common value in a column in a
table. Let’s suppose that the table is named “Payroll” and has the
check_nbr number and the amount of each check_nbr.
CREATE TABLE Payroll
(check_nbr INTEGER NOT NULL PRIMARY KEY,
check_amt DECIMAL(8,2) NOT NULL,
... );
What we want to see is the most common check amount and the
number of ...