Page 256 - Information_Practice_Fliipbook_Class11
P. 256
Below we describe some important data types:
1. Numeric: The following data types may be used to specify that an attribute can contain numeric data:
a. INT or INTEGER: The datatype INT is used for specifying 32-bit integers. For example, the attribute
Salary of an employee may be of type INTEGER.
Examples of type INT
Valid
0
-0
1234
1234567890
-1234567890
123.45 (digits to the right of the decimal point are truncated)
Invalid
1,23,456 (punctuation characters not allowed)
29-01-22 (punctuation characters not allowed)
-2147483649 (beyond valid range)
2147483648 (beyond valid range)
98765432100.1234 (beyond valid range)
INT or INTEGER: 32-bit integer.
b. SMALLINT: The data type SMALLINT is used to store small integers (typically 16-bit integers). For example,
the attribute Dept_No of the department may be of type SMALLINT.
Examples of type SMALLINT
Valid
0
-0
1234
-32768
32767
123.45 (digits to the right of the decimal point are truncated)
Invalid
1,23,456 (punctuation characters not allowed)
29-01-22 (punctuation characters not allowed)
-32769 (beyond valid range)
32768 (beyond valid range)
987654321.1234 (beyond valid range)
SMALLINT: Typically 16-bit integer.
c. DECIMAL(L, D): It is used to denote a fixed point decimal. The arguments L and D denote the maximum
number of digits and number of digits to the right of the decimal point, respectively. For example, attribute
type DECIMAL(6,2) indicates that the attribute values may lie in the interval [-9999.99, 9999.99].
When the value of an attribute of DECIMAL type lies outside its limits, the effect is system defined.
242 Touchpad Informatics Practices-XI

