Database Data Types
It’s important to specify the right data types for your database fields because the computer needs to know what type of values they can store, and which operations can be successfully performed using it.
Failure to use the correct database data types may result in you losing the ability to perform sorts, calculations and complex searches using the data.
When using a database, a student’s date of birth should be stored as a date/time data type.
Doing so will allow the students to be sorted into DOB order, their age to be calculated, or complex searches to be carried out based on their age, month or year of birth etc.
Now, here is the issue. The database would actually allow you to store student date of births as a text data type, and it would initially all look fine.
The difficulties would happen later on when you tried to perform sorts, searches or calculations based on the student DOB, they wouldn’t work properly and at this point you may have entered hundreds of students!
It’s always better to choose the correct data type right from the beginning.
Common data types
|Date and/or time
|Yes/No, True/False, On/Off (two options only)
|Automaticly generated number
|A number formatted to a currency of choice