Anda di halaman 1dari 17

UNIT 1

Introduction: Data base System Applications, data base System VS file System, Advantages of a DBMS View
of Data, Data Abstraction, instances and Schemas, data Models, the ER Model, Relational Model, Other
Models

Introduction of Database Management System


In today’s competitive environment data and its efficient management is the critical business objective of an
organization. It is a difficult task to get the right information at the right time to take right decision. Therefore
the success of an organization is now more than ever dependent on its ability to acquire accurate, reliable and
timely data about its business or operation for effective decision-making process.
Database system is a tool that simplifies the above tasks of managing the data and extracting useful
information in a timely fashion.
In fact database and database management system (DBMS) have some essential for managing our business,
governments, banks, electronic commerce, engineering, law, education, medical and every other kind of
human endeavor.

Data may be defined as a known fact that can be recorded and that have implicit meaning. For example,
names, telephone numbers and addresses of the people.

Database is a collection of related data or database is an integrated collection of data records, files and other
database objects.

Database Management System is a collection of programs that enables users to create and maintain a
database. The primary goal of a DBMS is to provide away to store and retrieve database information that is
both convenient and efficient.

The DBMS is hence a general-purpose software system that facilitates the processes of defining, constructing,
manipulating and sharing databases among various users and application.
 Defining: specifying the data types, structures, and constraints for the data.

 Constructing: includes storing the data itself on some storage medium.

 Manipulating: includes querying the database to retrieve specific data, updating the data to reflect
changes in data, generating reports from data.

 Sharing: allows multiple users to access the database concurrently.

Applications of DBMS
Databases are widely used. The some of the representative applications are:
1. Banking: for customer information, accounts and loans and banking transactions.

2. Universities: for student registrations and grades.

3. Online shopping: Everyone wants to shop from home. Everyday new products are added and sold
only with the help of DBMS. Purchase information, invoice bills and payment, all of these are done
with the help of DBMS.
1
4. Airlines: for reservations and schedule information.
5. Credit card transactions: for purchases on credit cards and generation of monthly statements.
6. Library Management System: maintain all the information relate to book issue dates, name of
the book, author and availability of the book.
7. Telecommunications: for keeping records of call made, generating monthly bills, maintaining
balances on prepaid calling cards.
8. Sales: for customer, product and purchase information.
9. Finance : for storing information about holdings, sales, and purchases of financial instruments such
as stocks and bonds.
10. Manufacturing: for management of supply chain and for tracking production of items in factories,
inventories of items and orders for items.
11. Human Resource : for information about employees, salaries, payroll taxes and benefits.

Database System versus File System


DBMS File Processing System
Minimal data redundancy problem in DBMS Data Redundancy problem exits
Data Inconsistency does not exist Data Inconsistency exist here
Accessing database is easier Accessing is comparatively difficult
Data is scattered in various files and files may be of different
The problem of data isolation is not found in database
format, so data isolation problem exists
Transactions like insert, delete, view, updating, etc are
In file system, transactions are not possible
possible in database
Concurrent access and recovery is possible in database Concurrent access and recovery is not possible
Security of data Security of data is not good
A database manager (administrator) stores the A file manager is used to store all relationships in directories in
relationship in form of structural tables file systems.

Advantages of DBMS
1. Controlling of Redundancy:
Data redundancy refers to the duplication of data (i.e storing same data multiple times). In a database
system, by having a centralized database and centralized control of data by the DBA the unnecessary
duplication of data is avoided. It also eliminates the extra time for processing the large volume of data. It
results in saving the storage space.

2 . I m p r o v e d D a t a Sh ar i n g :
DBMS allows a user to share the data in any number of application programs.

3. Data Integrity:
2
Integrity means that the data in the database is accurate. Centralized control of the data helps in permitting
the administrator to define integrity constraints to the data in the database. For example: in customer
database we can enforce an integrity that it must accept the customer only from Noida and Meerut city.

