Designing Tables

Before you start working with SQL and MySQL, you have to identify your application’s needs. This then dictates the database design. For the examples in this chapter, I’ll create a database (generically called sitename) that stores some user registration information (which will then be incorporated into Chapter 6, “Using PHP and MySQL”). The database will consist of a single table, users, that contains columns to store user ID, first name, last name, email address, password, and registration date. Table 4.1 shows the current layout, using MySQL’s naming rules for column titles (alphanumeric names, plus the underscore, with no spaces).

Once you have identified all of the tables and columns that the database will need, you should ...

Get PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide 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.