MySQL
  Home arrow MySQL arrow Page 2 - Speaking SQL (part 1)
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

Speaking SQL (part 1)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2000-12-21

    Table of Contents:
  • Speaking SQL (part 1)
  • Turntables And Records
  • Relationships
  • Not Your Type?
  • Changing Things Around
  • Termination With Extreme Prejudice
  • Old Data For New

  • 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


    Speaking SQL (part 1) - Turntables And Records


    (Page 2 of 7 )

    Every database is composed of one or more "tables" - these tables, which structure data into rows and columns, are what lend organization to the data.

    Here's an example of what a typical table looks like:


    +-----------+-------+---------+---------+--------------------------+
    | member_id | fname | lname   | tel     | email                    |
    +-----------+-------+---------+---------+--------------------------+
    |         1 | John  | Doe     | 1234567 | jdoe@somewhere.com       |
    |         2 | Jane  | Doe     | 8373728 | jane@site.com            |
    |         3 | Steve | Klingon | 7449373 | steve@alien-race.com     |
    |         4 | Santa | Claus   | 9999999 | santa@the-north-pole.com |
    +-----------+-------+---------+---------+--------------------------+
    

    As you can see, a table divides data into rows, with a new entry (or "record") on every row. If you think of a table as a filing cabinet, you'll see that every file in the cabinet corresponds to one row in the table.

    The data in each row is further broken down into cells (or "fields"), each of which contains a value for a particular attribute of the data. For example, if you consider the record for the user "Steve Klingon", you'll see that the record is clearly divided into separate fields for phone number, email address, and first and last names.

    The rows within a table are not arranged in any particular order - they can be sorted alphabetically, by id, by member name, or by any other criteria you choose to specify. Therefore, it becomes necessary to have some method of identifying a specific record in a table. In the example above, each record is identified by a "member id", which is a number unique to each row or record; this unique field is referred to as the "primary key" for that table.

    More MySQL Articles
    More By icarus, (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 4 hosted by Hostway