4 . S e c u r i t y:
Having complete authority over the operational data, enables the DBA in ensuring that the only mean of
access to the database is through proper channels. The DBA can define authorization checks to be carried out
whenever access to sensitive data is attempted.

5 . D a t a C o n si st e n c y:
By eliminating data redundancy, we greatly reduce the opportunities for inconsistency. For example: is a
customer address is stored only once, we cannot have disagreement on the stored values. Also updating data
values is greatly simplified when each value is stored in one place only. Finally, we avoid the wasted storage
that results from redundant data storage.

6 . E f f i c i e n t D at a A c c es s :
In a database system, the data is managed by the DBMS and all access to the data is through the DBMS
providing a key to effective data processing

7 . E n f o r c e m e n t s o f St a n d a r d s:
With the centralized of data, DBA can establish and enforce the data standards which may include the naming
conventions, data quality standards etc.

8 . D a t a I n d ep e n d en c e:
In a database system, the database management system provides the interface between the application
programs and the data. When changes are made to the data representation, the meta data obtained by the
DBMS is changed but the DBMS is continues to provide the data to application program in the previously used
way. The DBMs handles the task of transformation of data wherever necessary.

9 . R e d u c e d A p p l i c a t i o n D e v e l o p m e n t an d M a i n t e n a n c e T i m e :
DBMS supports many important functions that are common to many applications, accessing data stored in
the DBMS, which facilitates the quick development of application.

Disadvantages of DBMS
1. Increased Complexity
2. Requirement of New and Specialized Manpower
3. Large Size of DBMS

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. Developers hide the complexity from users
through several levels of abstraction to simplify users interactions with the system.

3
Physical Level: The lowest level of abstraction describes how the data are actually stored.

Logical Level: The next-higher level of abstraction describes what data are stored in the database, and what
relationships exist among those data.

View Level: The highest level of abstraction describes only part of the entire database. The view level of
abstraction exists to simplify their interaction with the system. The system may provide many view for the
same database.

Example: Let’s say we are storing customer information in a customer table. At physical level these records
can be described as blocks of storage (bytes, gigabytes, terabytes etc.) in memory. These details are often
hidden from the programmers.

At the logical level these records can be described as fields and attributes along with their data types, their
relationship among each other can be logically implemented. The programmers generally work at this level
because they are aware of such things about database systems.

At view level, user just interact with system with the help of GUI and enter the details at the screen, they are
not aware of how the data is stored and what data is stored; such details are hidden from them.

Data Independence
Data Independence can be defined as the capacity to change the schema at one level of a database system
without having to change the schema at the next higher level.
Data Independence occurs because when the schema is changed at some level, the schema at the next higher
level remains unchanged; only the mapping between the two levels is changed.
There are two types of data independence:

1. Logical Data Independence


2. Physical Data Independence

Logical Data Independence


It is the capacity to change the conceptual schema without having to change external schemas or application
program.

4
We may change the conceptual schema to expand the database, to change constraints, or to reduce the
database.

Physical Data Independence


It is the capacity to change the internal schema without having to change the conceptual schema. Hence, the
external schema needs not to be changed as well.
Changes to the internal schema may be needed because some physical files had to be reorganized.

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.
A database schema does not contain any data or information. It formulates all the constraints that are to be
applied on the data.
A database schema can be divided broadly into two categories :
1. Physical Database Schema: This schema pertains to the actual storage of data and its form of
storage like files, indices, etc. It defines how the data will be stored in a secondary storage.

2. Logical Database Schema: This schema defines all the logical constraints that need to be applied on
the data stored. It defines tables, views, and integrity constraints.

Database Instance
The data in the database at a particular moment in time is called a database state or snapshot. It is also called
the current set of occurrences or instances in the database.
In a given database state, each schema construct has its own current set of instances.
The DBMS stores the descriptions of the schema constructs and constraints also called metadata in the DMBS
catalog so that DBMS software can refer to the schema whenever it needs to.

Types of Data Models


