Lesson 1
Creating Databases for the Web
A
database[1] is a collection of data within defined parameters (a data model) that allows the data elements to be predictable.
Picture it as an electronic filing system: to keep organized, you would add tabbed folders perhaps by function, such as payroll. Databases provide a standardized system for users to store, retrieve, and protect their data. They are important components of Web applications because they provide search functions and access to information resources beyond individual Web pages.
- Describe the characteristics of hierarchical and relational databases
- Describe the characteristics of database-driven Web sites
- Describe the technologies used to connect databases to the Web
- Explain the process used to connect a database to the Web using ODBC
- Explain the purpose of SQL
The two most common types of databases you will likely encounter are hierarchical and relational databases.
Database Systems
Databases Defined
Microsoft SQL-Server and Sybase define a database as a collection of data items that have a common owner, and multiple databases are typically managed by a single instance of the
database management software. This can be quite confusing if you work with multiple products because, for example, a database as defined by Microsoft SQL Server and Sybase is exactly what Oracle Corporation calls a schema.
A database object is a named data structure that is stored in a database. The specific types of database objects supported in a database vary from vendor to vendor and from one database model to another. Database model refers to theway in which
a database organizes its data to pattern the real world. The most common database models are presented in “Prevalent Database Models,” later in this chapter. Afile is a collection of related records that are stored as a single unit by an operating
system. Given the unfortunately similar definitions of files and databases, how can we make a distinction? A number of Unix operating system vendors call their password file a
database, yet database expertswill quickly point out that, in fact, it
is not. The answer lies in an understanding of certain characteristics or properties that databases possess that ordinary files do not, including the following:
- Management by a Database Management System (DBMS)
- Layers of data abstraction
- Physical data independence
- Logical data independence
Advantages of using Database
When it comes to storing and retrieving Data, the advantages of using a relational database instead of a flat file include
- RDBMSs can provide faster access to data than flat files.
- RDBMSs can be easily queried to extract sets of data that fit certain criteria.
- RDBMSs have built-in mechanisms for dealing with concurrent access so that you, as a programmer, don’t have to worry about it.
- RDBMSs provide random access to your data.
- RDBMSs have built-in privilege systems.
For some concrete examples, using a
relational database allows you to quickly and easily answer queries about where your customers are from, which of your products is selling the best, or what types of customers spend the most. This information can help you improve the site to attract and keep more users but would be very difficult to distill from a flat file.
The database that you will use when developing applications in PHP will be MySQL. Before we get into MySQL specifics, we need to discuss
- Relational database concepts and terminology
- Designing your web database
- Web database architecture
In the next lesson, you will learn the differences between hierarchical and relational databases.
[1] Database: A collection of data within defined parameters (a data model) that makes the data elements predictable.