0% found this document useful (0 votes)
20 views22 pages

DBMS Unit1 Final

This document provides an overview of key concepts in database management systems including: 1. It introduces database management systems and their advantages over file processing systems. 2. It describes the client-server architecture and three-tier architecture used in database systems. 3. It discusses Entity Relationship (ER) diagrams and how they are used to map relationships between entities and constraints. 4. It provides an introduction to keys such as primary and foreign keys used to link tables in a relational database.

Uploaded by

riyanshu singh
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)
20 views22 pages

DBMS Unit1 Final

This document provides an overview of key concepts in database management systems including: 1. It introduces database management systems and their advantages over file processing systems. 2. It describes the client-server architecture and three-tier architecture used in database systems. 3. It discusses Entity Relationship (ER) diagrams and how they are used to map relationships between entities and constraints. 4. It provides an introduction to keys such as primary and foreign keys used to link tables in a relational database.

Uploaded by

riyanshu singh
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/ 22

DATABASE MANAGEMENT SYSTEMS

Section A: Introduction, Client Server Arch., E-R Diagram and Keys

Overview of database Management System; Various views of data, data Models,


Introduction to Database Languages. Advantages of DBMS over file processing systems,
Responsibility of Database Administrator, Introduction to Client/Server architecture,
Three levels architecture of Database Systems, ER Diagram (Entity Relationship),
mapping Constraints, Keys, Reduction of E-R diagram into tables.

Overview:
->Data: These are the characteristics usually numerical data that are observed
through observations.
->Data is any known facts or any smallest information that can be recorded and
have implicit meaning.
->Any fact and figure about an entity that can be recorded is called data.
Data is a raw and unorganized fact that is required to be processed to make it
meaningful.
e.g. Deepak , Btech , audio , number , map , etc.

Information: Processed data is called information.


->The form of data in a processed, organized, specific and structured manner is
known as information.
-> (when data is a processed, organized, structured or presented in a given context
to make it more useful. It is called as information.)
e.g. 10 employee have salary 20k per month.

Basis of Comparison Data Information

It refers to raw
Information are facts
facts which one
regarding something
gathers about
Meaning put into context
something and
which are refined
are bare and
through processing
random.
They are text,
numbers,
Nature It is refined data
symbols and
more

Form Unorganized Organized

Data is not Information is


Specific
specific specific

Records plus
Based On It is based on analysis
observations

Data does not We cannot process


Dependency depend on information without
information data

It may or may not Information always


Use
come in use come in use

We measure
We measure data information in units
Measurement
in bits and bytes of time, quantity and
more

A student’s exam The average score of


Example
score the class
Database: It is organized collection of data generally stored and accessed
electronically from a computer system.
e.g. name, age , salary are the collection of related data.
Name age Salary
Ram 31 19000
Shyam 25 21000

Database system: it is a system in which an user users the database technology in


order to achieve an organized ,store a large number of dynamic associated data with
the help of hardware, software(DBMS), operating system
-> Database system provide a convenient way to store, retrieve as well as
manipulate data.

So , database consists of 5 major parts


1.hardware 2.software(DBMS) 3.data 4.procedure 5.people

DBMS: It is a set of software programs that allows users to create, edit and update
data in database files , and store and retrieve data from those database files.
e.g. oracle, MySQL, MSSQL Server, SQL ,DB2(IBM)

->database management system (dbms) is used to organize the data in form of a


table, schema, view and report , graph, tree , document ,etc.
->the primary goal of a dbms is to provide a way to store and retrieve database
information that is both convenient and efficient.
DBMS= database + management system
->Dbms is a collection of programs that enables users to create and maintain the
database.
->Dbms can also be define as an interface between N users , the application
program and the operating system to access and manipulate the database.
Why DBMS?

 To develop software applications In less time.


 Data independence and efficient use of data.(accuracy, consistent ,
completeness)
 For uniform data administration.
 For data integrity and security.
 For concurrent access to data, and data recovery from
crashes.(concurrent access means more than one user can use)
 To use user-friendly declarative query language.

DBMS application

1. Banking –to store the exchange data of the client ,transaction details , etc.
2. Railway Reservation System – to store the record or information of ticket
appointments, status about train’s appearance, and flight.
3. Airlines-to store the records of flight takeoff, appearance, and defer status.
4. Universities/ education sector
5. Online shopping
6. Human Resource Management-They store data about worker’s
compensation, assessment, and work.
7. Manufacturing- To keep the data about their items like bills, acquisition of
the item, amount, inventory.
8. Social media sites-to store data of users
9. Library Management System –to store all the data identified with the name
of the book, issue date, accessibility of the book, and its writer.
10.Credit card exchanges –The database Management framework is utilized for
buying on charge cards and age of month to month proclamations.

