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  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
BRAINDUMP

SQL: Functioning in the Real World
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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
     

       

    BRAINDUMP ARTICLES

    - Demystifying SELinux on Kernel 2.6
    - Yahoo and Microsoft Create Ad Partnership
    - The Advantages of Obscure Open Source Browse...
    - Dell Announces CSI-style Digital Forensics S...
    - Milepost GCC Speeds Open-Source Development
    - Learn These 10 Programming Languages
    - Tomcat Capacity Planning
    - Internal and External Performance Tuning wit...
    - Tomcat Benchmark Procedure
    - Benchmarking Tomcat Performance
    - Tomcat Performance Tuning
    - Wubi: Windows-based Ubuntu Installer
    - Configuring and Optimizing Your I/O Scheduler
    - Linux I/O Schedulers
    - Advising the Linux Kernel on File I/O





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek