0% found this document useful (0 votes)
40 views18 pages

E-Content - DBMS - Unit - 1

Uploaded by

21b01a5441
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views18 pages

E-Content - DBMS - Unit - 1

Uploaded by

21b01a5441
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

DATABASE MANAGEMENT SYSTEMS

UNIT-1
1.1 Introduction:
Database: The collections of related data are called as database.
Database management system: It is a collection of interrelated data and a set of
programs to access those data.
FILE PROCESSING SYSTEM: It is supported by a conventional operating system. The
system stores permanent records in various file. It’s having some disadvantages,
1. Data redundancy and inconsistency
2. Difficulty in accessing data
3. Data isolation
4. Integrity problems
5. Atomicity problems
6. Concurrent access anomalies
7. Security problems

1.2 DATABASE MANAGEMENT SYSTEMS APPLICATIONS:


Railway Reservation System
Database is required to keep record of ticket booking, train’s departure and arrival status.
Also if trains get late then people get to know it through database update.
Library Management System
There are thousands of books in the library so it is very difficult to keep record of all the
books in a copy or register. So DBMS used to maintain all the information relate to book
issue dates, name of the book, author and availability of the book.
Banking
We make thousands of transactions through banks daily and we can do this without going to
the bank. So how banking has become so easy that by sitting at home we can send or get
money through banks. That is all possible just because of DBMS that manages all the bank
transactions.
Universities and colleges
Examinations are done online today and universities and colleges maintain all these records
through DBMS. Student’s registrations details, results, courses and grades all the
information is stored in database.
Social Media Sites
We all are on social media websites to share our views and connect with our friends. Daily
millions of users signed up for these social media accounts like face book, twitter, interest
and Google plus. But how all the information of users are stored and how we become able
to connect to other people, yes this all because DBMS.
Telecommunications
Any telecommunication company cannot even think about their business without DBMS.
DBMS is must for these companies to store the call details and monthly post paid bills.
Finance
Those days have gone far when information related to money was stored in registers and
files. Today the time has totally changed because there are lots f thing to do with finance
like storing sales, holding information and finance statement management etc.
Military
Military keeps records of millions of soldiers and it has millions of files that should be keep
secured and safe. As DBMS provides a big security assurance to the military information so
it is widely used in militaries. One can easily search for all the information about anyone
within seconds with the help of DBMS.

1.3 DATABASE SYSTEM VS FILE SYSTEM:

S no Database File system


1 Data are not redundant and consistent Data are redundant and inconsistent
2 Easy to access Difficult to access
It ensures integrity, atomicity and It doesn’t ensures it
3
security
4 Data can be concurrently accessed Concurrent access is not possible
5 Easy to retrieve appropriate data Difficult to retrieve appropriate data

Disadvantages of file management systems:


1. Data Mapping and Access: - Although all the related information’s are grouped
and stored in different files in same directory, there is no mapping between any
two files.
2. Data Redundancy: - There are no methods to validate the insertion of duplicate
data in file system. Decentralization of data leads to data redundancy.
3. Data Dependence: - It is to store the data in flat files. So there is no dependent
on files.
4. Data inconsistency: - It is due to decentralization of data[i.e. no updating of the
data ]
5. Data Isolation: separation of data [individuality]
6. Security: - Each file can be password protected. But what if have to give access
to only few records in the file? For example, user has to be given access to view
only their bank account information in the file. This is very difficult in the file
system.
7. Integrity: In FMS it does not check the rules.
8. Atomicity: - It depends on transaction which means set of actions. Transaction is
done or undone is atomicity.
9. Concurrent Access: - In FMS, multiple users cannot access same file at same
time.
NOTE: All these disadvantages in reverse become the advantages of Database management
systems.

1.4 VIEW OF DATA: The database system provides an abstract view of data to users. The
system hides details/ of how the data is stored and maintained. Here we are including 2
things,

1.4.1. Data abstraction: Data is hidden through various levels of abstraction such as,
a. Physical level
b. Logical level
c. View level
a) Physical level- The lowest level of abstraction describes how the data are physically
stored. The physical level describes complex low level data structure.

Figure-1.1
b) Logical level- The next level of abstraction describes about data is stored in the
database, and what relationship exists among those data. It describes the entire database
in terms of a small number of relatively simple structures.
c) 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 views for the same database.

1.5 Instances and schema: 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. Types of schemas are
1. Physical schema- describes the database design at the physical level.
2. Logical schema-describes the data database design at the logical level.
3. Sub level- describes the data database design at the view level.
Data Independence:
A database system normally contains a lot of data in addition to users’ data. For example,
it stores data about data, known as metadata, to locate and retrieve data easily. It is
rather difficult to modify or update a set of metadata once it is stored in the database. But
as a DBMS expands, it needs to change over time to satisfy the requirements of the users.
If the entire data is dependent, it would become a tedious and highly complex job.
Metadata itself follows a layered architecture, so that when we change data at one layer, it
does not affect the data at another level. This data is independent but mapped to each
other.

Figure-1.2
Logical Data Independence
Logical data is data about database, that is, it stores information about how data is
managed inside. For example, a table (relation) stored in the database and all its
constraints, applied on that relation.
Logical data independence is a kind of mechanism, which liberalizes itself from actual data
stored on the disk. If we do some changes on table format, it should not change the data
residing on the disk.
Physical Data Independence
All the schemas are logical, and the actual data is stored in bit format on the disk. Physical
data independence is the power to change the physical data without impacting the schema
or logical data.
For example, in case we want to change or upgrade the storage system itself − suppose
we want to replace hard-disks with SSD − it should not have any impact on the logical data
or schemas.

1.6 DATA MODELS: A data model is a collection of concepts that can be used to describe
the structure of a database.
It provides the necessary means to achieve the abstraction.
By structure of a database we mean the data types, relationships and constraints that
apply to data.
Design of database is called data model
Data models are classified into three types:
1. Object based model
1. Object oriented model
2. E-R model
3. Functional model
2. Record based model
1. Relational model
2. Network model
3. Hierarchical model
3. Physical model
1. Unify model
2. Frame model
Object oriented model:
This data model is another method of representing real world objects. It considers each
object in the world as objects and isolates it from each other. It groups its related
functionalities together and allows inheriting its functionality to other related sub-groups.

1.7 E-R model:


In the below diagram, Entities or real world objects are represented in a rectangular box.
Their attributes are represented in ovals. Primary keys of entities are underlined. All the
entities are mapped using diamonds. This is one of the methods of representing ER model.
There are many different forms of representation. Basically, ER model is a graphical
representation of real world objects with their attributes and relationship. It makes the
system easily understandable. This model is considered as a top down approach of
designing a requirement.

Figure 1.3

Functional model:
In functional model the data is stored and accessed in form of functions.
Hierarchical 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. This model can be imagined as folders inside a folder.

Figure 1.4
Network model:
This is the enhanced version of hierarchical data model. It is designed to address the
drawbacks of the hierarchical model. It helps to address M:N relationship. This data model
is also represented as hierarchical, but this model will not have single parent concept. Any
child in the tree can have multiple parents here.

Figure-1.5
Relational model:
This model is designed to overcome the drawbacks of hierarchical and network models. It is
designed completely different from those two models. Those models define how they are
structured in the database physically and how they are inter-related. But in the relational
model, we are least bothered about how they are structured. It purely based on how the
records in each table are related. It purely isolates physical structure from the logical
structure. Logical structure is defines records are grouped and distributed.

Table 1.1 Table 1.2


Physical 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, foreign key etc. It basically represents how each tables are built and related to
each other in DB.
In short we can say a physical data model has
 Tables and its specifications – table names and their columns. Columns are
represented along with their data types and size. In addition primary key of each
table is shown at the top of the column list.
 Foreign keys are used to represent the relationship between the tables. Mapping
between the tables are represented using arrows between them.
 Physical data model can have denormalized structure based on the user requirement.
The tables might not be in normalized forms.
1.8 DATA BASE ACCESS FOR APPLICATION PROGRAMS:
 Data base will not interact directly it will use the software. It is called the embedded
software
 The software used is sql.
 This gives the commands to the front end people(navy users)
 The people who interact directly with data base they are known as data base
administrators .They have all rights on data base
 The sql statements are combined with the host users ie: front end is called “
embedded sql”
Data base users:
1. Application programmers: Through application statements interacts with DML
statements.
 Embedded to host language
2. Sophisticated users: Through direct SQLstatements.
3. Specialize users: Similar to sophisticated users but they write special data base
programs like by PL/SQL.
4. Naive users or unsophisticated: Interact with standalone permanent application
programs
5. Data base administrators: create, resolve the data .Grant permission to users.
Storage can be checked. Backup and recovery
DBA can check both technical and non-technical details of the data base.
TRANSACTION MANAGEMENT:
If the transaction is not done properly data will lose the consistency
 Eg: Booking the ticket
 The sequence of operation in an atomic in nature is called a transaction.
 Once the transaction is completed the reflection on data should be done immediately
