A database model is a collection of toos for describing data, data relationships, data semantic and consistency constraints.
Underlying the structure of a database is the data model: a collection of conceptual tools for describing data, data relationships, data semantics, and consistency constraints.
To illustrate the concept of a data model, we outline two data models in this section: the entity-relationship model and the relational model. Both provide a way to describe the design of a database at the logical level.
They can be broadly classified into the following categories:
Conceptual database models.
Physical database models.
Logical database models.
The Entity-Relationship Model
The entity-relationship (E-R) data model is based on a perception of a real world that consists of a collection of basic objects, called entities, and of relationships among these objects.
An entity is a “thing” or “object” in the real world that is distinguishable from other objects. For example, each person is an entity, and bank accounts can be considered as entities.
A relationship is an association among several entities. For example, a depositor relationship associates a customer with each account that she has.
The set of all entities of the same type and the set of all relationships of the same type are termed an entity set and relationship set, respectively.
The overall logical structure (schema) of a database can be expressed graphically by an E-R diagram.
The relational model uses a collection of tables to represent both data and the relationships among those data. Each table has multiple columns, and each column has a unique name.
The data is arranged in a relation which is visually represented in a two dimensional table.
The data is inserted into the table in the form of tuples (which are nothing but rows).
A tuple is formed by one or more than one attributes, which are used as basic building blocks in the formation of various expressions that are used to derive a meaningful information.
There can be any number of tuples in the table, but all the tuple contain fixed and same attributes with varying values.
The relational model is implemented in database where a relation is represented by a table, a tuple is represented by a row, an attribute is represented by a column of the table, attribute name is the name of the column such as ‘identifier’, ‘name’, ‘city’ etc., attribute value contains the value for column in the row.
The relational model represents the database as a collection of relations. Informally, each relation resembles a table of values or, to some extent, a flat file of records
It is called a flat file because each record has a simple linear or flat structure.
However, there are important differences between relations and files, as we shall soon see.
When a relation is thought of as a table of values, each row in the table represents a collection of related data values