Sie sind auf Seite 1von 9

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.

A database schema can be divided broadly into two categories −

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.

Roll no S_name Age City


1 Rohit 20 Faridabad

2 Aman 22 Delhi Instance

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:

1. Server- server is a machine where DBMS is installed. It is also known as application


program. It acts as monitor to all of its clients. It distributes work load to other systems.
Clients must obey their server. Users request their query to the server with the help of client.
Client send user’s request to server. Then server verifies the request give response to the
client. In the client server architecture there are more than one server based on the
complexity of application for which architecture is going to make.
Functions of server-
A). It supports all the basics of DBMS.
B). It monitors all the clients.
C). It distributes workload over clients.
D). It maintains security and privacy.
2. Clients- Client machine is a personal computer which provides services to both server and
users. It must obey its server. When any user want to execute a query on client, the client
first take data from server then execute the query on its own hardware and return the result
to the server or users according to type of query.
3. Network interface- Clients and server are connecting through network interface.

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.

Three level schema architecture


the goal of three level schema architecture is to separate the user application the physical database.
In this architecture , schema can be defined at the following three levels-
1. Internal level – Internal level has the internal schema which describe the physical
storage structure of the database. The internal schema uses a physical data model and
describe the complete details of data storage and access path for the database.
2. Conceptual level- The conceptual level has a conceptual schema, which describes
the structure of whole database for a group of users. The conceptual schema hide the
details of physical storage structures and concentrate on describing entities,
relationship, user operations, and conditions. A record based data model is used to
describe the conceptual schema .
3. External view- The external view and level includes of external schema or users
views. Each external schema describes the part of the database in which a particular
group of users are interested and hides the rest of database from that user group.
External schema is implemented using a record bases data model.

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)

Classification Based on User Numbers


A DBMS can be classification based on the number of users it supports. It can be a single-user
database system and a multiuser database system, which supports multiple users concurrently.
4. Single user database system:- when a database system allow only one user at a time
then this system is known as Single user database system.
5. multiuser database system:- when a database system allow multiple users at a time
then this system is known as multiuser database system.

Classification Based on number of sites


There are four main distribution systems for database systems and these, in turn, can be used to
classify the DBMS.

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

Example of a centralized database system..

2. Distributed database system


In a distributed database system, the actual database and the DBMS software are distributed from
various sites that are connected by a computer network, as shown in Figure

Example of a distributed database system.


Distributes DBMS is further divided into two type:-
Homogeneous distributed database systems:-Homogeneous distributed database systems use the
same DBMS software from multiple sites. Data exchange between these various sites can be
handled easily. For example, library information systems by the same vendor
Heterogeneous distributed database systems:- In a heterogeneous distributed database system,
different sites might use different DBMS software, but there is additional common software to
support data exchange between these sites.

Classification based on purpose


Based on purpose DBMS can be classified as general purpose dbms and specific dbms.
1. General purpose DBMS:- The DBMS which is built nor for any particular application is
known as general purpose DBMS. This type of DBMS can be used for other application
without making major changes.
2. Specific purpose:- The DBMS which is built for a particular application is known as
specific purpose DBMS. This type of DBMS cannot be used for other application without
making major changes.
Data models:-
A database model is a type of data model that determines the logical structure of a database and
fundamentally determines in which manner data can be stored, organized, and manipulated. It is
conceptual method of structuring the data.
Depending on the levels of data we are modeling, we have divided data models into 3 categories

1. Object Based/high level/conceptual data model


2. Physical/low level data model
3. Representational/Record based Data models.

1. Object Based/high level/conceptual data model


Object based data model is used to represent the conceptual schema of data in database. With the
help of object based data model we can represent entities, their attributes and relationship between
these entities etc. For example if we have to design database for college. Then the entities are
college, Students, Lecturer, Course, Subject, Marks etc. Once all the entities are listed, we find out
the relationship between them and try to map all of them. Also we list what are the attributes related
to each entity like student id, name, lecturer name, course that he is teaching, different subjects,
pass mark, grade levels etc. Here we are not bothered about what data value is stored, what is the
size of each data etc. We know only entities involved, their attributes and mapping at this stage.

2. Physical/low level data model


Physical data model represent the model where it describes how data are stored in computer
memory, how they are scattered and ordered in the memory, and how they would be retrieved from
memory. Basically physical data model represents the data at data layer or internal layer. It
represents each table, their columns and specifications, constraints like primary key, etc. It basically
represents how each tables are built and related to each other in DB.
3. Representational/Record based Data models:-There are 3 types of record based data models
defined so far- Hierarchical, Network and Relational data models.
Hierarchical data model:-In this data model, the entities are represented in a hierarchical fashion.
Here we identify a parent entity, and its child entity. Again we drill down to identify next level of
child entity and so on.
It can also be imagined as tree like structure. 1:N type of relationships is best defined by this type of
data model. E.g.; One company has multiple departments (1:N), one company has multiple
suppliers (1:N),one department has multiple employees (1:N), each department has multiple
projects(1:N) .

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.

Data structure used in relational data model


Relation – The name of the table is known as relation. The relation in example given below is
‘Employee_details’.
Tables – In relational data model, relations are saved in the format of Tables. This format stores the
relation among entities. A table has rows and columns, where rows represents records and columns
represent the attributes.
Tuple – A single row of a table, which contains a single record for that relation is called a tuple.
Relation instance – A finite set of tuples in the relational database system represents relation
instance. Relation instances do not have duplicate tuples.
Relation schema – A relation schema describes the relation name (table name), attributes, and their
names.
Domain – Every attribute has some pre-defined value scope, known as attribute domain.
Cardinality- Total number of rows or tuples in a relation is known as cardinality. In the example
given below cardinality of relation is 3.
Degree – Total number of column or fields in a relation is known as degree. In the example given
below degree of relation is 3.
Advantages
1. The main advantage of relational data model is the simplicity in representing data.
2. It is easy to design, implementation, maintain and use.
3. It offers more flexible and powerful query.
4. It is structural independent. Any changes in database structure do not affect the data access.
5. It has very less redundancy as compare to other data models.
6. It has very less data inconsistency as compare to other data models .

Disadvantages-
1. It need more powerful computing hardware and data storages devices
2. It is more costly than other devices.

Das könnte Ihnen auch gefallen