if it is not done consistency will lose.
 Each transaction should follow the ACID properties
A-Atomicity
C-Consistency
I-Isolation
D-Durability
 Atomicity − this property states that a transaction must be treated as an atomic
unit, that is, either all of its operations are executed or none. There must be no
state in a database where a transaction is left partially completed. States should be
defined either before the execution of the transaction or after the
execution/abortion/failure of the transaction.
 Consistency − the database must remain in a consistent state after any
transaction. No transaction should have any adverse effect on the data residing in
the database. If the database was in a consistent state before the execution of a
transaction, it must remain consistent after the execution of the transaction as well.
 Durability − the database should be durable enough to hold all its latest updates
even if the system fails or restarts. If a transaction updates a chunk of data in a
database and commits, then the database will hold the modified data. If a
transaction commits but the system fails before the data could be written on to the
disk, then that data will be updated once the system brings back into action.
 Isolation − In a database system where more than one transaction are being
executed simultaneously and in parallel, the property of isolation states that all the
transactions will be carried out and executed as if it is the only transaction in the
system. No transaction will affect the existence of any other transaction.

Every transaction have 5 states:

Figure-1.6
 Active − in this state, the transaction is being executed. This is the initial state of
every transaction.
 Partially Committed − When a transaction executes its final operation, it is said to
be in a partially committed state.
 Failed − A transaction is said to be in a failed state if any of the checks made by
the database recovery system fails. A failed transaction can no longer proceed
further.
 Aborted − If any of the checks fails and the transaction has reached a failed state,
then the recovery manager rolls back all its write operations on the database to
bring the database back to its original state where it was prior to the execution of
the transaction. Transactions in this state are called aborted. The database recovery
module can select one of the two operations after a transaction aborts −
o Re-start the transaction
o Kill the transaction
 Committed − If a transaction executes all its operations successfully, it is said to be
committed. All its effects are now permanently established on the database system.

1.9 DATA BASE SYSTEM ARCHITECTURE:

Figure-1.7
DBMS architecture is mainly divided into 2 modules
1. Query processor
2. Storage manager

1.9.1. QUERY PROCESSOR:


The query processor components in dbms accepts sql commands generated from
variety of users interfaces ,produce query evaluation plan executes these plans with the
data base and return results.
The components are:
DML compiler:
It is which translates DML statements in query language, low level instruction that the
query evolution engine understands.
Embedded DML pre-compiler:
Sql commands can be embedded in host language application programs (c, c++, JAVA)
which can be converted into DML statements by this embedded DML precompiler. The
precompiler interact with the DML compiler to generate appropriate code.
DDL interpreter:
Which interprets the DDL statements and records them in a set of tables containing
metadata
Application program object code:
It is which is low level instructions of a program written by no voice users/naive users which
the query evaluation engine understands and execute them
Query evaluation engine:
It is which executes low level instructions generated by DML compiler.
1.9.2. STORAGE MANAGER:
The storage manager components in dbms provide the interface between the physical level
data stored in data base and the program on queries requesting the stored data from data
base.
The storage manager components are:
Authorization and integrity manager:
It is which test for the satisfaction of integrity constraints and checks the authority of user
to access the data.
Recovery manager:
It is which is responsible for maintaining a log and restoring the system to a consistent
state, after system failure.
Transaction manager:
It is which ensure that the data base remains in consistent state despite of the system
failure and the concurrent transaction execution proceed without conflicting the transaction.
Lock manager:
A lock is a mechanism used to control access to database objects.
Two kinds of locks are commonly supported by a DBMS: – Shared locks on an object can be
held by two different transactions at the same time.
Exclusive lock on an object ensures that no other transaction holds any lock on this object.
Every transaction begins by obtaining a shared lock on each data object that it needs to
read and an exclusive lock on each data that it needs to modify, and then release all its
locks after completing all actions.
It is which keeps track of requests for locks and grant locks on data in the data base.
Buffer manager:
It is which is responsible for fetching the data from disk storage into main memory and
deciding what data to cache memory.
Disk space manager:
It is which manages allocation of space on disk storage and the data structures used to
represent the stored information on disk.
Disk storage components are:
Data files:
Which stores the data base itself i.e. The actual data in the data base.
Data dictionary:
It is which stores the Meta data about the structure of data base .The data dictionary is
used very heavily. Therefore great emphasis should be placed on developing a good design
and efficient implementation of the data dictionary.
Indices:
It is which provides the fast access to the data items that hold the particular value.
Statistical data:
It stores the statistical data about the data in the database .This information is used by the
query processor to select efficient ways and to execute user queries.
DATABASE DESIGN WITH E-R MODEL
1.10 E-R model :
An entity–relationship model (ER model) is a systematic way of describing and
defining a business process. An ER model is typically implemented as a database. The main
components of E-R model are: entity set and relationship set.
Here are the geometric shapes and their meaning in an E-R Diagram –
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
A sample E-R Diagram:

