PHP and MySQL Web Development - P42: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 172 Chapter 7 Designing Your Web Database CUSTOMERS CustomerID Name Address City 1 Julie Smith 25 Oak Street Airport West 2 Alan Wong 1 47 Haines Avenue Box Hill 3 Michelle Arthur 357 North Road Yarraville ORDERS OrderID CustomerID Amount Date 1 3 02-Apr-2000 2 1 15-Apr-2000 3 2 19-Apr-2000 4 4 01-May-2000 Figure Each order in the Orders table refers to a customer from the Customers table. Schemas The complete set of the table designs for a database is called the database schema. It is akin to a blueprint for the database. A schema should show the tables along with their columns the data types of the columns and indicate the primary key of each table and any foreign keys. A schema does not include any data but you might want to show sample data with your schema to explain what it is for. The schema can be shown as it is in the diagrams we are using in entity relationship diagrams which are not covered in this book or in a text form such as Customers CustomerID Name Address City Orders OrderID CustomerID Amount Date Underlined terms in the schema are primary keys in the relation in which they are underlined. Dotted underlined terms are foreign keys in the relation in which they appear with a dotted underline. Relationships Foreign keys represent a relationship between data in two tables. For example the link from Orders to Customers represents a relationship between a row in the Orders table and a row in the Customers table. Three basic kinds of relationships exist in a relational database. They are classified according to the number of things on each side of the relationship. Relationships can be either one-to-one one-to-many or many-to-many. A one-to-one relationship means that there is one of each thing in the relationship. For example if we had put addresses in a separate table from Customers there would be a one-to-one relationship between could have a foreign key from Addresses to Customer or the other way around both are .