1. Computing
Send to a Friend via Email

Understanding how SQL databases work


4 of 4

SQL Data Types
Each column can only contain one type of data which we must define. An example of what this means is; in our age column we use a number. We could not change Kelly's entry to "twenty-six" if we had defined that column to be a number. The main data types are numbers, date/time, text, and binary. Although these have many subcategories, we will just touch on the most common types that you will use in this tutorial.

INTEGER- This stores whole numbers, both positive and negative. Some examples are 2, 45, -16 and 23989. In our example, the age category could have been integer.

FLOAT- This stores numbers when you need to use decimals. Some examples would be 2.5, -.664, 43.8882, or 10.00001.

DATETIME- This stores a date and time in the format YYYY-MM-DD HH:MM:SS

VARCHAR- This stores a limited amount of text or single characters. In our example, the name column could have been varcar (short for variable character)

BLOB- This stores binary data other than text, for example file uploads.

©2014 About.com. All rights reserved.