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.
- So Data modeling is simply the process of learning about the data, and the data model is the end result of the data modeling process
- Data modeling involves a progression from conceptual model to logical model to physical schema.
Data Model
A data model is a collection of conceptual tools for describing data, data relationships, data semantics, and consistency constraints.
Some of the most popular data models are explained below:
- Entity Relationship Model (ER)
- Relational Model
- Object-oriented Data Model
- Object-relational Data Model
Entity Relationship Model (ER)
- The entity–relationship (ER) model is a high-level data model based on perception of real world that consists of a collection of basic objects, called entities, and of relationships among these objects.
- It was developed to facilitate database design by allowing specification of an enterprise schema, which represents the overall logical structure of a database.
- The E-R data model employs three basic notions: entity sets, relationship sets, and attributes
- Entity sets:-
An entity is a “thing” or “object” in the real world that is distinguishable from all other objects.
The set of entities of the same type that share the same properties or attributes is Entity sets. Example, The set of all persons who are customers at a given bank can be defined as the entity set customer.
- Relationship sets:-
A relationship is an association among several entities and set of such relationships is known as relationship set.
Consider the two entity sets customer and loan. Relationship set borrower denotes the association between customers and bank loans.
- Attributes:-
Attributes are properties which describes each member of an entity set.
For example, an EMPLOYEE entity may be described by the employee’s name, age, address, salary, and job. A particular entity will have a value for each of its attributes and hence forms major part of data stored in database.
Relational Model
- The relational model is a lower-level model. It uses a collection of tables to represent both data and the relationships among those data.
- The relational model is today the primary data model for commercial data-processing applications.
- Structure of Relational database
- A relational database consists of a collection of tables, each of which is assigned a unique name. A row in a table represents a relationship among a set of values.
- A row in a table represents a relationship among a set of values. Since a table is a collection of such relationships, there is a close correspondence between the concept of table and the mathematical concept of relation, from which the
- A relational database consists of Database schema, Keys, Schema diagrams, and query language.
- The relational model consists of relational algebra as a procedural query language. It consists of a set of operations that take one or two relations as input and produce a new relation as their result.
- The fundamental operations in the relational algebra are select, project, union, set difference, Cartesian product, and rename.
- In addition to the fundamental operations, there are several other operations - namely, set intersection, natural join, division, and assignment.
Object-oriented Data Model
- The object-oriented data model is based on the Object-oriented paradigm introduced for database management.
- This model extends the representation of entities by adding notions like Inheritance, Encapsulation, Methods (functions), and Object identity. These key concepts of object-oriented programming have found application in data modeling.
- The object-oriented data model also supports a rich type system, including structured, collection types and complex types.
Object-relational Data Model
- The object-relational model combines features of the relational and object-oriented models. This model provides the rich type system of object-oriented databases, including complex data types, combined with relations as the basis for storage of data.
- It applies inheritance to relations, not just to types. The object-relational data model provides a smooth migration path from relational databases, which is attractive to relational database vendors.
- Relational query languages, in particular SQL, need to be correspondingly extended to deal with the richer type system.
- Thus, Object-relational database systems provide a convenient migration path for users of relational databases who wish to use object-oriented features.