BrainDump
  Home arrow BrainDump arrow Page 4 - More Advanced SQL Statements
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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

More Advanced SQL Statements
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2007-10-08

    Table of Contents:
  • More Advanced SQL Statements
  • UNION STATEMENT
  • And along came baby
  • Speeding Up the Search
  • OOPS I DID IT AGAIN

  • 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

    A high performance database engine using optimized data access for all development environments including Delphi, Visual Studio .NET, Visual Basic, Visual FoxPro. and more. Learn More

    More Advanced SQL Statements - Speeding Up the Search
    (Page 4 of 5 )

    Databases, like programmers, can get big and bloated. When you get them to try and give you something, it takes them forever. If they get too big, they simply freeze up and then how will you get your data?

    Well the solution is simple: create an index. An index cuts the time it takes to run a query by, you guessed it...indexing the data held within the database.


    CREATE UNIQUE INDEX MyIndex

    ON EMPLOYEE (FirstName);


    The above code creates a UNIQUE INDEX called MyIndex. It indexes the data based on the FirstName column found within the EMPLOYEE table. A UNIQUE INDEX simply means that it allows no duplicate records.

    For a SIMPLE INDEX (an index that allows duplicates) use the following code:

    CREATE INDEX MyIndex

    ON EMPLOYEE (FirstName);

    If you wanted to add a sort feature you could do that as well.

     

    CREATE UNIQUE INDEX MyIndex

    ON EMPLOYEE (FirstName DESC);

    And if you want to index more than one column, that too is possible.


    CREATE UNIQUE INDEX MyIndex

    ON EMPLOYEE (FirstName, LastName);

    More BrainDump Articles
    More By James Payne


       · This is the third installment in my Beginner SQL series. It covers things like the...
     

       

    BRAINDUMP ARTICLES

    - 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...
    - Microsoft Continues War on Open Source
    - Secure Remote Desktop Sharing with VNC on Li...
    - A Look at Google Project Hosting
    - What we can Learn from Two Linux vs. Microso...




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