Common SQL Data Types Flashcards
NUMBER(L,D)
The declaration NUMBER(7,2) indicates numbers that will be stored with
two decimal places and may be up to seven digits long, including the sign
and the decimal place. Examples: 12.32, -134.99.
INTEGER
May be abbreviated as INT. Integers are (whole) counting numbers, so they
cannot be used if you want to store numbers that require decimal places.
SMALLINT
Like INTEGER but limited to integer values up to six digits. If your integer
values are relatively small, use SMALLINT instead of INT.
DECIMAL(L,D)
Like the NUMBER specification, but the storage length is a minimum
specification. That is, greater lengths are acceptable, but smaller ones are not.
DECIMAL(9,2), DECIMAL(9), and DECIMAL are all acceptable.
CHAR(L)
Fixed-length character data for up to 255 characters. If you store strings that
are not as long as the CHAR parameter value, the remaining spaces are left
unused. Therefore, if you specify CHAR(25), strings such as Smith and
Katzenjammer are each stored as 25 characters. However, a U.S. area code
is always three digits long, so CHAR(3) would be appropriate if you wanted
to store such codes.
VARCHAR(L) OR VARCHAR2(L)
Variable-length character data. The designation VARCHAR2(25) will let you
store characters up to 25 characters long. However, VARCHAR will not leave
unused spaces. Oracle automatically converts VARCHAR to VARCHAR2.
DATE
Stores dates in the Julian date format.