CCNC/CCNC Module 5/The database application/Database Concepts/Data Types
![]() |
Database Concepts |
What is a Database | How a Database is Organized | Data Types | Normalization | Self Assessment | Summary & FAQs |
Contents
Data Types
Upon completion of this tutorial the learner will:
|
The basic data types
When designing a database table you will need to decide on the data type for each field. There are four primary data types available, they are;
- Text
- Numbers
- Date Time
- Binary
These data types then break down into more specific types within each primary type. For the OpenOffice Database the following types are available;
Text - character (and alphanumeric) data
- fixed - a fixed length string of text (or alphanumeric) characters
- varchar - a variable length string of text (or alphanumeric) characters
Numbers - numeric data
- Boolean - single digit representing either yes or no
- Integer - and integer or whole number (i.e. without decimal places)
- Float - a number with decimal places
Date Time date and time data
- Date - a character string specific for storing dates
- Time - a character string specific for storing time
- Date/Time (timestamp) - a field specifically designed to store a date and time stamp
Binary - large amounts of binary data
- Image - a large amount of binary data in the form of an image (i.e. gif, jpg, etc.)
- Memo - a large amount of text
- Binary - similar to an image field, used to store anything binary (i.e. mp3, ogg, avi, etc.)
It should be noted that this is not a full description of the available data types and how they can be used. It is the beginning of an extensive topic and beyond the scope of this course.
Mandatory and optional fields
When designing a database table you should always ask yourself if the field (or attribute) is mandatory or optional. In other words, can the field be left empty? The answer to this question varies from database to database depending on the information needs. An example would be a persons birth date; if the situation requires that decisions are made on the age of the person, then birth date would be a mandatory field. The other side of this issue would be when would you like a field to be optional? Answer: When not all data is available at time of data entry... Remember to give the mandatory and optional issue some thought as you build database tables.
test your knowledge