Figure-1.8
What is Database Design?
Database Design is a collection of processes that facilitate the designing,
development, implementation and maintenance of enterprise data management
systems
It helps produce database systems
1. That meet the requirements of the users
2. Have high performance.
The main objectives of database designing are to produce logical and physical designs
models of the proposed database system.
The logical model concentrates on the data requirements and the data to be stored
independent of physical considerations. It does not concern itself with how the data will be
stored or where it will be stored physically.
The physical data design model involves translating the logical design of the database onto
physical media using hardware resources and software systems such as database
management systems (DBMS).

1.11 Attributes:

An Attribute describes a property or


characterstic of an entity. For example,
Name, Age, Address etc can be
attributes of a Student. An attribute is
represented using eclipse.

Figure-1.9

Key Attribute:

Key attribute represents the main


characterstic of an Entity. It is used to
represent Primary key. Ellipse with
underlying lines represent Key Attribute.

Figure-1.10
Composite Attribute:

An attribute can also have their own


attributes. These attributes are known
as Composite attribute.

Figure-1.11
Derived Attribute:

The last category that attributes can be


defined is called a derived attribute,
where one attribute is calculated from
another attribute.

Figure-1.12
Multivalued attribute:

multi-valued attributes usually can store


multiple data in them.

Figure-1.13

Descriptive Attribute:
. Attributes of the relationship is called descriptive attribute.

Figure-1.14
1.12 Entities: An entity set is a set of entities of the same type (e.g., all persons
having an account at a bank).
The entity set which does not have sufficient attributes to form a primary key is called as
Weak entity set.
An entity set that has a primary key is called as Strong entity set.

Figure-1.14
Relationship
Relationships are represented by diamond-shaped box. Name of the relationship is written
inside the diamond-box. All the entities (rectangles) participating in a relationship, are
connected to it by a line.
Binary Relationship and Cardinality:
A relationship where two entities are participating is called a binary relationship.
Cardinality is the number of instance of an entity from a relation that can be associated
with the relation.
 One-to-one − When only one instance of an entity is associated with the
relationship, it is marked as '1:1'. The following image reflects that only one
instance of each entity should be associated with the relationship. It depicts one-to-
one relationship.

Figure-1.15

 One-to-many − When more than one instance of an entity is associated with a


relationship, it is marked as '1:N'. The following image reflects that only one
instance of entity on the left and more than one instance of an entity on the right
can be associated with the relationship. It depicts one-to-many relationship.

Figure-1.15
 Many-to-one − When more than one instance of entity is associated with the
relationship, it is marked as 'N:1'. The following image reflects that more than one
instance of an entity on the left and only one instance of an entity on the right can
be associated with the relationship. It depicts many-to-one relationship.

Figure-1.16
 Many-to-many − The following image reflects that more than one instance of an
entity on the left and more than one instance of an entity on the right can be
associated with the relationship. It depicts many-to-many relationship.

Figure-1.17
Participation Constraints
 Total Participation − Each entity is involved in the relationship. Total participation
is represented by double lines.
 Partial participation − Not all entities are involved in the relationship. Partial
participation is represented by single lines.

Figure-1.18
1.13 Additional features of 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 entity to make further
higher level entity.
Figure-1.19
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,
some higher level entities may not have
lower-level entity sets at all.
Figure-1.20

Aggregation:

Aggregation is a process when relation


between two entity is treated as a single
entity. Here the relation between Center and
Course, is acting as an Entity in relation with
Visitor.
Figure-1.21

1.14 Conceptual Design:


• Conceptual design follows requirements analysis, Yields a high-level description of data to
be stored
• ER model popular for conceptual design. Constructs are expressive, close to the way
people think about their applications.
• Basic constructs: entities, relationships, and attributes (of entities and relationships)
• Constraints
• Some additional constructs: weak entities, ISA hierarchies
• Note: There are many variations on ER model

TEXT BOOK:
1. Raghurama Krishnan, Johannes Gehrke, Database Management Systems, 3 rd Edition,
TATA McGraw hill.
2. Web pages

You might also like