Creating the Database

The e-commerce site in this example will use the simply named ecommerce database. It was marginally used in Chapter 11, but without the structure it will have here. I’ll explain each table’s role prior to creating the database in MySQL.

With any type of e-commerce application there are three broad kinds of data to be stored: the product information (what is being sold), the customer information (who is making purchases), and the order information (what was purchased and by whom). Going through the normalization process (see Chapter 5, “Advanced SQL and MySQL”), I’ve come up with five tables (Figure 14.1).

Figure 14.1. This entity-relationship diagram (ERD) shows how the five tables in the ecommerce database relate to one ...

Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.