Data Types

Data Types

Contents

TOC o “1-3” h z u Introduction PAGEREF _Toc381007150 h 1Data Types PAGEREF _Toc381007151 h 1Character Data type PAGEREF _Toc381007152 h 1Boolean data type PAGEREF _Toc381007153 h 2Integer data type PAGEREF _Toc381007154 h 2Float data types PAGEREF _Toc381007155 h 2String data type PAGEREF _Toc381007156 h 3

IntroductionData types are set of values and operations that are defined on those values. Various data types are supported by MYSQL. There are different data types which determine the operation, values, meaning of data, and how the values of the data type are stored. The paper will therefore summarize different data types and giving examples of each.

Data TypesBased on the variable of data types, the function of operating system is to allocate the memory and decide on what should be stored in the reserved memory. When different data types are assigned to variables, the integers, decimals, or characters which are example of data types can be stored in those variables. The common data types used includes; integers, Booleans, characters, floating-point numbers and strings ( Bidoit & Choppie,2005).

Character Data typeThe Char datatype specifies the fixed-length character string. The char data type is a single 16-bit Unicode character used to store any character where the minimum value is zero and the maximum value is about 65,535 inclusive. The values stored in the char column should have the length that is specified by the size. The examples of character datatype include; letters, for example; char letterA=’A’, Numerical digits as well as common punctuation marks. The notion also involves control characters that tend not to correspond to some natural language symbols, but responds to other bits of the information used in processing text in more languages.

Boolean data typeThe Boolean data type also known as logical data type is a type of data type that contains two values that are denoted to be true or false that represents the truth values of Boolean algebra. The Boolean data type only represents the one bit of information; however there are two possible values: TRUE and FALSE and are mainly used for the simple flags that can track true/false conditions, default value being False. An example of Boolean data type include; Boolean one=true.

Integer data typeIntegers are integral data type representing finite subsets of mathematical integers. They tend to be of different sizes and may either contain negative values or not. Integers are a group of binary digits when represented in a computer, but their sizes vary within those computers. The Int data type has 32-bit that are signed two’s complement integer, the minimum value being -2^31, and maximum value is 2^31-1, while default being 0. The Int is usually used for default data type representing integral values. An example of integer data type include: int a = 1000000, int b = – 2000000.

Float data typesFloat data types normally describes the methods used to represent the real numbers in order to support the wide ranges of values. Float data types are single-precision 32-bit floating point that is mainly used for saving the memory in larger arrays of the floating point numbers. The float data types cannot be used for précised values for example currency, because its default value is 0.0f. An example of float data type include: float f1 = 234.5f.

String data typeStrings are sequence of characters. They are understood to be data types that are implemented as bytes as well as an array which stores sequenced elements using character encoding. The string data types are stored as sequence of 16-bit (2-byte) unsigned numbers that ranges from 0- 65535, where each number assigned represents the single Unicode characters. Strings is able to contain about 2 billion Unicode characters (2^ 31) ( Bidoit & Choppie,2005).

References

Bidoit, M., & Choppie, C. (2005). Recent Trends in Data Type Specification: 8th Workshop on Specification. Retrieved October 16, 2012, from http://books.google.co.ke/books?id=FvQufud2P5EC&printsec=frontcover&dq=data+types&source=bl&ots=z4bREA2ckP&sig=CpLpJHbBkA5syNlN94FywWd9Pk&hl=en&sa=X&ei=7B99UOiSHsa90QXGjIGgBg&ved=0CDgQ6AEwAg

Variables. Data Types. – C++ Documentation. (n.d.). cplusplus.com – The C++ Resources Network. Retrieved October 16, 2012, from http://www.cplusplus.com/doc/tutorial/variables/