Perl
  Home arrow Perl arrow Page 2 - Perl and DBI
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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? 
PERL

Perl and DBI
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 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:
      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

    The Web Buyer's Guide is your best source for white papers on a wide range of IT products and services. This Week's Featured White Papers: iSCSI SANs: Panacea or Placebo? by Dell

    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 keyplayer_idand 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 itmusicians) with three fields (player_id,name, andphone) 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


       · This article is an excerpt from the book "Beginning Perl," published by Apress. We...
     

    Buy this book now. This article is excerpted from chapter 15 of the book Beginning Perl (Apress; ISBN: 159059391X). Check it out today at your favorite bookstore. Buy this book now.

       

    PERL ARTICLES

    - Perl: A Continuing Look at Hashes and Multid...
    - Perl: Another Round with Hashes
    - Perl Hashes
    - Perl Lists: A Final Look at List::Util
    - Perl Lists: Utilizing List::Util
    - Perl Lists: The Split() Function
    - SQL and CGI with Perl and DBI
    - Perl Lists: More Functions and Operators
    - SELECT Queries and Perl
    - Perl Lists: More on Manipulation
    - Creating a Database with Perl and DBI
    - Perl: Sailing the List(less) Seas
    - Perl and DBI
    - Perl: Concatenating Text and More
    - Perl Text: Quoting Without Quote Marks




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