Advantages of DBMS

 Data independence: Application programs should be as free or independent


as possible from details of data representation and storage.
 Efficient data access: DBMS utilizes a mixture of sophisticated concepts
and techniques for storing and retrieving data competently and
efficiently.
 Data integrity and security: If data is accessed through the DBMS, the
DBMS can enforce integrity constraints on the data.
 Data administration: it is a high level function that is responsible for overall
management of data resources in an organization . it includes database
planning, analysis , design , implementation , maintainence and data
protection. It reduces data redundancy and make data retrieval efficient.
Components of DBMS

 Users: Users may be of any kind such as DB


administrator, System developer, or database
users.
 Database application: Database application
may be Departmental, Personal,
organizational and / or Internal.
 DBMS: Software that allows users to create
and manipulate database access,
 Database: Collection of logical data as a
single unit.

Views of data

->Views of data refer to the different ways to show the database management
system to the user hiding its complexity.
->Views of data refers to how data is stored in database, what data is stored and
what will be the structure of data.
So, there are 2 views of data :- 1. Data abstraction 2.Schemas and
instances
->The database is highly complex data. Developers hide the complexity of data
structure which might not be familiar with the end-users. So, they provide
abstract views of data. This is called data abstraction. There are 3 levels of
abstraction. They are:

1. Physical level:
( also k/a internal level)
->The physical level describes how
the data is stored in the hardware.
->It also describes how the data can
be accessed.
->The physical level shows the data
abstraction at the lowest level and it
has complex data structures.
-> Only the data administrators
operate at this level.
2. Logical (conceptual) level: it is a level above the physical level, here the data
is stored in the form of entity set, entities, their data types, the relationship
among the entity sets.
->This level of abstraction describes what data are stored in the database
and what relationship exists among those data.
3. View level: it is the highest level of data abstraction and exhibit only a part
of the whole database. It exhibits the data in which the user is interested.
->The view level can describe many views of the same data.
-> Here we user retrieve the info using different application from the
database.

Database Administration

Database administration refers to the whole set of activities performed by a


database administrator to ensure that a database is always available as needed.
 Software installation and maintenance
 Managing and integrity
 Takes care of data extraction, transformation and loading
 Monitoring performance
 Data handling
 Create a database backup plan
 Database recovery
 Database accessibility
 Provide support to users
 Troubleshooting
Data Models

->Data models define how data is connected to each other and how they are
processed and stored inside the system.
->Data model is a collection of concepts that can be used to describe the
structure of the database including data types, relationships and the constraints
applied on data.
->It ensure the nature of data independent of its physical
representation(byte,word,etc)
->The data model supports the communication between the users and database
designers.
Characterstics of a data model
1.bottom up approach must be followed.
2. diagrammatic representation
3.application independent
4.data representation must not be duplicate.
5.consistency and standard validation must be maintained.
->There are two types of data models:-
1. Entity relationship model: Entity-Relationship (ER) Model is based
on the notion of real-world entities and relationships among them.

 Entity − An entity in an ER Model is a real-world entity having


properties called attributes. Every attribute is defined by its set of
values called domain. For example, in a school database, a student is
considered as an entity. Student has various attributes like name,
age, class, etc.
 Relationship − The logical association among entities is
called relationship. Relationships are mapped with entities in various
ways.
Mapping cardinalities define the number of association between two
entities.
 Entity set- collection of same type of entities , that share the same
property or attribute.
In an ER diagram,it is represented by a rectangle. In a relational
model,it is represented by a separate table.
 Attributes-these are the units which describes the properties and
characterstics of the entity.
these are descriptive property by each members of an entity set. For
each attribute, there is a set of permitted values called the domain.
It is represented by connected oval or ellipse to the concerned entity
set.
Types of attributes:-
1.single valued:- represented by single oval. E.g. aadhar no. ,
passport no.
2.multivalued :- represented by double oval. E.g. phone no
3.simple attribute:- cannot be subdivided. E.g. roll no.
4.composite attribute:-can be subdidvided. E.g.name-firstname,
middlename, last name.
5.stored attribute:-data which is constant and fixed. E.g. DOB
6.derived attribute:- (dotted oval) derived from stored attribute . e.g.
age
7.descriptive attribute:- the attribute which describes the relations.an
attribute takes a null values when the entity does not have values for it.
2.Relational model: The most popular data model in DBMS is the
Relational Model. It is more scientific a model than others. This model is
based on first-order predicate logic and defines a table as an n-ary relation.
->The relational model in DBMS is an abstract model used to organize and
manage the data stored in a database.

 It stores data in 2D inter related tables called relations in which each


row represents an entity and each column represents the property
of the entity.
 Relations can be normalized.
 In normalized relations, values saved are atomic values.
 Each row in a relation contains a unique value.
 Each column in a relation contains values from a same domain.
Database Language
A DBMS provides appropriate language and interface for each category of users
to express database queries and updates. To perform operations like insertion,
deletion, updating, and modification of data a set of languages are provided by
the database management system (DBMS). So, the database languages are used
to read, update and store data in the database.

1. Data Definition Language (DDL): It is a language that allows the user to


define the data and their relationship to other types of data.
The DDL commands are: Create, Alter, Rename, Drop(remove table
definition) , Truncate(remove all rows from a table but table structure
remains same).
2. Data Manipulation language (DML): It is a language that provides a set of
operations to support the basic data manipulation operation on data held
in the database. The DML commands are: Insert, delete, update, select,
merge, call.

3. Data Control Language (DCL) : DCL is used to access the stored data. It is
mainly used for revoke and grant the user access to a database.
The DCL commands are: Grant(used to give access to the users or other
rights or opportunities to the database) , Revoke(used to remove granted
permission).

4. Transaction Control Language (TCL) : TCL is a language which manages the


transactions within the database. It is used to execute the changes made
by the data manipulation language statements.
The TCL commands are: Commit(used for permanently save all the changes
made in the transaction of a database), Rollback(used to erase all the data
modifications made from savepoint).

File System: A File Management system is a DBMS that allows access to


single files or tables at a time. In a File System, data is directly stored in a set of
files.
->It contains flat files that have no relation to other files (when only one table
is stored in a single file, then this file is known as a flat file).
Disadvantage with file system
 Data redundancy and inconsistency
 Difficulty in accessing data
 Data isolation
 Integrity problem
 Automaticity problem
 Concurrent accessing a nominee

Advantages of DBMS over File system


 Data redundancy and inconsistency: Redundancy is the concept of
repetition of data i.e. each data may have more than a single copy. The
file system cannot control the redundancy of data but DBMS can.
 Data sharing: The file system does not allow sharing of data or sharing is
too complex. Whereas in DBMS, data can be shared easily due to a
centralized system.
 Data security: A file system provides a password mechanism to protect
the database
 Easy Maintenance: It is easily maintainable due to its centralized nature.
 Data concurrency: Concurrent access to data means more than one user
is accessing the same data at the same time. Anomalies occur when
changes made by one user get lost because of changes made by another
user. The file system does not provide any procedure to stop anomalies
but DBMS does.
 Data searching: For every search operation performed on the file
system, a different application program has to be written. While DBMS
provides inbuilt searching operations.

Types of users of database


1. Native users: these are the users that don’t have any idea about database
and access the database by menu oriented interface.
->They are the end users of database system who work through a menu
driven application program where the type and size of the program is
always indicated to the user.
2. Online users: these users communicate directly through an online
terminal or directly through user interface and application program.
3. Sophisticated users: Those users who interact with the system without
writing the program instead they form their request in DB query
language.
->They are SQL programmers who directly deal with the database. They
write queries to delete, select or insert the database.
4. Application programmers: users who are responsible for developing the
application programs or user interface. It can be written in high level
languages.
5. Database administrator: has the complete control over database. A DA
has a lot of responsibilities and is responsible for overall performance of
database. He is free to take decision for database and provides technical
support.
6. Specialized users: who writes a specialized queries like queries in shell
programming to access database.

Responsibilities of database administrator


1. Makes the decision concerning the content of the database.
2. Plans the storage structure and access strategy.
3. Monitoring the performance and responding to the changes in the
requirements.
4. Provides the support to the users.
5.deciding the user view
6. approving data access
7. backup and recovery strategies : the DBA ensures to periodically backup
the database on remote servers. In case of failure, database is recovered
from this backup.
8. Defines the security and integrity checks
9.creates free space (by removing dumps i.e. unnecessary data)
10. deciding hardware and software
Schemas
Design of data is called the schema. It is basically a skeleton structure that
represents the logical view of entire database.
It defines, how data is organized and how it is should get associated. It
formulate all the constraints that are to be applied on the data.
Multiple type of schema
 Physical schema: database design at physical level is known as physical
schema. It tells form of storage like file indexers, word, bytes, bits, etc.
 Logical schema: it is designed at logical level. It defines logical constraints
like tables views integrity constraints. It defines relationship between
tables and keys.
 View schema: it is the design at view level. We can have several schemas
at view level that are involved with various users of the database. It is also
known as sub-schema.

Instance
Collection of information stored in database at a particular moment is called
instance.
Mapping
The mapping of data among the level of database. There are 2 types of
mapping:
1. Conceptual or external mapping: data is transferred from conceptual level
to external level or vise-versa.
2. Internal or conceptual mapping : data is transferred from internal level to
conceptual level or vise-versa.

DBMS Architecture
o The DBMS design depends upon its architecture. The basic client/server
architecture is used to deal with a large number of PCs, web servers,
database servers and other components that are connected with networks.
o The client/server architecture consists of many PCs and a workstation
which are connected via the network.
o DBMS architecture depends upon how users are connected to the
database to get their request done.
o Generally the client process requires some resources which are provided
by server to the client.
o The three components of a client-server model are:
o Presentation logic: responsible for formatting or presenting data on
user screen.
o Storage logic: responsible for data storage
o Processing logic: it handles data processing logic, business rule logic
and data management logic.
o Disadvantage
1. Traffic congestion or network is an issue.
2. If a critical server fails then the client’s request cannot be
fulfilled.
o Advantage
1. Provide security
2. User friendly
interface
3. Server guarantee to
those clients who have
permission may access and
change the data.

Types:

logically, database architecture is of two types like: 2-tier architecture and 3-tier
architecture.
1-Tier Architecture
o In this architecture, the database is directly available to the user. It means the user
can directly sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It doesn't
provide a handy tool for end users.
o The 1-Tier architecture is used for development of the local application, where
programmers can directly communicate with the database for the quick response.

2-Tier Architecture
o The 2-Tier architecture is same as basic client-server. In the two-tier
architecture, applications on the client end can directly communicate with
the database at the server side. For this interaction, API's like: ODBC (open
database connectivity), JDBC(are used.
o The user interfaces and application programs are run on the client-side.
o The server side is responsible to provide the functionalities like: query
processing and transaction management.
o To communicate with the DBMS, client-side application establishes a
connection with the server side.
Advantage
1. Modification is easy
2. Communication is fast

Disadvantage
1. Performance degrades when
number of users increses.

3-Tier Architecture
o The 3-Tier architecture contains another layer between the client and server.
In this architecture, client can't directly communicate with the server.
o The application on the client-end interacts with an application server which
further communicates with the database system.
o End user has no idea about the existence of the database beyond the
application server. The database also has no idea about any other user
beyond the application.
o The 3-Tier architecture is used in case of large web application.
o Many clients can be responded at an instant.

Advantage
1.Data security is guaranteed and
scalability (more no. of clients can
be handled)
2.allows complex processing to
take place at server side.

Disadvantage
1.create an increased need of
network traffic management, fault
tolerance.
2.performance loss if distributed
widely over internet.
Entity- Relationship Model (ER model)

It is a non-technical design method that works on conceptual level based on the


perception of real world. It is diagrammatical representation that is easy to
understand even by a non-technical user.

->it defines the conceptual or logical view of database. It is used for designing
database.

->it works around real world entities and the relationship among them.

->the database schema in ER model can be represented partially as ER diagram.


using ER model , we can easily transform data into relational tables.

Entity is a real world object distinguishable from other object based on the
values of the attributes it processes. It is represented as rectangles. Entities
become table in relational model. entities has attributes that give them their
identity.

Entity set = Collection of same type of entities that share the same properties or
attributes. In an ER diagram.
Attribute : These are the units which describes the
properties and characteristics of the entities. These
are descriptive properties by each member of
entity setup. For each attribute, there is a set of
permitted values called the domain. Attributes are
represented by a connected oval (or eclipse) to concerned entity set.

Types of attributes

-1>Key Attribute or single valued attribute–


The attribute which uniquely identifies each
entity in the entity set is called key attribute. For
example, Roll_No will be unique for each
student. In ER diagram, key attribute is
represented by an oval with underlying lines.

-2>Composite Attribute –
An attribute composed of many other attribute is called as composite
attribute. For example, Address attribute of student Entity type consists of
Street, City, State, and Country. In ER diagram, composite attribute is
represented by an oval comprising of ovals.

-3> Multivalued Attribute –


An attribute consisting more than one value for a given
entity. For example, Phone_No (can be more than one
for a given student). In ER diagram, a multivalued
attribute is represented by a double oval.

-4>simple attribute-
It consists of atomic values that can’t be further divided. E.g. student’s phone
number
-5>Stored attribute –are physically stored in a database.
Eg DOB (1/1/2000)

-6>Derived Attribute – are the attributes that do not


exist in physical database but their values are derived
from other attributes of the entity type is known as a
derived attribute. e.g.; Age (can be derived from
DOB).
In ER diagram, the derived attribute is represented by a dashed oval.

-7>descriptive attribute :
Attribute of relationship is called descriptive attribute. the attribute which
describes the relations.an attribute takes a null values when the entity does not
have values for it.
The complete entity type Student with its attributes can be represented as:

Type and Relationship Set:


A relationship type represents the association between entity types. For
example, ‘Enrolled in’ is a relationship type that exists between entity type
Student and Course.
->In ER diagram, the relationship type is represented by a diamond and
connecting the entities with lines.
A set of relationships of the same type is known as a relationship set. The
following relationship set depicts S1 as enrolled in C2, S2 is enrolled in C1, and
S3 is enrolled in C3.

Degree of a relationship set:


The number of different entity sets participating in a relationship set is called
as the degree of a relationship set.

1. Unary Relationship –
When there is only ONE entity set participating in a relation, the
relationship is called a unary relationship. For example, one person is
married to only one person.

2. Binary Relationship –
When there are TWO entities set participating in a relationship, the
relationship is called a binary relationship. For example, a Student is
enrolled in a Course.
3. Ternary Relationship –
When there are Three entities set participating in a relationship, the
relationship is called a Ternary relationship.

4. n-ary Relationship –
When there are n entities set participating in a relation, the relationship is
called an an n-ary relationship.

Cardinality: The number of times an entity of an entity set participates in a


relationship set is known as cardinality.
Or we can say that the cardinality of a relationship is the number of tuples
(rows) in a relationship.

Cardinality can be of different types:

1. One-to-one – When each entity in each entity set can take part only once in
the relationship, the cardinality is one-to-one.
Let us assume that a male can marry one female and a female can marry one
male. So the relationship will be one-to-one.
the total number of tables that can be used in this is 2.

Using Sets, it can be represented as:

2. Many to one – When entities in one entity set can take part only once in
the relationship set and entities in other entity sets can take part more than
once in the relationship set, cardinality is many to one.
Let us assume that a student can take only one course but one course can be
taken by many students. So the cardinality will be n to 1. It means that for one
course there can be n students but for one student, there will be only one
course.
The total number of tables that can be used in this is 3.

Using Sets, it can be represented as:

3. Many to many – When entities in all entity sets can take part more than
once in the relationship cardinality is many to many. Let us assume that a
student can take more than one course and one course can be taken by many
students. So the relationship will be many to many.
the total number of tables that can be used in this is 3.

Using sets, it can be


represented as:

In this example, student S1


is enrolled in C1 and C3
and Course C3 is enrolled
by S1, S3, and S4. So it is
many-to-many
relationships.
In this, there is one-to-many mapping as well where each entity can be related
to more than one relationship and the total number of tables that can be used
in this is 2.

Participation Constraint:
Participation Constraint is applied to the entity participating in the relationship
set.
1. Total Participation – Each entity in the entity set must participate in the
relationship. Total participation is shown by a double line in the ER diagram.
If each student must enroll in a course, the participation of students will be
total.
2. Partial Participation – The entity in the entity set may or may NOT
participate in the relationship.
partial participation is shown by a single line in the ER diagram.
If some courses are not enrolled by any of the students, the participation of
the course will be partial.
The diagram depicts the ‘Enrolled in’ relationship set with Student Entity set
having total participation and Course Entity set having partial participation.

Using set, it can be represented as,

Every student in the Student


Entity set is participating in a
relationship but there exists
a course C4 that is not taking
part in the relationship.

Mapping constraints
o A mapping constraint is a data constraint that expresses the number of
entities to which another entity can be related via a relationship set.
o Mapping cardinality(cardinality ratio) : defines the relationship between
numbers of entities in one entity set with the number of entities to other
entity sets.
o It is most useful in describing the relationship sets that involve more than
two entity sets.
o For binary relationship set R on an entity set A and B, there are four possible
mapping cardinalities. These are as follows:
1. One to one (1:1)
2. One to many (1:M)
3. Many to one (M:1)
4. Many to many (M:M)

One-to-one

In one-to-one mapping, an entity in E1


is associated with at most one entity
in E2, and an entity in E2 is associated
with at most one entity in E1.

One-to-many

In one-to-many mapping, an entity


in E1 is associated with any number
of entities in E2, and an entity in E2
is associated with at most one entity
in E1.

Many-to-one

In one-to-many mapping, an
entity in E1 is associated with at
most one entity in E2, and an
entity in E2 is associated with any
number of entities in E1.

Many-to-many

In many-to-many mapping, an
entity in E1 is associated with any
number of entities in E2, and an
entity in E2 is associated with any
number of entities in E1.

You might also like