Home arrow BrainDump arrow Page 5 - SQL: Functioning in the Real World

Minimum and Maximum - BrainDump

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.

  1. SQL: Functioning in the Real World
  2. What You Talkin Bout Willis?
  3. Count
  4. Count Distinct
  5. Minimum and Maximum
By: James Payne
Rating: starstarstarstarstar / 1
December 10, 2007

print this article



The Min(Column) and Max(Column) functions return the lowest and highest value in a column, respectively. If we wanted to see the highest pay rate in our Employees table, we would do the following:

  Select Max(Salary) from Employees

This would return the value, $100,000. If we wanted to see the lowest salary, we would do this:

  Select Min(Salary) from Employees

The result of this would be $12,000. Poor Ang Ree.

In Summation

Ha! I fooled you! You though this was the end of the article. Well you were wrong; I was using word play to trick your feeble mind.

You can use the Sum(Column) function to get a total of all the values in a column. If we wanted to know the annual salary of all of the employees in the Employee table, it would go a little something like this:

  Select Sum(Salary) from Employees

This would add all of the values in the Salary column, resulting in the total: $342,000.

Well, that wraps it up for this part. In the next part we will cover the rest of the Aggregate Functions, and learn the Scalar functions as well. Look forward to seeing you.

Till then...

>>> More BrainDump Articles          >>> More By James Payne

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Apple Founder Steve Jobs Dies
- Steve Jobs` Era at Apple Ends
- Google's Chrome Developer Tool Updated
- Google's Chrome 6 Browser Brings Speed to th...
- New Open Source Update Fedora 13 is Released...
- Install Linux with Knoppix
- iPad Developers Flock To SDK 3.2
- Managing a Linux Wireless Access Point
- Maintaining a Linux Wireless Access Point
- Securing a Linux Wireless Access Point
- Configuring a Linux Wireless Access Point
- Building a Linux Wireless Access Point
- Migrating Oracle to PostgreSQL with Enterpri...
- Demystifying SELinux on Kernel 2.6
- Yahoo and Microsoft Create Ad Partnership

Developer Shed Affiliates


Dev Shed Tutorial Topics: