Data Modeling Basics | Database Management System

Data Modeling Basics |  Database Management System

Data Modeling Basics : A DBMS is used to store information regarding an organization/institute etc. In order to represent information some kind of mapping or modeling is required so that the things which are happening in can be simulated and stored in a computer database.

A model is an abstraction process that hides extra details and represents only the essential one modeling is used for representing entities of interest and their relationships in the database.

Over the period of time, number of data models have been developed, but as with progra languages, there is no one perfect choice.

The purpose of all the models is the model or map the real world situation in terms of entities on relationships which can be stored in the database.

Some popular data models are:

  • Hierarchical Model
  • Network Model
  • Relational Model

The hierarchical model: The data is sorted hierarchically, using a downward tree. This model use pointers to navigate between stored data. It was the first DBMS model.

The hierarchical model was developed by IBM in 1968.

The data is organize in a tree structure where the nodes represent the records and the branches of the tree represent the fields. Since the data is organized in a tree structure, the parent node has the links to its child nodes. If we want to search a record, we have to traverse the tree from the root through all its parent nodes to reach the specific record. Thus, searching for a record is very time consuming. The hashing function is used to locate the root. SYSTEM2000 is an example of hierarchical database.

The network model : Like the hierarchical model, this model uses pointers toward Stored data. However, it does not necessarily use a downward tree structure.

Record relationship in the network model is implemented by using pointers. Record relationship implementation is very complex since pointers are used. It supports many-to-many relationships and simplified searching of records since a record has many access paths. DBTG Codasyl was the first network database.

The relational model (RDBMS, Relational database management system) : The data is stored in two-dimensional tables (rows and columns). The data is manipulated based on the relational theory of mathematics. The Relational Model, organizes data in the form of independent tables (consisting of rows and Columns) that are related to each other. A table consists of a number of rows (records/tuples) and Columns (attributes). Each record contains values for the attributes. The degree of the table denotes the number of columns.

A domain in the relational model is said to be atomic is it consists of indivisible units. For example, name is not atomic since it can be divided into first name and last name.

E.F. Codd laid down 12 rules (known as Codd’s 12 rules) that outline the minimum functionality of a RDBMS, ARDBMS must comply with at least 6 of the rules.

Before getting into details about any particular let us learn some terms which are common to all models.

The analysis of data objects and their relationships to other data objects is known as Data modeling. Data modeling is often the first step in database design and object-oriented programming as the designers first create a conceptual model of how data items relate to each other. Data modeling involves a progression from Conceptual model to logical model to physical Schema.

Database Model: A real world situation can be modeled in a database and A database can be modeled as :

  • A Collection of entities
  • Set of relationships among such entities.

Entity: Entities are distinguished objects in the system. It is a “thing” or “object” or a “concept” in a real world that is distinguishable from all other objects. Anything about which we store information is called an entity. An entity is an object that exists and is distinguishable from other objects.

For example: A Student, An employee, a bank account, a Course, a product etc. all are entities.

Attributes: Are the specific characteristics of an entity. Entities have attributes. They are descriptive properties possessed by an entity. For eg. Name, age, city are attributes of student. Similarly Account Number, Balance, Type are the attributes or properties of a bank account.

Entity set: is a set of entities of the same type that share the same properties.

Example: Set of all persons, Companies, trees, holidays

Relationship: it defines a association among a given set of entity types. For example a Student entity “registers” in a course entity. Here register is an association or relation between student entity and course entity.

Relationship Set: A Collection of similar types of relationships.

For example: List of all registrations in different Courses.

A relationship set is a set of relationships of the same type. Formally it is a mathematical relation on n > 2 (possibly non-distinct) sets. If E, E, , …, E, are entity sets, then a relationship set R is a subset of {k、…c,}k =E、F =F。…c,=F,} where (C,C,…, C.) is a relationship. For example, consider the two entity -z customer and account. We define the relationship CustAcct to denote the association between customers and their accounts. This is a binary relationship set. Going back to our formal definition, the relationship set CustAcct is a subset of all the possible customer and account pairings. This is a binary relationship. Occasionally there are relationships involving more than two entity sets. The role of an entity is the function it plays in a relationship. For example, the relationship works-for could be ordered pairs of employee entities. The first employee takes the role of manager, and the second One will take the role of Worker. A relationship may also have descriptive attributes. For example, date (last date of account access) could be an attribute of the CustAcct relationship set.

Relationship Types:

There are three types of relationships:

  • One-to-One
  • One-to-many (or many-to-One)
  • Many-to-many

Consider the example of a university. For a particular DEPARTMENT (like the department of social sciences) there can be only one DEPARTMENT HEAD. This is an example of a one-to-one relationship.

A STUDENT can MAJOR in only one course, but many STUDENTS would have registered for a given MAJOR course. This is an example of many-to-one relationship.

A STUDENT can take many COURSE and many STUDENTS can register for a given COURSE. This is an example of many-to-many relationship.

The types of relationships between two entities are represented in E/R diagrams by certain symbols. An entity may be associated with one, none, or many occurrences of another entity.