Logo         Community
The Company
Your Account
Contact Us
Database Essentials
A discussion of basic database concepts.

| Relationships |

Many of today's databases are "relational database management systems", referred to by the acronym RDBMS. A relational database is typically composed of multiple tables, which contain inter-related pieces of information. SQL, or Structured Query Language, allows you to combine the data from these tables in different ways, thereby allowing you to create and analyze new relationships.

The example you just saw consists of a single table. While this is fine by itself, it's when you add more tables, and relate the information between them, that you truly start to see the power inherent in this system. Here's an example:

''.preg_replace(array('/  /', '/ /'), array('  ', '   '), '
# "names" table
| CustomerID | FirstName | LastName |
|    234673 | John      | Doe      |
|    734736 | Julius    | Caesar  |
|      1243 | Daffy    | Duck    |

# "addresses" table
| CustomerID | StreetAddress                | City          | State | Zip    | Country |
|    234673 | 12, Some Street              | Nowheresville | ZZ    | 748202 |    56 |
|    734736 | The Palace Behind The Lake  | Ancient Rome  | NA    |      0 |    0 |
|      1243 | Next Door To The Rabbit Hole | Toontown      | TT    |  98765 |    0 |

# "balance" table
| CustomerID | AccountBalance |
|    734736 |    6546867.67 |
|    234673 |        3275.99 |
|      1243 |          3.00 |

Each of these three tables is an independent entity; however, they can be linked to each other by means of the CustomerID field common to all of them. For example, you could easily use the CustomerID 1243 to find out that user "Daffy Duck" lives in Toontown, and has a balance of exactly $3.00 in his account. Or you could go about it the other way: among all the customers with a balance less than $10.00 in their accounts, CustomerID 1243, aka "Daffy Duck", is the only one living in Toontown, TT.

These relationships are the fundamental basis of a relational database system. By making it possible to easily relate records in different tables to one another, an RDBMS makes it possible to analyze date in different ways, while simultaneously keeping it organized in a systematic fashion, with minimal redundancy.

How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.

Read more, or grab your copy now!

previous page more like this  print this article  next page
In trog...
Logging With PHP
Building A Quick-And-Dirty PHP/MySQL Publishing System
Output Buffering With PHP
Date/Time Processing With PHP
Creating Web Calendars With The PEAR Calendar Class
In the hitg report...
Crime Scenes
Animal Attraction
Lord Of The Strings
In boombox...
Patience - George Michael
Think Tank - Blur
My Private Nation - Train
In colophon...
Hostage - Robert Crais
The Dead Heart - Douglas Kennedy
Right As Rain - George Pelecanos
In cut!...
American Chai
The Core
Find out how you can use this article on your own Web site!

Copyright © 1998-2018 Melonfire. All rights reserved
Terms and Conditions | Feedback