??? Indexes are automatically created on UNIQUE and PRIMARY KEY columns.
Columns and Data Types
Each column in a table has a particular data type. By looking at the department table shown in
Figure 4-8, you can see that department_id has a numeric data type, whereas name and description
contain text.
It??™s important to consider the many data types that MySQL Server supports so that you??™ll
be able to make correct decisions about how to create your tables. Table 4-1 isn??™t an exhaustive
list of MySQL data types, but it focuses on the main types you might come across in your project.
Refer to the MySQL documentation for a more detailed list at http://www.mysql.org/doc/
refman/5.1/en/data-types.html.
?– Tip For more information about any specific detail regarding MySQL or PHP, including MySQL data types,
you can always refer to W. Jason Gilmore??™s Beginning PHP and MySQL 5: From Novice to Professional,
Second Edition(Apress, 2006), which is an excellent reference.
To keep the table short, under the Data Type heading, we have listed the types used in this
project, while similar data types are explained under the Description and Notes headings. You
don??™t need to memorize the list, but you should get an idea of which data types are available.
CHAPTER 4 ?– CREATING THE PRODUCT CATALOG: PART 1 73
Table 4-1. MySQL Server Data Types for Use in TShirtShop
Data Type Size in Bytes Description and Notes
int 4 Stores integer numbers from ??“2,147,483,648 to
2,147,483,647.
Pages:
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147