294
A
database, in the simplest terms, is a structured collection of information, or records. Computer
databases can be used to store massive amounts of information in a format that makes it easy to
sort and find specific data points. Early databases were first developed in the years following World
War II. In the 1970s, a new model was proposed that more efficient data storage would be possible
if databases were created as a series of related tables. Today, almost every major database system on
the market follows this relational database model.
Understanding Relational Databases
Database Management Systems
A computer program that stores data is technically called a Database
Management System, or DBMS. Many hundreds of DBMS systems are available
today, and Web developers mostly rely on one of three systems for their work:
Microsoft SQL Server, MySQL, and Oracle. Each has advantages and
disadvantages. Due to its close relationship with PHP and its inclusion in the
WAMP and MAMP installers, this book looks at MySQL.
PHP and MySQL
Although PHP can use a technology called ODBC, or Open Database
Connectivity, to connect to Microsoft SQL Server, Microsoft Access, or
Oracle, it includes the ability to directly connect to a MySQL database.
This has the advantage of removing much of the abstraction and
additional overhead required when using ODBC, but it also means that
PHP applications must be written with a specific database in mind.
Relational Databases
A relational database is one that stores its information in a collection of tables. Each table stores data
about one specific topic. For example, in a database with product ordering information, the details about
the products would be in a table, and the details about the customers would be kept separate in a different
table. The database can then store information about the relationships between the data, so it would know
which customer ordered which product.