Select a data type
Every column in a table must have a data type. The choice of data
type is important for the following reasons:
- It establishes the set of valid data items that the column can store.
- It determines the kinds of operations that you can perform on
the data.
For example, you cannot apply aggregate functions, such as SUM, to columns that are defined on a character data type.
- It determines how much space each data item occupies on disk.
The space required to accommodate data items is not as important for small tables as it is for tables with hundreds of thousands of rows. When a table reaches that many rows, the difference between a 4-byte and an 8-byte data type can be crucial.
The following figure shows a decision tree that summarizes the choices among built-in data types. The choices are explained in the following sections.