Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Maximums and Minimums

September 13, 1998

Another couple of useful tools are the MAX and MIN operators that allow you to grab the boundary values in a column (alphanumeric). The most generic syntax follows something like:

    SELECT MAX (column_name)
    FROM table_name
    WHERE where_clause [optional];

For example, consider the following case in which we grab the employee with the highest salary:

    SELECT MAX (EMP_SALARY)
    FROM EMPLOYEES;

In this case, we would get the following:

    MAX (EMP_SALARY)
    ----------------
    90000
    ----------------

Of course, you can also redefine the column name in the view by assigning the MAX or MIN value to a column name such as in the following case:

    SELECT top_salary = MIN (EMP_SALARY)
    FROM EMPLOYEES
    WHERE EMP_COMMISSION = '20%';

In this case, we would get the following:

    top_salary
    ----------------
    40000
    ----------------

Performing Math
Introduction to Databases for the Web | Table of Contents
Counting Records


Up to => Home / Authoring / DB / Intro




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers