Although this is not a book about databases or relational database design, you??™ll learn all
you need to know to understand the product catalog and make it work.
Essentially, a relational database is made up of data tables and the relationships that exist
among them. Because you??™ll work with a single data table in this chapter, we??™ll cover only the
database theory that applies to the table as a separate, individual database item. In the next
chapter, when you??™ll add the other tables to the picture, we??™ll take a closer look at the theory
behind relational databases by analyzing how the tables relate to each other and how MySQL
helps you deal with these relationships.
?– Note In a real-world situation, you would probably design the whole database (or at least all the tables
relevant to the feature you build) from the start. In this book, we chose to split the development over two
chapters to maintain a better balance of theory and practice.
CHAPTER 4 ?– CREATING THE PRODUCT CATALOG: PART 1 69
So, let??™s start with a little bit of theory, after which you??™ll create the department data table
and the rest of the required components:
Understanding Data Tables
This section provides a quick database lesson covering the essential information you need to
know to design simple data tables. We??™ll briefly discuss the main parts that make up a database
table:
??? Primary keys
??? MySQL data types
??? UNIQUE columns
??? NOT NULL columns and default values
??? Autoincrement columns
??? Indexes
?– Note If you have previous experience with MySQL, you might want to skip this section and go directly to
the ???Creating the department Table??? section.
Pages:
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141