- DB2 - LDAP
- DB2 - Roles
- DB2 - Database Security
- DB2 - Backup and Recovery
- DB2 with XML
- DB2 - Views
- DB2 - Sequences
- DB2 - Triggers
- DB2 - Indexes
- DB2 - Constraints
- DB2 - Alias
- DB2 - Tables
- DB2 - Data Types
- DB2 - Schemas
- DB2 - Storagegroups
- DB2 - Tablespaces
- DB2 - Bufferpools
- DB2 - Databases
- DB2 - Instance
- DB2 - Server Installation
- DB2 - Introduction
- Home
DB2 Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
DB2 - Data Types
This chapter introduces various data types used in DB2.
Introduction
In DB2 Database tables, each column has its own data type depending on developer’s requirements. The data type is said to be type and range of the values in columns of a table.
Built-in data types
Datetime
TIME: It represents the time of the day in hours, minutes and seconds.
TIMESTAMP: It represents seven values of the date and time in the form of year, month, day, hours, minutes, seconds and microseconds.
DATE: It represents date of the day in three parts in the form of year, month and day.
String
Character
CHAR (fixed length): Fixed length of Character strings.
Varying length
VARCHAR: Varying length character strings.
CLOB: large object strings, you use this when a character string might exceed the pmits of the VARCHAR data type.
Graphic
GRAPHIC
Fixed length: Fixed length graphic strings that contains double-byte characters
Varying length
VARGRAPHIC: Varying character graphic string that contains double bye characters.
DBCLOB: large object type
Binary
BLOB (varying length): binary string in large object
BOOLEAN: In the form of 0 and 1.
Signed numeric
Exact
Binary integer
SMALLINT [16BIT]: Using this you can insert small int values into columns
INTEGER [32BIT]: Using this you can insert large int values into columns
BIGINT [64BIT]: Using this you can insert larger int values into columns
Decimal
DECIMAL (packed)
DECFLOAT (decimal floating point): Using this, you can insert decimal floating point numbers
Approximate
Floating points
REAL (single precision): Using this data type, you can insert single precision floating point numbers.
DOUBLE (double precision): Using this data type, you can insert double precision floating point numbers.
eXtensible Mark-up Language
XML: You can store XML data into this data type column.