Professional Documents
Culture Documents
By – Aditi Agrawal
Branch – CS C
En. No. - 120198
1 11/4/2015
Contents
• Introduction
• Current Editions
• LUW Editions
• System Architecture
• DB2 Interface
• DB2 Objects
• Storage Groups
• Database
• Tablespace
• Table
• Data types
2 11/4/2015
Content(Cont.)
• Null
• Index
• Referential Integrity
• Referential Integrity - Keys
• References
3 11/4/2015
Introduction
What is DB2?
• Developed by IBM.
• An abbreviation for ‘IBM Database 2’.
• Introduced in June 1983.
• Support the relational model.
• Platform-specific DB2 product.
• Supports SQL.
• Latest version of DB2 is DB2 10.5.
4 11/4/2015
Current Editions
There are 4 products in DB2 family –
• DB2 for Linux, UNIX and Windows (informally known as DB2 LUW).
• DB2 for z/OS (mainframe).
• DB2 for i (formerly OS/400).
• DB2 for VM / VSE.
5 11/4/2015
LUW Editions
IBM has changed the packaging structure in the latest release of DB2
for Linux, Unix and Windows and now offers seven editions –
6 11/4/2015
System Architecture
Major Components of DB2 –
7 11/4/2015
DB2 Interface
8 11/4/2015
DB2 Objects
• Objects that describe the data in the way, users and developers
think about it, are called logical objects.
For example - tables, and views.
• Objects that refer to the way, data is actually stored in the system,
are called physical objects.
For example - database and table space.
9 11/4/2015
DB2 Objects
10 11/4/2015
DB2 Objects Hierarchy
11 11/4/2015
Storage Groups
CREATE STOGROUP SG
VOLUMES (V1,V2,V3);
12 11/4/2015
Storage Groups - (Cont.)
13 11/4/2015
Database
14 11/4/2015
Creating a Database
• To create a database use
CREATE DATABASE DB
STOGROUP SG
BUFFERPOOL (BP0, BP32);
15 11/4/2015
Tablespace
16 11/4/2015
Creating a TS
CREATE TABLESPACE TS
IN DB
PRIQTY 10000
SECQTY 1000
PCTFREE 10
FREEPAGE 63
LOCKSIZE ANY
BUFFERPOOL BP0
SEGSIZE 64
17 11/4/2015
More on TS
18 11/4/2015
Table
19 11/4/2015
More on Table
• To remove a table
DROP TABLE EMPLOYEE;
• To change the definition
ALTER TABLE EMPLOYEE
20 11/4/2015
Data types
• Integer
– 4 bytes (5 if nullable)
• Small int
– 2 bytes (3 if nullable)
• Char(n)
– max. 254 bytes
• Varchar(n)
– max. 4046 bytes
• Time
– 3 bytes (4 if nullable)
• Date
– 4 bytes (5 if nullable)
21 11/4/2015
Data types - (Cont.)
22 11/4/2015
Null
23 11/4/2015
Index
24 11/4/2015
Index
25 11/4/2015
More on Index
• To remove an index
DROP INDEX IDX;
26 11/4/2015
Referential Integrity
27 11/4/2015
Referential Integrity - Keys
• Unique Key
28 11/4/2015
Referential Integrity - Keys
• Primary Key
• Foreign Key
29 11/4/2015
References
• http://en.wikipedia.org/wiki/IBM_DB2
• http://www-03.ibm.com/software/products/en/db2zos
• http://www-01.ibm.com/software/data/db2/linux-unix-windows/
• http://www.cs.umd.edu/class/spring2002/cmsc434-
0101/MUIseum/applications/db2.html
• http://www.webopedia.com/TERM/D/DB2.html
• http://searchdatacenter.techtarget.com/definition/DB2
30 11/4/2015
31 11/4/2015