What Are We Talking About?


Before we start talking about the individual database software packages, we will start with some terminology to make sure we have a clear understanding of what we mean when we say "database."

The Basics

A database is a collection of data with a regular and predictable structure. If you consider your collection of compact discs, you have a database. You can organize them on your shelf (usually by hand), sorting them alphabetically by band name, album title, publisher, or (were you so inclined) the number of songs on each CD. If you were a bit older, you could even include in your database of "music media" any audio cassettes, records, ordare we say it8-track tapes. This data all shares an extremely similar set of properties, features, and means of organization.

If we turn our attention to the set of compact discs that a music merchant has available for sale, we would notice that

  • The set of CDs listed is significantly larger than our private collection.

  • The merchant stores a bunch of information in this set of data about which we really are not interested for our personal collection, such as the price per unit, number of units in stock, the supplier from which the discs came, when the next shipment is expected, and any marketing promotions with which the CDs might be associated.

Thus, we see that a database is not only a collection of information or data with structure, but also something with an envisioned purpose. If we were to enter our collection of discs into our computer, we might start with a simple text file, with each line representing a title, as shown in Table 8-1.

Table 8-1. A Small Collection of Compact Discs

Artist

Title

Publisher

Year

Curve

Come Clean

Universal

1998

Curve

Gift

Universal

2001

Curve

Open Day at the Hate Fest

Universal

2001

Police (The)

Every Breath You Take: The Classics

A&M Records

1995

Prozac+

Acido acida

EMI Music

1998

Tocotronic

Tocotronic

LADO Musik

2002


As our collection grows, it is not very difficult initially to add new entries to the text file using a simple editing program while making sure they are still alphabetically sorted. However, if we were serious audiophiles and our collection started to truly expand, we would find it increasingly tedious to maintain the correct ordering of our discs. It also might become more annoying to search for things within the collection. Furthermore, if we wanted to add another field to the set of data stored, such as the number of songs on the album, we would be in for a lot of work.

Eventually, we might find ourselves writing a small code library in some language to manage this list, handle insertion or deletion, sort, and store new information. If this were to continue, at some point we would find ourselves having written what is, in effect, a database management system (DBMS)a piece of software used to organize, query, maintain, and manipulate our database.

Fortunately, there are a good number of DBMSes available today that will do this for us. The purchase cost of these ranges from zero to millions of dollars, and the functionality, complexity, and performance tends to vary considerably. These packages, also called database servers or database engines, not only include a means to store the data in databases, but also powerful and flexible ways to access, combine, and analyze them.

Relational Databases

Most of the DBMSes you will encounter are called relational database management systems (RDBMS). The name does not come from an assumption of interrelation between the data, but instead from a branch of mathematics called set theory. Unlike other models of databases, such as hierarchical databases or network databases with implied and structured relationships between data, relational databases consist strictly of tables (or relations) in which the data is stored.

These tables are made up of rows (or records), and each row is made up of one or more columns (also called fields or attributes). Typically, these columns have a name associated with them and a specific type of data (see Figure 8-1).

Figure 8-1. Table terminology.


As mentioned before, tables in a relational database frequently have no explicit relation to other tables (though implied relationships are common). Also, the location and way in which they are stored is irrelevantall that we care about is that the data is in the table and that, given the name of the table, we have a means of accessing them. This is done via the data itself, and we can choose to look for specific items or broad groups of items (such as "all of them").

Relational databases prove particularly well-suited for use in web applications. By having your data in easily accessible storage, you are free to spend more time working on the presentation and user experience for your web application. The flexibility with which the DBMS lets you access the data means that you can work to present the right user interface for your clients. Many organizations also find that web applications that utilize databases are a handy way to leverage existing database installations and bring that content to the web.




Core Web Application Development With PHP And MYSQL
Core Web Application Development with PHP and MySQL
ISBN: 0131867164
EAN: 2147483647
Year: 2005
Pages: 255

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net