DBMS Database Models
A Database model defines the logical design and structure of a database and defines how data will be
stored, accessed and updated in a database management system. While the Relational Model is the
most widely used database model, there are other models too:

 Hierarchical Model
 Network Model
 Entity-relationship Model
 Relational Model

Data Models are the collection of concept to describe the structure of database. The types of data models are:

Hierarchical Database Model


This is the oldest form of database. This data model organizes the data in the tree structure i.e. each child
node can have only one parent node and at the top of the structure, there is a single parenthesis node.

5
In this model a database record is a tree that consists of one or more groupings of fields called segments,
which makeup the individual nodes of the tree. This model use one-to-many relationship
Advantage: Data access is quite predictable in structure and retrieval and updates can be highly optimized
by a DBMS.
Disadvantage: The link is permanently established and cannot be modified which makes this model rigid.

Network Database Model


The Network database model was developed as an alternative to the hierarchical database. This model
expands on the hierarchical model by providing multiple paths among segments i.e. more than one parent-
child relationship. Hence this model allows one-to-one, one-to-many and many-to-many
relationships

Supporting multiple paths in the data structure eliminates some of the drawbacks of the hierarchical model;
the network model is not very practical.
Disadvantage: It can be quite complicated to maintain all the links.

Relational Database Model


The key differences between previous database models and relational database model is in terms of flexibility.
A relational database represents all data in the database as simple two-dimensional tables called relations.
Each row of a relational table, called tuple, represents a data entity with columns of the table representing
attributes(fields). The allowable values for these attributes are called the domain

Each row in a relational table must have a unique primary key and also has some secondary keys which
correspond with primary keys in other tables
Advantage : Provides flexibility that allows changes to the database structure to be easily accommodated. It
facilitates multiple views of the same database for different users.
6
For example: COLLEGE table has Batch_Year as primary key and has secondary keys Student_ID and
Course_ID, these keys serve as primary keys for STUDENT and COURSE tables.

Student Table

Student_ID Student_Name

101 Shubham

102 Rajat

Course Table

Course_ID Course_Name

14 Java

16 Android

College Table

Batch_Year Student_ID Course_ID Teacher_Name


Teacher_Number

2012-16 101 14 Jack 9876543

2013-17 102 16 Tom 9823451

Entity–relationship model:

An Entity–relationship model (ER model) describes the structure of a database with the help of a
diagram, which is known as Entity Relationship Diagram (ER Diagram). An ER model is a design or
blueprint of a database that can later be implemented as a database. The main components of E-R
model are: entity set and relationship set.

An ER diagram shows the relationship among entity sets. An entity set is a group of similar entities and
these entities can have attributes. In terms of DBMS, an entity is a table or attribute of a table in
database, so by showing relationship among tables and their attributes, ER diagram shows the complete
logical structure of a database. Lets have a look at a simple ER diagram to understand this concept.

A simple ER Diagram:

In the following diagram we have two entities Student and College and their relationship. The
relationship between Student and College is many to one as a college can have many students however
a student cannot study in multiple colleges at the same time. Student entity has attributes such as
Stu_Id, Stu_Name & Stu_Addr and College entity has attributes such as Col_ID & Col_Name.

7
Here are the geometric shapes and their meaning in an E-R Diagram. We will discuss these terms in
detail in the next section(Components of a ER Diagram) of this guide so don’t worry too much about
these terms now, just go through them once.

Rectangle: Represents Entity sets.


Ellipses: Attributes
Diamonds: Relationship Set
Lines: They link attributes to Entity Sets and Entity sets to Relationship Set
Double Ellipses: Multivalued Attributes
Dashed Ellipses: Derived Attributes
Double Rectangles: Weak Entity Sets
Double Lines: Total participation of an entity in a relationship set

Components of a ER Diagram

As shown in the above diagram, an ER diagram has three main components:


1. Entity
2. Attribute
3. Relationship

8
1. Entity

An entity is an object or component of data. An entity is represented as rectangle in an ER diagram.


For example: In the following ER diagram we have two entities Student and College and these two
entities have many to one relationship as many students study in a single college. We will read more
about relationships later, for now focus on entities.

Weak Entity:

An entity that cannot be uniquely identified by its own attributes and relies on the relationship with
other entity is called weak entity. The weak entity is represented by a double rectangle. For example – a
bank account cannot be uniquely identified without knowing the bank to which the account belongs, so
bank account is a weak entity.

2. Attribute

An attribute describes the property of an entity. An attribute is represented as Oval in an ER diagram.


There are four types of attributes:

1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute

1. Key attribute:

A key attribute can uniquely identify an entity from an entity set. For example, student roll number can
uniquely identify a student from a set of students. Key attribute is represented by oval same as other
attributes however the text of key attribute is underlined.

9
2. Composite attribute:

An attribute that is a combination of other attributes is known as composite attribute. For example, In
student entity, the student address is a composite attribute as an address is composed of other
attributes such as pin code, state, country.

3. Multivalued attribute:

An attribute that can hold multiple values is known as multivalued attribute. It is represented
with double ovals in an ER Diagram. For example – A person can have more than one phone numbers so
the phone number attribute is multivalued.

4. Derived attribute:

A derived attribute is one whose value is dynamic and derived from another attribute. It is represented
by dashed oval in an ER Diagram. For example – Person age is a derived attribute as it changes over time
and can be derived from another attribute (Date of birth).

10
E-R diagram with multivalued and derived attributes:

3. Relationship

A relationship is represented by diamond shape in ER diagram, it shows the relationship among entities.
There are four types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many

1. One to One Relationship

When a single instance of an entity is associated with a single instance of another entity then it is called
one to one relationship. For example, a person has only one passport and a passport is given to one
person.

2. One to Many Relationship

When a single instance of an entity is associated with more than one instances of another entity then it
is called one to many relationship. For example – a customer can place many orders but a order cannot
be placed by many customers.

3. Many to One Relationship

When more than one instances of an entity is associated with a single instance of another entity then it
is called many to one relationship. For example – many students can study in a single college but a
student cannot study in many colleges at the same time.

11
4. Many to Many Relationship

When more than one instances of an entity is associated with more than one instances of another entity
then it is called many to many relationship. For example, a can be assigned to many projects and a
project can be assigned to many students.

Total Participation of an Entity set

A Total participation of an entity set represents that each entity in entity set must have at least one
relationship in a relationship set. For example: In the below diagram each college must have at-least one
associated Student.

Three new concepts were added to the existing ER Model, they were:

1. Generalization

2. Specialization

3. Aggregation
12
Let's understand what they are, and why were they added to the existing ER Model.

Generalization

Generalization is a bottom-up approach in which two lower level entities combine to form a higher level
entity. In generalization, the higher level entity can also combine with other lower level entities to make
further higher level entity.
It's more like Super class and Subclass system, but the only difference is the approach, which is bottom-up.
Hence, entities are combined to form a more generalized entity, in other words, sub-classes are combined to
form a super-class.

For example, Saving and Current account types entities can be generalized and an entity with
name Account can be created, which covers both.
Specialization
Specialization is opposite to Generalization. It is a top-down approach in which one higher level entity can be
broken down into two lower level entity. In specialization, a higher level entity may not have any lower-level
entity sets, it's possible.

Aggregation
Aggregation is a process when relation between two entities is treated as a single entity.

13
In the diagram above, the relationship between Center and Course together, is acting as an Entity, which is in
relationship with another entity Visitor. Now in real world, if a Visitor or a Student visits a Coaching Center,
he/she will never enquire about the center only or just about the course, rather he/she will ask enquire about
both.

OTHER MODELS FOR DBMS:

Object-Oriented Database Model


