2.3.1 Relational Data Model
A data model is like a blueprint for developing a database. It describes the structure of the database and various data relationships and constraints on the data. This information is used in building Tables and keys and defining relationships. A relational model implies that a user perceives the database as made up of relations, database jargon for Tables. It is imperative that all data elements in the Tables be represented correctly. In order to achieve these goals, designers use various tools. The most commonly used tool is the entity-relationship model. A well-planned model will give consistent results and allow changes if needed later on. The following section further elaborates on the ER model.
2.3.2 Entity-Relationship (ER) Model
The ER model was first proposed and developed by Peter Chen in 1976. Since then, Charles Bachman and James Martin have added some refinements. The model was designed to communicate the database design in the form of a conceptual schema. The ER model is based on the perception that the real world is made up of entities, their attributes and their relationships. The ER model is graphically depicted as entity-relationship diagrams (ERDs). ERDs are a major modeling tool; they graphically describe the logical structure of the database. ER diagrams can be used with ease to construct relational Tables and are a good vehicle for communicating the database design to the end user or a developer. The three major components of ERD are entities, relationships and attributes. Entities: An entity is a data object, either real or abstract, about which we want to collect information. For example, we may want to collect information about a person, a place or a thing. An entity in an ER diagram translates into a Table. It should preferably be referred to as an entity set. Some common examples are departments, courses and students. A single occurrence of an entity is an instance. There are four entities in the CSE _ DEPT database, LogIn, Faculty, Course and Student. Each entity is translated into a Table with the same name. An instance of the Faculty entity is Alice Brown and her attributes.
Relationships: A database is made up of related entities. There is a natural association between the entities; it is referred to as a relationship. For example,
- Students take courses
- Departments offer certain courses
- Employees are assigned to departments
The number of occurrences of one entity associated with single occurrence of a related entity is referred to as cardinality.
Attributes: Each entity has properties or values called attributes associated with it. The attributes of an entity map onto fields in a Table. Database Processing is one attribute of an entity called Courses. The domain of an attribute is a set of all possible values from which an attribute can derive its value.