Perl
  Home arrow Perl arrow Page 2 - Perl and DBI
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PERL

Perl and DBI
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2008-03-14


    Table of Contents:
  • Perl and DBI
  • Introduction to Relational Databases
  • The Relational of Relational Database
  • We Need an SQL Server—MySQL

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    Perl and DBI - Introduction to Relational Databases
    ( Page 2 of 4 )

    In order to talk about SQL, we will need to start by talking about relational databases. There are two important facts about relational databases. First, the content in a relational database is persistent—the data continues to exist after the execution of the program that accesses or modifies it. This is much like writing the data to a file on disk that will stay on the disk after the file is created, read from, or modified. The second important fact is that relational databases, unlike files on disk, allow concurrent access and updates from multiple users and processes. This means that more than one user can access the database at the same time—the database server takes care of making sure the changes are made to the data in a safe way.

    A relational database, simply put, is a database of tables that can relate to one another in some way. A table is a collection of rows of data. Every row of data has the same basic pieces of information, called fields. There are a lot of buzzwords here, so let’s describe each of these by an example.

    Let’s say we want to keep some information about our favorite musicians. The information includes their name, phone number (since we often call them up and chat), and the instruments that they play. We might start by creating a list of the musicians like this:1

    Roger Waters 555-1212
    Geddy Lee 555-2323
    Marshall Mathers III 555-3434
    Thom Yorke 555-4545
    Lenny Kravitz 555-5656
    Mike Diamond 555-6767

    This list of musicians shows six lines of data. These lines are called rows in relational database–speak. We would take these six rows and place them together into one collection of data, called a table. Normally, when we place data within a table, we want to create a unique identifier for the row, called a key—just in case we had two different Marshall Mathers III in our table we could access the one we are interested in using this unique value. We will name the key player_id and name the other columns, or fields, as well:

    player_id name phone
    1 Roger Waters 555-1212
    2 Geddy Lee 555-2323
    3 Marshall Mathers III 555-3434
    4 Thom Yorke 555-4545
    5 Lenny Kravitz 555-5656
    6 Mike Diamond 555-6767

    What we have created here is a table (let’s name it musicians ) with three fields ( player_id , name , and phone ) and six rows of information. With this one example we have defined most of our relational database buzzwords, except relational.



     
     
    >>> More Perl Articles          >>> More By Apress Publishing
     

       

    PERL ARTICLES

    - More Perl Bits
    - Perl, Bit by Bit
    - Basic Charting with Perl
    - Using Getopt::Long: More Command Line Option...
    - Command Line Options in Perl: Using Getopt::...
    - Web Access with LWP
    - More Templating Tools for Perl
    - Site Layout with Perl Templating Tools
    - Build a Perl RSS Aggregator with Templating ...
    - Looping, Security, and Templating Tools
    - Perl: Bon Voyage Lists and Hashes
    - Templating Tools
    - Perl: Number Crunching
    - Perl Debuggers in Detail
    - Debugging Perl





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek