for storing, managing and retrieving data into a database, there are multiple models that can be followed.

Models are –

1. HR model

2. N-Model

3. ER Model

4. R-Model

Let’s discuss them in detail..

1. HR(Hierarchical) Model – In this model, there is only one root node(parent node) and many child nodes interlinked together. In this model, we can store data using a tree structure.

Applications – organization members’ architecture

diagram – HR model

2. N(Network) Model – In this model, there can be more than one root node. Using this model, we can store data using a peek-to-peer architecture.

Applications – building computer network system

diagram: N Model

3. ER(Entity Relationship Model) Model – This is basically a model which needs to be implemented further. Here we get many things like entity, entity set, relationships etc. Using these things we can draw any complex system architecture.

Entity – Entity is an object in the system which we model and it stores attributes of it. On the basics of real world existence, we can divide an entity into two parts – a. Tangible Entity b. Intangible Entity

a. Tangible Entity – This type of entity has logical and physical existence. Ex – animal, person, bird, car etc.  

b. Intangible Entity – This type of entity has only logical but not any physical existence. Ex – Bank account

Relationships – Within two or more entities we can perform relations. There are some signs using which we can make relations between entities.

image: source : O’reilly Media

Common relationships – a. Unary relationship b. Binary relationship c. N-ary relationship

a. unary relationship – in this relationship only one entity relation.

b. binary relationship – two entities connected with one relationship.

c. n-ary relationship – many entities connected with one relationship.

Let’s understand this all using below image –

image : relationships

attributes – these are properties which contain values which are related to an entity.

Ex – a student is an entity, but student’s name, phone number, address, roll no these are the attributes of this student entity.

There have many type of attributes –

i. Simple attribute – Simple attributes are atomic values, which cannot be divided further. Ex – DOB(Date Of Birth) of student

ii. Composite attribute – this type of attribute can be divided further. Ex – a name of a student, let’s say, a student name – Nishant Kumar Jha. So we can divide this whole name into three parts – first name=nishant, middle name = kumar , last name = jha.

iii. Single value attribute – this type of attribute has only one and unique value. Ex – AADHAR number(india only) has a one and unique number for any citizen in India. It can’t be duplicated.

iv. Multi value attribute – this type attribute has multiple values. Ex – phone number of any student. A student has many phone numbers like father’s mobile number, mother’s mobile number etc.

v. Derived attribute – this type of attribute gets derived from another attribute. Ex – age of student. By using a student’s DOB(date of birth) its age can be identified.

4. R(Relational) Model – This model is the most widely used model in the world right now for any RDBMS. In this model, data basically stores in the form of table (relation). Basically data stores within a table by row and column major.

Applications – bank database, university database etc.

Here we will find many things. Below image is an image of R-Model.


lets understand some important concepts

a. Table – it’s a collection of rows and columns. Rows basically treated as records and columns treated as attributes. In RDBMS tables are treated as ‘relation’.

b. Tuples – when we select any particular row or record from a table, it’s known as tuple.

c. attribute – actually a table’s column name is treated as an attribute in RDBMS. Basically in RDBMS a table’s column name is also treated as an attribute name.

c. fields – In RDBMS any table’s column is treated as fields. Fields are a set of attribute’s values.

d. degree – number of attributes(columns)

e. cardinality – number of tuples(rows).

Let’s say, if we have a table of 12 rows and 5 columns, then degree = 12; cardinality = 5.

table – student

Schema – Schema is a logical representation of data in RDBMS. From above table example, table schema – table(id,name,roll,sec).

Let’s say we want to make a ‘employee’ table,then what will be the schema for that ?

Ans – table ‘employee’ can have multiple attributes – emp_no,emp_name,phone,location etc.

So its schema will look like

table – employee