首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 冲浪宝典 > 网络资源 > DB2 Data Type and Attribute
【标  题】:DB2 Data Type and Attribute
【关键字】:DB2,Data,Type,and,Attribute
【来  源】:http://www.cublog.cn/u/2879/showart.php?id=156438

DB2 Data Type and Attribute

在规划DB2数据库的时候,在参加一些考试的时候,可能会需要计算一下数据可能存储的空间。下面是我笔记中的相关内容。
*********************************
Numeric Data Types
*********************************
Small integer:
−32,768 to 32,767
2 bytes of storage space
SMALLINT

Integer:
−2,147,483,648 to 2,147,483,647
4 bytes of storage space
INTEGER and INT

Big integer:
−9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
8 bytes of storage space
BIGINT

Decimal:
The maximum precision allowed for decimal values is 31 digits
Precision ÷ 2 (truncated) + 1 = Bytes required. (For example, the value 67.12345 has precision of 7, 7 ÷ 2 is 3, + 1 makes 4; therefore, 4 bytes are required to store the value 67.12345.)
DECIMAL, DEC, NUMERIC, and NUM

Single-precision floating-point:
−3.402E+38 to −1.175E-37 or 1.175E-37 to 3.402E+38. (is used to store a 32-bit approximation of a real number.)
Each single-precision floating-point value can be up to 24 digits in length
4 bytes of storage space
REAL and FLOAT

Double-precision floating-point
−1.79769E+308 to −2.225E-307 or 2.225E-307 to 1.79769E+308. (used to store a 64-bit approximation of a real number. )
Each double-precision floating-point value can be up to 53 digits in length
8 bytes of storage space
DOUBLE, DOUBLE PRECISION, and FLOAT

*********************************
Character String Data Types
*********************************
Fixed-length caracter string:
between 1 and 254 characters in length
(Number of characters × 1) = Bytes required
CHARACTER and CHAR

Varying-length character sting:
up to 32,672 characters in length
tablespaces that use 4K pages, varying-length character string values cannot be more than 4,092 characters in length; for tables that reside in a tablespaces that use 8K pages, varying-length character string values cannot be more than 8,188 characters in length, and so on.
(Number of characters × 1) + 4 = Bytes required.
CHARACTER VARYING, CHAR VARYING, and VAR-CHAR

Fixed-length double-byte character string:
up to 127 characters in length
(Number of characters × 2) = Bytes required
GRAPHIC

Varying-length double-byte character string:
up to 16,336 characters in length
For tables that reside in tablespaces that use 4K pages, varying-length double-byte character string values cannot be more than 2,046 characters in length; for tables that reside in a tablespaces that use 8K pages, varying-length double-byte character string values cannot be more than 4,094 characters in length; and so on.
(Number of characters × 2) + 24 = Bytes required
LONG VARGRAPHIC

*********************************
Date/Time Data Types
*********************************
Date:
The range for the year portion is 0001 to 9999; the range for the month portion is 1 to 12; and the range for the day portion is 1 to 28, 29, 30 or 31
10 characters in length
4 bytes of storage space
DATE

Time:
The range for the hours portion is 0 to 24; the range for the minutes portion is 0 to 59; and the range for the seconds portion is 0 to 59.
8 characters in length
3 bytes of storage space
TIME

Timestamp:
The range for the year portion is 0001 to 9999; the range for the month portion is 1 to 12; and the range for the day portion is 1 to 28, 29, 30 or 31
the range for the hours portion is 0 to 24; the range for the minutes portion is 0 to 59; the range for the seconds portion is 0 to 59; and the range for the microseconds portion is 0 to 999,999.
26 characters in length
10 bytes of storage space
在RedHat AS4下安装DB2 V8.2:【上一篇】
restore (重定向恢复数据库):【下一篇】
【相关文章】
  • 在RedHat AS4下安装DB2 V8.2
  • qmHandle(新加的指令)
  • 关于contentType 和 pageEncoding 的差异和 中文JSP页的技巧
  • 隐藏类的实现细节:Handle类和Protocol类(一)
  • 隐藏类的实现细节:Handle类和Protocol类(二)
  • [原创]DB2 db2move备份脚本
  • hp va7XX0 command list
  • Linux Device Drivers学习笔记2--Chapter.2 Building and Running Modules
  • torque游戏引擎DTS文件的LOD实现(含reflection反射材质演示)-The LOD and reflection in DTS files
  • 关于DataGridView中如何接收处于编辑状态下的当前信息
  • 【随机文章】
  • 细细谈超频
  • 四类设计人员
  • FTP 肉鸡制作
  • 用Pline绘制齿轮
  • UI线程外UpdateData还是要小心
  • C++中接口与实现分离的技术
  • ASP生成静态Html文件技术杂谈
  • 网络安全linux
  • Google工具栏’About’跨站脚本执行漏洞
  • myshell
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.