View of Data
A database system is a collection of interrelated data and a set of programs
that allow users to access and modify these data. A major purpose of a database
system is to provide users with an abstract view of the data where the system
hides certain details of how the data is stored and maintained.
Data Models
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.
A data model provides a way to describe the design of a database at the
physical, logical, and view levels.
The data models can be classified into four different categories:
Relational Model
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. Tables are also known as relations. The
relational model is an example of a record-based model.
Record-based models are so named because the database is structured in
fixed-format records of several types. Each table contains records of a
particular type. Each record type defines a fixed number of fields, or attributes.
The columns of the table correspond to the attributes of the record type. The
relational data model is the most widely used data model, and a vast majority of
current database systems are based on the relational model.
Entity-Relationship Model
The entity-relationship (E-R) data model uses a collection of basic objects, called
entities, and relationships among these objects.
An entity is a “thing” or “object” in the real world that is distinguishable
from other objects. The entity-relationship model is widely used in database
design.
Object-Based Data Model
Object-oriented programming (especially in Java, C++, or C#) has become the
dominant software-development methodology. This led to the development of
an object-oriented data model that can be seen as extending the E-R model
with notions of encapsulation, methods (functions), and object identity. The
object-relational data model combines features of the object-oriented data
model and relational data model.
Database Management System Abhishek Shukla
Semi-structured Data Model
The semi-structured data model permits the specification of data where
individual data items of the same type may have different sets of attributes.
This is in contrast to the data models mentioned earlier, where every data item
of a particular type must have the same set of attributes. The Extensible Markup
Language (XML) is widely used to represent semi-structured data.
There were two more models as network data model and the hierarchical data
model preceded the relational data model.
Data Abstraction
For the system to be usable, it must retrieve data efficiently. The need for
efficiency has led designers to use complex data structures to represent data
in the database. Since many database-system users are not computer
trained, developers hide the complexity from users through several levels of
abstraction, to simplify users’ interactions with the system:
Levels of Abstraction in a DBMS
• Physical Level (or Internal View / Schema): The lowest level of abstraction
describes how the data i s actually stored. The physical level describes complex
low-level data structures in detail.
• Logical Level (or Conceptual View / Schema): The next-higher level of
abstraction describes what data is stored in the database, and what
relationships exist among those data. The logical level thus describes the
entire database in terms of a small number of relatively simple structures.
• View Level (or External View / Schema): The highest level of abstraction
describes only part of the entire database. Even though the logical level uses
simpler structures, complexity remains because of the variety of information
stored in a large database. Many users of the database system do not need all
this information; instead, they need to access only a part of the database. The
view level of abstraction exists to simplify their interaction with the system.
The system may provide many views for the same database.
Database Management System Abhishek Shukla
Instances and Schemas
Databases change over time as information is inserted and deleted. The
collection of information stored in the database at a particular moment is
called an instance of the database. The overall design of the database is called
the database schema. Schemas are changed infrequently, if at all. The concept
of database schemas and instances can be understood by analogy to a
program written in a programming language. A database schema corresponds
to the variable declarations (along with associated type definitions) in a program.
Each variable has a particular value at a given instant. The values of the
variables in a program at a point in time correspond to an instance of a
database schema. Database systems have several schemas, partitioned
according to the levels of abstraction. The physical schema describes the
database design at the physical level, while the logical schema describes the
database design at the logical level. A database may also have several schemas
at the view level, sometimes called sub-schemas, which describe different
views of the database.
Of these, the logical schema is by far the most important, in terms of its
effect on application programs, since programmers construct applications by
using the logical schema. The physical schema is hidden beneath the logical
schema, and can usually be changed easily without affecting application
programs. Application programs are said to exhibit physical data independence
if they do not depend on the physical schema, and thus need not be rewritten if
the physical schema changes.
Data Independence
Data independence can be explained using the three-schema architecture.
Data independence refers characteristic of being able to modify the schema at
one level of the database system without altering the schema at the next higher
level.
There are two types of data independence:
1. Physical Data Independence
2. Logical Data Independence
Database Management System Abhishek Shukla
Physical Data Independence Logical Data Independence
The capacity to change the internal The capacity to change the
schema without having to change conceptual schema without having
the conceptual schema. to change the external schema.
Modifications done in the physical Modifications done in the
level of the data, then the conceptual level of the data, then
conceptual view of the database will the user view of the database will
not be affected. not be affected.
Used to separate conceptual level Used to separate the external level
from the physical level. from the conceptual level.
Physical data independence occurs Logical data independence occurs at
at the logical interface level. the user interface level.
Physical data independence is Logical Data Independence is
concerned with the storage of the concerned with the structure or
data. changing the data definition.
It is easy to retrieve. It is difficult to retrieve.
It is easy to achieve physical data It is difficult to achieve logical data
independence as compared to logical independence as compared to physical
independence independence
Example: change in compression Example: Add/Modify/Delete a new
techniques, hashing algorithms, attribute
storage devices, etc
Database Management System Abhishek Shukla