BrainDump
  Home arrow BrainDump arrow Page 4 - SQL: Functioning in the Real World
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

SQL: Functioning in the Real World
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2007-12-10

    Table of Contents:
  • SQL: Functioning in the Real World
  • What You Talkin Bout Willis?
  • Count
  • Count Distinct
  • Minimum and Maximum

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    SQL: Functioning in the Real World - Count Distinct


    (Page 4 of 5 )

    Let's step away from the lawsuit scenario for a moment. Let's add a new column to our table called Position. Fill in your database with the added values below.

     

    Name

    Age

    Salary

    Position

    Ang Ree

    92

    $12,000

    Director

    Godzilla Nokamura

    45

    $50,000

    Villain

    Mothra Fujiyama

    27

    $80,000

    Villain

    King Kong Wong

    19

    $100,000

    Hero

    Go-Go Roboto

    29

    $100,000

    Actor created solely for toy sales

    If we wanted to know how many unique positions there were (or any other unique items) we could use the Count(Distinct) function. As you can see, there are presently 5 positions in the company. What we want to know though is how many positions there are that don't duplicate themselves.

      Select Count (Distinct Position) from Employees

    The result:

      4

    This is because the Villain position is a duplicate, and thus one value is not unique.

    More BrainDump Articles
    More By James Payne


       · Thanks for dropping by to read my article on SQL Functions. Here we discuss such...
     

       

    BRAINDUMP ARTICLES

    - More Amazing Things to Do With Pipelines
    - Pipelines Can Do Amazing Things
    - Better Command Execution with bash
    - Executing Commands with bash
    - Outsourcing: the Hoopla, the Reality
    - MySQL Plays in the Sun
    - All About SQL Functions
    - SQL: Functioning in the Real World
    - More Advanced SQL Statements
    - Beginning SQL the SEQUEL: Working with Advan...
    - Beginning SQL
    - A Look at the VI Editor
    - A Quick Tour of Boo
    - Book Review: Open Source Licensing
    - PGP and GPG: Email for the Practical Parano...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway