Home arrow MySQL arrow Page 3 - Understanding SQL Joins

Keeping It Simple - MySQL

Left join. Right join. Inner join. If you've ever wondered what all this jargon means, it's time to find out. Welcome to the wild, the wacky, the insanely cool world of SQL joins.

TABLE OF CONTENTS:
  1. Understanding SQL Joins
  2. Meeting The Family
  3. Keeping It Simple
  4. Crossed Wires
  5. Finding Common Ground
  6. One Step Left...
  7. ...Two Steps Right
  8. The Bookworm Turns
  9. Up A Tree
  10. A Long Goodbye
By: The Disenchanted Developer, (c) Melonfire
Rating: starstarstarstarstar / 247
August 20, 2002

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
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
 

blog comments powered by Disqus
   

MYSQL ARTICLES

- Xeround Releases Free Version of MySQL Cloud...
- Oracle Announces New MySQL Specialization
- Constant Contact Chooses SkySQL for MySQL Su...
- Revoke Statement in MySQL
- The Grant Statement in MySQL
- SuccessBricks Announces ClearDB Availability...
- Building a PHP ORM: Deploying a Blog
- TROSYS Launches Free MySQL Manager and Admin...
- Building an ORM in PHP: Domain Modeling
- Building an ORM in PHP
- MySQL Leads Open Source Market, Gets Cluster...
- Oracle Announces Milestone Release for MySQL
- How to Stop SQL Injection Attacks
- New Defragmentation Solution for SQL Server
- Comparison of MyISAM and InnoDB MySQL Databa...


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap

Dev Shed Tutorial Topics: