Beruflich Dokumente
Kultur Dokumente
Database Models
File system
Hierarchical Model (IMS) Network Model (IDMS) Relational Model Nested Relational Model Entity-Relationship Approach Object-Oriented Data Model Deductive and Object-Oriented Database Semi-structured Data Model (XML data)
2
CS4221: Hierarchical and Network Models
1. Hierarchical Model
IMS (Information Management System) Data Model
(IBM product) Ref: CJ Dates book
root segment
COURSE COURSE# TITLE DESCRIPTION
TEACHER
STAFF#
Fig. 1. PDBR (physical database record) type for the education database (schema)
3
CS4221: Hierarchical and Network Models
(cont.)
TEACHER 421633 Sharp, R. 183009 102141 761620 Tallis, T. A B B STUDENT STUDENT STUDENT
Gibbons, O. Byrd, W.
Fig. 2. Sample PDBR occurrence for the education database (database instance) Note: IMS is a hierarchical database model. It is similar to (but not
Many-to-many relationships in hierarchical structure will contain redundant data IMS removes redundant data using logical parent pointers
5
CS4221: Hierarchical and Network Models
Note: The same type of birds may appear in different areas, so the relationship between AREA and SIGHTING is a m:m relationship. The SNAME and BDESCN of a bird BNAME will be replicated under different areas.
Fig. 3.
To remove redundant data, we first create another database to store the information of birds as shown below:
BIRD BNAME SNAME BDESCN
Fig. 4.
Fig. 5.
Fig. 6.
8
CS4221: Hierarchical and Network Models
A1
Chaffinch
Cuckoo
Swallow A2
A3
Wren
physical pointers
9
CS4221: Hierarchical and Network Models
A2
A3
2. Network Model
Network Model was proposed by DBTG (Database Task Group) in 1971.
Ref: CJ Dates book.
DEPT D2 DEPT D1 EMP
DEPARTMENT DEPARTMENT DEPARTMENT
EMP E4
pointer
EMP E13
EMP E16
set name
DEPTEMP
or
EMP
DEPTEMP
EMP
Note: A set is a 1:m relationship from owner to member. E.g. a dept has many employees and each employee only works for one dept.
12
CS4221: Hierarchical and Network Models
DIV V2 DIVDEPT
DEPTMEP
DIVDEPT DEPT
DEPTEMP EMP
EMPCOURSE
COURSE
EMPJOB
COURSE M19
(cont.)
EMPJOB
EMPCOURSE
JOB
COURSE
16
CS4221: Hierarchical and Network Models
Many-to-many relationship
E.g. part and supplier relationship.
Note: Network model cannot represent m:m relationships directly. A m:m relationship can be simulated by two 1:m relationships and a dummy record type (e.g. SP in Fig 15). Not a very nice solution!
S P
S-SP SP
P-SP
17
CS4221: Hierarchical and Network Models
Many-to-many relationship
s2 Jones 10 Paris s4 Clark 20 London S-SP SP s2 P1 300 P-SP p P1 Nut Red 12 London SP s2 P2 400 P-SP p P2 Bolt Green 17 Paris p P4 Screw Red 14 London SP s4 P2 200 S-SP SP s4 P4 300 P-SP p P5 Cam Blue SP s4 P5 400 P-SP
(cont.)
12 Paris
Fig. 16. A suppliers-and-parts database instance Q: How to represent 1:1 relationships? N-ary relationships?
18
CS4221: Hierarchical and Network Models