Database Schema
Database Schema
Database Schema
A database schema is the skeleton structure that represents the logical view of the entire database.
It defines how the data is organized and how the relations among them are associated. It describes
all the conditions that are to be applied on the data. A database schema defines its entities and the
relationship among them. It contains a descriptive detail of the database, which can be represented
by means of schema diagrams. Database schema is designed by database designer to help
programmers understand the database and make it useful.
It is designed when the database doesn't exist at all. Once the database is operational, it is very
difficult to make any changes to it. A database schema does not contain any data or information.
Database schema is design with the help of DDL (Data Definition Language) commands.
Physical Database Schema – Physical schema defines the actual storage of data and its form of
storage like files etc. It defines how the data will be stored in a secondary storage. It also defines
the access path of data from the database.
Logical Database Schema -Logical schema defines the logical structure of data in database. It
describes all the logical constraints that need to be applied on the data stored. It defines entities,
attributes of entity and also the relationship between these entities.
Sub-schema :- It is part or subset of schema and it inherit all the properties that schema has. It
gives the users a window through which they can view only that part of data in which they are
interested at that particular point of time.
Database instance:-
The data in database at a particular point of time is known as database instance. It is also known as
database state. A database instance is a state of operational database with data at any given time. It
contains a snapshot of the database. Database instances tend to change with time. A DBMS ensures
that its every instance (state) would be in a valid state, by following all the validations, constraints,
and conditions that the database designers have applied. Database instance is created after creating
the database schema. It is created with the help of DML (Data Manipulation Language) commands.
3 Priya 21 Delhi
Database architecture:- There are two type of database architecture : two tier and three tier
architecture.
Two tier architecture:- In 2-tier architecture, application program or client directly interacts with
the database server. There will not be direct interaction of with database. So here we have only two
layers one is application program or client and another is database server. That’s why is called as
two tier architecture. It is also known as client- server architecture. There are three major
component of client server architecture:
Advantages:-
It is Easy to understand as it directly communicates with the database.
Requested data can be retrieved very quickly, when there is less number of users.
Easy to modify – any changes required, directly requests can be sent to database
Easy to maintain – When there are multiple requests, it will be handled in a queue and there
will not be any chaos.
It provides better user interface.
It reduces the cost.
Single copy of DBMS is shared.
Disadvantages:-
It would be time consuming, when there is huge number of users. All the requests will be
queued and handed one after another. Hence it will not respond to multiple users at the same
time.
It is kind of centralized system. It server is failed then there is loss of data.
Recovery is typical.
The three level schema architecture is a convenient tool with which user can visualize the schema
levels in the database system.
Mapping- The process of transforming the requests and results between the levels are called
mapping. In three level schema architecture we have two types of mapping-
1. External/conceptual mapping- when a DBMS transform a request specified on an external
schema into a request against the conceptual schema and vice-versa then this mapping is
known as External/conceptual mapping.
2. Conceptual/internal mapping- when a DBMS transform a request specified on an
conceptual schema into a request against the internal schema and vice-versa then this
mapping is known as conceptual/internal mapping.
Advantages-
1. Each user is able to access the same data but have a different customized view of data as
per the requirement.
2. Users do not concern about physical data storage details.
3. Recovery is possible.
Disadvantages-
1. It is time consuming.
2. This architecture is costly than two tier architecture.
3. We have to take care of mapping between the levels. This increases overhead.
Data independence
Data independence can be defined as the capacity to change the schema at one level of database
system without having to change the schema at the next higher level. We can define two type of
data independence-
1. Logical data independence- logical data independence is the capacity to change the
conceptual schema without having any changes into external schema or application
programs. Only the mapping between the conceptual schema and external schema is
changes and absorbed all the changes of conceptual schema. We may change the conceptual
schema to expend the data base or to reduce the data base etc.
2. Physical data independence- Physical data independence is the capacity to change the
internal schema without having any changes into conceptual schema and external schema.
Only the mapping between the conceptual schema and internal schema is changes and
absorbed all the changes of internal schema. Changes in the internal schema are required
because some physical file were reorganized. But as data remain same so no changes would
be taken place in conceptual schema.
Classification of DBMS
Database management systems can be classified based on several criteria, such as the data model,
user numbers and database distribution, all described below.
Classification Based on Data Model
If DBMS is based on relational data model then this DBMS is known relational DBMS(RDBMS).
The most popular data model in use today is the relational data model. Similarly the DBMS based
of object oriented data model is called as Object-oriented database management systems
(OODBMS)
1. Centralized systems
With a centralized database system, the DBMS and database are stored at a single site that is used
by several other systems too. This is illustrated in Figure
Advantages
6. It is easy to understand
7. Hierarchical data models are more flexible as compare to network data models.
8. It is more efficient.
Disadvantages
1. It has more redundancy as compare to any other data model
2. It has more data inconsistency.
3. It is not best suited to represent M:N types of relationship.
Network Data Model:-This is the enhanced version of hierarchical data model. It is designed to
address the drawbacks of the hierarchical model. M:N type of relationships is best defined by this
type of data model. Network data model looks like graph where child can have multiple parents.
E.g. multiple departments have multiple projects.
Advantages
9. It has less redundancy than hierarchical data model
10. It has less inconsistency as compare to hierarchical data model
11. Data access is easy in network data model.
Disadvantages
1. Network data model is less flexible than any other data model.
2. It is little bit complex to design
3. It is difficult to maintain.
4. Structure in network data model is not independent.
Relational data model:- The relational data model was discovered by E.F.Codd. In relational data
model information is stored in tabular form. So it consists of collection of tables. A relation
appears as a two-dimensional table. The Relational DBMS organizes the data so that its external
view is a set of relations or tables. This does not mean that data is stored as tables. The physical
storage of the data is independent of the way in which the data is logically organized.
Disadvantages-
1. It need more powerful computing hardware and data storages devices
2. It is more costly than other devices.