Please send your Questions & Answers or Feedback to "mohan@javabook.org"

What are the Basic data types in SQL ?

char(n): Fixed-length character data (string), n characters long. The maximum size for n is 255 bytes (2000 in Oracle8). Note that a string of type char is always padded on right with blanks to full length of n. (+ can be memory consuming).

Example: char(40),varchar2(n): Variable-length character string. The maximum size for n is 2000 (4000 in Oracle8).

Only the bytes used for a string require storage. Example: varchar2(80)

 number(o, d): Numeric data type for integers and reals. o = overall number of digits, d = number of digits to the right of the decimal point.

Maximum values: o =38, d= ??84 to +127. Examples: number(8), number(5,2)

Note that, e.g., number(5,2) cannot contain anything larger than 999.99 without resulting in an error. Data types derived from number are int[eger], dec[imal], small int and real.

date: Date data type for storing date and time.

The default format for a date is: DD-MMM-YY. Examples: '13-OCT-94', 07-JAN-98'

long: Character data up to a length of 2GB. Only one long column is allowed per table.

Related Posts Plugin for WordPress, Blogger...
Flag Counter