intro |  html |  css |  design |  scripting |  dhtml |  server 


Brief Overview of Data Types

All data is of one type or another. If you haven't had any programming, you might not already know this. For example, "I like this website" is a phrase made up of alphabetic characters - it is a character string. "41" is an integer. "43.345" is a floating point number. Integer and float are also types.

In PHP and ASP, you do not have to declare the data types of your variables. However it's important to know when creating your databases because you do have to assign types to columns. The following will list some of the more frequently used column types.

Column Types for MySQL (not a comprehensive list):

M: indicates maximum display size (legal max is 255)
D: applies to floating point types - number of digits following decimal (max is 30)

Type Description
VARCHAR (M) variable length character string (max length is 1-255)
CHAR (M) fixed length string (max length is 1-255)
TEXT or BLOB max length of 65535 (2^16 - 1) characters
TINYINT small integer. Signed range is -128 to 127. Unsigned range is 0 to 255.
SMALLINT (M) Small integer. Signed range is from -32768 to 32767. Unsigned range from 0 to 65535.

Go to the site for a comprehensive list of acceptable column types and additional details.

Column Types for ASP (not a comprehensive list):

Type Description
Text Text field, max 255 characters or length set by FieldSize property
Memo Text field, up to 65535 characters
Number Numeric data used in mathematical calculations
Currency Currency and/or numerica data used in calculations involving data with 1-4 decimal places. Accurate to 15 digits on left side of decimal and to 4 on right. (Equiv to float, but much less precise).


Signed integer: ranges from negative to positive

Unsigned integer: ranges from 0 to positive values © 1999-2011. all rights reserved. // site created and maintained by kathy ahn