MySQL
  Home arrow MySQL arrow Page 3 - Understanding SQL Joins
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 
Moblin 
JMSL Numerical Library 
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? 
MYSQL

Understanding SQL Joins
By: The Disenchanted Developer, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 214
    2002-08-20

    Table of Contents:
  • Understanding SQL Joins
  • Meeting The Family
  • Keeping It Simple
  • Crossed Wires
  • Finding Common Ground
  • One Step Left...
  • ...Two Steps Right
  • The Bookworm Turns
  • Up A Tree
  • A Long Goodbye

  • 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


    Understanding SQL Joins - Keeping It Simple


    (Page 3 of 10 )

    We'll start with something simple. The general format for a SELECT statement is:

    SELECT <column list> FROM <table list> WHERE <condition list>;
    Here's an example of how it can be used - the following SQL query retrieves all the records in table "a".

    SELECT * FROM a;
    Here's the output:

    +----+------+ | a1 | a2 | +----+------+ | 10 | u | | 20 | v | | 30 | w | | 40 | x | | 50 | y | | 60 | z | +----+------+
    I can filter out some of these records by adding a WHERE clause:

    SELECT * FROM a WHERE a1 > 20;
    This returns

    +----+------+ | a1 | a2 | +----+------+ | 30 | w | | 40 | x | | 50 | y | | 60 | z | +----+------+
    And I can even restrict the number of columns shown, by specifying a list of column names instead of the all-purpose asterisk:

    SELECT a2 FROM a WHERE a1 > 20;
    Which gives me:

    +------+ | a2 | +------+ | w | | x | | y | | z | +------+

    More MySQL Articles
    More By The Disenchanted Developer, (c) Melonfire


     

       

    MYSQL ARTICLES

    - Take Some Load off MySQL with MemCached
    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL
    - Getting PHP to Talk to MySQL
    - Creating an RSS Reader: the Reader
    - MySQL Security Overview
    - Creating the Admin Script for a PHP/MySQL Bl...





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