3.3.1.3 Complete design
Based on the discussions for the user and order items, we will create four
database tables. Each table has a set of fields, or column names, where each
field has a data type, a length, and a nullable condition.
The data type
There are various data types that are available in DB2. We use the
following data types in our database tables:
varchar: Provides variable length string type
char: Provides fixed length string type
date: Provides a date only data type
timestamp: Provides a date and time up to a microsecond
int: Provides a whole number type
The field length
This represents the length of the field, if appropriate. For example, a data
type of char or varchar requires a length, but a data type of date,
timestamp, or int does not.
The nullable condition
This last attribute, the nullable condition, exists for us to track whether the
field can be left empty or undefined or must be filled in. For example, a is
a 0 length string; it is not a null string.
The structure of the database that we built is represented by the Entity
Relationship diagram shown in Figure 54.
Chapter 3. Building the Web server
63