- DB2 Tutorial
- Home
- DB2 - Introduction
- DB2 - Server Installation
- DB2 - Instance
- DB2 - Databases
- DB2 - Bufferpools
- DB2 - Tablespaces
- DB2 - Storagegroups
- DB2 - Schemas
- DB2 - Data Types
- DB2 - Tables
- DB2 - Alias
- DB2 - Constraints
- DB2 - Indexes
- DB2 - Triggers
- DB2 - Sequences
- DB2 - Views
- DB2 with XML
- DB2 - Backup and Recovery
- DB2 - Database Security
- DB2 - Roles
- DB2 - LDAP
- DB2 Useful Resources
- DB2 - Questions and Answers
- DB2 - Quick Guide
- DB2 - Useful Resources
- DB2 - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 limits 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.
Advertisements