The relational database model has a widely variety of applications. However it does not easily support the
distribution of one database across a number of servers. Due to this, object-oriented database management
system was developed.
In these databases, the users can define own data access methods, the representation of data and the method
of manipulating it. An object-oriented database stores and maintains objects.
Example: The class population is the root of class hierarchy, which includes the Nation class. The Population
class is also the root of two sub-class, men and women. The Nation class is the root of other sub-classes
country1, country2, country3. Note that each class has its own set of attributes apart from the root class's
attributes.

Record base Data Model


Record base model is used to specify the overall structure of the database and in this there are many
record types. Each record type has fixed no. of fields having the fixed length.

14
Object relation Data Model
Object relation model is a very powerful model but coming to it’s design it is quiet complex. This
complexity is not problem because it gives efficient results and widespread with huge applications. It has
a feature which allows working with other models like working with the very known relation model.

Semi structured Data Model


Semi structured data model is a self describing data model, in this the information that is normally
associated with a scheme is contained within the data and this property is called as the self describing
property.

Associative Data Model


Associative model has a division property, this divides the real world things about which data is to be
recorded in two sorts i.e. between entities and associations. Thus, this model does the division for
dividing the real world data to the entities and associations.

Context Data Model


Context data model is a flexible model because it is a collection of many data models. It is a collection of
the data models like object oriented data model, network model, semi structured model. So, in this
different types of works can be done due to the versatility of it.

Context Model

Therefore, this support different types of users and differ by the interaction of users in database and
also the data models in DBMS brought a revolutionary change in industries by the handling of relevant
data. The data models in DBMS are the systems that help to use and create databases, as we have seen
there are different types of data models and depending on the kind of structure needed we can select
the data model in DBMS.

As we said that we will provide you a free pdf file of Data Models and its types, so link to download this
pdf file is given below.

15
DBMS Architecture
A Database Management system is not always directly available for users and applications to access and
store data in it. A Database Management system can be centralised(all the data stored at one
location), decentralised(multiple copies of database at different locations) or hierarchical, depending
upon its architecture.
1-tier DBMS architecture also exist, this is when the database is directly available to the user for using it
to store data. Generally such a setup is used for local application development, where programmers
communicate directly with the database for quick response.
Database Architecture is logically of two types:

1. 2-tier DBMS architecture


2. 3-tier DBMS architecture

2-tier DBMS Architecture:


2-tier DBMS architecture includes an Application layer between the user and the DBMS, which is
responsible to communicate the user's request to the database management system and then send the
response from the DBMS to the user.
Application program interface standards like ODBC and JDBC are used for interaction between the client and
the server.
An application interface known as ODBC(Open Database Connectivity) provides an API that allow client
side program to call the DBMS. Most DBMS vendors provide ODBC drivers for their DBMS.

Such an architecture provides the DBMS extra security as it is not exposed to the End User directly. Also,
security can be improved by adding security and authentication checks in the Application layer too.

3-tier DBMS Architecture


3-tier DBMS architecture is the most commonly used architecture for web applications.

16
It is an extension of the 2-tier architecture. In the 2-tier architecture, we have an application layer which
can be accessed programatically to perform various operations on the DBMS. The application generally
understands the Database Access Language and processes end users requests to the DBMS.
In 3-tier architecture, an additional Presentation or GUI Layer is added, which provides a graphical user
interface for the End user to interact with the DBMS.
For the end user, the GUI layer is the Database System, and the end user has no idea about the
application layer and the DBMS system.
If you have used MySQL, then you must have seen PHPMyAdmin, it is the best example of a 3-tier DBMS
architecture.
In a three-tier architecture, the client machine acts as a front end and does not contain any direct database
calls. Instead, the client end communicates with an application server which in turn communicates with a
database system to access data.
The business logic of the application, which says what actions to carry out under what conditions, is
embedded in the application server, instead of being distributed across multiple clients.
Three-tier applications are more appropriate for large applications and for applications that run on World
Wide Web.

http://tutorial4beginners.com/dbms -functional-dependency

17

Anda mungkin juga menyukai