Unit 09 – Database Concepts
9.2.1 Database Models
1
What is a Data Model
Data model describes the relation between different parts of
data.
Different Data Models
1. Flat data Model
2. Hierarchical Model
3. Network Model
4. Relational Model
2
Hierarchical Model
• Data are organized in an upside down tree.
• Only one parent and many children.
3
Network Model
• Data are organized in a graph.
• Can be accessed through several paths.
4
Relational Model
• Data are organized in two dimensional tables (relations).
• Tables are related to each other
5
Row is called a ‘Tuple’.
Column header is called an ‘Attribute’.
Table is called a ‘Relation’.
6
Primary Key
A primary key is used to uniquely identify all
table records.
A primary key’s main features are:
It must contain a unique value for each row
of data.
It cannot contain null values (Empty values).
7
Foreign Key
A foreign key is used to create the link
between two tables.
A Primary key of one table, is the foreign key
to other table.
A Foreign key’s features are:
It can contain duplicate data.
It cannot contain null values (Empty values).
8
Primary Key
9
ER Diagram
This is known as Entity Relationship
Diagram.
This shows the relation of Entities.
ER diagram is the design of the Database.
10
Entity
An entity can be place, person, object, event
or a concept, which stores data in the
database.
Entity name should be in Singular form.
Ex:- Student , Employee, Course
Student
11
Attribute
Properties or characteristics of an entity.
This describes the entity.
Ex :- Name, Age, Address can be attributes
of the student entity.
Attribute
12
Sample ER Diagram
13
Lesson Summary
What is a Data Model
Types of Data Models
What is a Primary Key
What is a Foreign Key
ER Diagram
Entity
Attribute
14