Field Data Types
Once you have identified the tables and the fields for your database, the next step is to determine
each fields data type. With any relational database management system, you need to define what
kind of information each field will contain. In most relational database management systems,
there are three primary categories of field types:
3. Dates and Times
Within each of these primary categories, there are variations of these categories, some of which
may be specific to individual RDMSs. I will highlight particular differences as they arise.
It is important to give careful thought and consideration to field types because they dictate what
information can be stored and how it is stored which may affect database performance.
MySQL Data Types
Below is a list of data types for MySQL (adapted from Ullman L. MySQL. A visual quickstart
guide. Peachpit Press: Berkeley. 2003.):
Note: The square brackets  indicate an optional parameter to be put in parentheses, while
parentheses () indicate required arguments.
Type Size Description
CHAR[Length] Length bytes A fixed-length field from 0 to 255
VARCHAR(Length) String length + 1 bytes A fixed-length field from 0 to 255
TINYTEXT String length + 1 bytes A string with a maximum length of
TEXT String length + 2 bytes A string with a maximum length of
MEDIUMTEXT String length + 3 bytes A string with a maximum length of
LONGTEXT String length + 4 bytes A string with a maximum length of
TINYINT[Length] 1 byte Range of -128 to 127 or 0 to 255
SMALLINT[Length] 2 bytes Range of -32,768 to 32,767 or 0 to
MEDIUMINT[Length] 3 bytes Range of -8,388,608 to 8,388,607 or 0
to 16,777,215 unsigned
INT[Length] 4 bytes Range of -2,147,483,648 to
2,147,483,647 or 0 to 4,294,967,295
BIGINT[Length] 8 bytes Range of -9,223,372,036,854,775,808
to 9,223,372,036,854,775,807 or 0 to
FLOAT 4 bytes A small number with a floating
DOUBLE[Length, Decimals] 8 bytes A large number with a floating
DECIMAL[Length, Decimals] Length +1 bytes or A DOUBLE stored as a string,
Length + 2 bytes allowing for a fixed decimal point.
DATE 3 bytes In the format YYYY-MM-DD
DATETIME 8 bytes In the format YYYY-MM-DD
TIMESTAMP 4 bytes In the format
range ends in the year 2037.
TIME 3 bytes In the format of HH:MM:SS.
ENUM 1 or 2 bytes Short for enumeration, that is, each
column can have one of several
SET 1, 2, 3, 4, or 8 bytes Like ENUM except that each column
can have more than one of several
Microsoft Access Data Types
Below is a list of data types for Microsoft Access (adapted from Schwartz S. Microsoft Office
Access 2003. A visual quickstart guide. Peachpit Press: Berkeley 2004).
In Microsoft Access, each field can be one of the following data types:
1. Text: a Text field can store any combination of typed characters: letters, numbers, and
2. Memo: a Memo field is an extra large Text field (up to 65,535 characters). When
sorting on a Memo field, Access only considers the first 255 characters.
3. Number: a Number field is used to store most types of numeric data (with the exception
of monetary amounts which can be stored using the Currency field type).
4. Currency: this data type has been designed specifically to store currency amounts and
prevent rounding errors.
5. Auto Number: the Auto Number data type is used to automatically assign a new number
to a primary key field, increasing the previously assigned number by one. Data stored in
an Auto Number field cannot be edited.
6. Date/Time: a Date/Time field is used to store dates or times. A specific format to
display dates and times can be selected.
7. Yes/No: a Yes/No field is the Access data type for recording one of two opposing
values. Yes/No fields can be formatted as Yes/No, True/False, or On/Off (although all
are equivalent). Every Yes/No field is formatted as a single check box; checked is “Yes”,
“True”, or “On” whereas unchecked is “No”, “False”, or “Off”.
8. OLE Object: Object Linking and Embedding (OLE) Object data types enable you to
embed or link to documents created in other programs, such as worksheets created in MS
Excel, images (eg, gif, or jpg files), or word processing files (eg, doc files); one can either
embed the object in the Access data file or link the object to the database, thereby storing
a pointer or a reference to the original document. OLE is the technology which allows an
object (such as a spreadsheet) to be embedded (and/or linked) inside of another document
(like a word processor document).
9. Hyperlink: the Hyperlink data type enables you to store a “clickable” address in the
field. For example:
10. Lookup Wizard: a Lookup Wizard field type enables a field to display a drop-down list
of values from which the user can choose; this list of values can come from another
table, a query, or event he same table.
A Review of Bits and Bytes
(This section has been adapted from Marshall Brain’s article on “How Bits and Bytes Work”
In order to understand a little about field types and their bytes, it’s important to review briefly
what bytes (and bits) are.
Let’s first review the concept of decimal numbers. I think everyone is familiar with decimal
places and digits of a decimal number. Each digit can range from 0 to 9, that is, ten possible
values. For example, we know that the number 1,488 has four digits with four decimal places: 8
ones, 8 tens, 4 hundreds, and 1 thousands. So the number 1,488 could be expressed as:
(1*1000) + (4*100) + (8*10) + (8*1) = 1000 + 400 + 80 + 8 = 1,488
Similarly, we could express the same number in terms of powers of 10:
(1*10^3) + (4*10^2) + (8*10^1) + (8*10^0) = 1000 + 400 + 80 + 8 = 1,488
Recall, anything to the zero power is equal to 1.
Bits and bytes could be viewed in a similar way. Computers use the base-2 system known as the
binary number system just as the base-10 number system is known as the decimal number
system. Each binary digit (also called a “bit” for Binary digIT) can only take on one of two
values, 1 or 0, instead of 0 to 9 like the decimal system. So the binary number 1100 would
(1*2^3) + (1*2^2) + (0*2^1) + (0*2^0) = 12
This time we use base of 2 instead of base of 10.
A collection of 8 bits is known as one byte. With 8 bits in a byte, one can represent 256 values
ranging from 0 to 255:
00000000 = (0*2^7) + (0*2^6) + (0*2^5) + (0*2^4) + (0*2^3) + (0*2^2) +
(0*2^1) + (0*2^0)
11111111 = (1*2^7) + (1*2^6) + (1*2^5) + (1*2^4) + (1*2^3) + (1*2^2) +
(1*2^1) + (1*2^0)
Three bytes (24 bits) can then represent a number ranging from 0 to 16,777,215.
000000000000000000000000 = (0*2^23) + (0*2^22) + (0*2^21) + …+ (0*2^4) +
(0*2^3) + (0*2^2) + (0*2^1) + (0*2^0)
111111111111111111111111 = (1*2^23) + (1*2^22) + (1*2^21) + …+ (1*2^4) +
(1*2^3) + (1*2^2) + (1*2^1) + (1*2^0)
Bytes are used to hold individual characters in a text document. For example, 00100000 is equal
to 32 which is the numeric code for “space”. So text characters are coded as numbers which are
stored as bytes in a computer file. The computer usually stores each character in 1 byte.