0% found this document useful (0 votes)
14 views

DBMS

Dbms pdf

Uploaded by

21mousumi19
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)
14 views

DBMS

Dbms pdf

Uploaded by

21mousumi19
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/ 4

@ Three-schema architecture: The Conceptual/ Internal Mapping lies between the conceptual level

o The three schema architecture is also called ANSI/SPARC and the internal level. Its role is to define the correspondence
architecture or three-level architecture. between the records and fields of the conceptual level and files and
o This framework is used to describe the structure of a data structures of the internal level.
specific database system. External/ Conceptual Mapping
o The three schema architecture is also used to separate the The external/Conceptual Mapping lies between the external level
user applications and physical database. and the Conceptual level. Its role is to define the correspondence
o The three schema architecture contains three-levels. It between a particular external and the conceptual view.
breaks the database down into three different categories.
In the above diagram @ Database Users & Administrations:
o It shows the DBMS architecture. People who work with a database can be -> Database users ->
o Mapping is used to transform the request and response database administrators
between various database levels of architecture. Database users: are the persons who interact with the database and
o Mapping is not good for small DBMS because it takes take the benefits of database. Users are differentiating by the way
more time. they expect to interact with the system. Types:-
o In External / Conceptual mapping, it is necessary to 1. Naïve users/ Native users/ End users: they are the
transform the request from external level to conceptual unsophisticated users who use the existing application to
schema. interact with the database. Ex- people accessing database
o In Conceptual / Internal mapping, DBMS transform the over the web, bank tellers, clerical staffs.
request from the conceptual to internal level. 2. Application programmers: They are the computer
Objectives of Three schema Architecture professionals who write the application programs. They
The main objective of three level architecture is to enable multiple interact with system through DML queries. Ex-Writing a C
users to access the same data with a personalized view while program to generate report of employees who are working
storing the underlying data only once. Thus it separates the user's in particular dept., will involve a query to fetch the data
view from the physical structure of the database. from database. It will include an embedded SQl query in
1. Internal Level the C program.
o The internal level has an internal schema which describes 3. Sophisticated users: They interact with the system by
the physical storage structure of the database. writing SQL queries directly through the query processor
o The internal schema is also known as a physical schema. (like SQL) without writing application programs. Ex-
o It uses the physical data model. It is used to define that Analysts, who submits SQL queries to explore data in
how the data will be stored in a block. DBMS.
o The physical level is used to describe complex low-level 4. Specialized users: They are also sophisticated users who
data structures in detail. write specialized database applications that do not fit into
2. Conceptual Level
the traditional data processing framework. They are the
o The conceptual schema describes the design of a database developers who develop the complex programs to the
at the conceptual level. Conceptual level is also known as
requirement. Ex- Computer-Aided Design (CAD) Systems,
logical level.
Experts Systems, Knowledge Based System, etc. that store
o The conceptual schema describes the structure of the complex data types (graphics and audio data) &
whole database.
environment modelling systems.
o The conceptual level describes what data are to be stored Database Administrators:
in the database and also describes what relationship exists
 DBA is a person or group that is responsible for
among those data.
supervising both the database and the use of the DBMS.
o In the conceptual level, internal details such as an  DBAs coordinate all the activities of the database system.
implementation of the data structure are hidden.
 They use specialised software to store and organize data.
o Programmers and database administrators work at this  They have all the permissions.
level.
DBA tasks:
3. External Level
 Schema definition
o At the external level, a database contains several schemas
 Storage structure and access method definition
that sometimes called as subschema. The subschema is
 Schema and physical organization modification
used to describe the different view of the database.
 Specifying integrity constrains
o An external schema is also known as view schema.
 Granting user authority to access database
o Each view schema describes the database part that a
 Monitoring performance & responding to changes in
particular user group is interested and hides the remaining
requirements
database from that user group.
 Routine maintenance
o The view schema describes the end user interaction with
 Acting as liaison with users
database systems.
Mapping between Views  Backing up and restoring databases
@ Normalization
The three levels of DBMS architecture don't exist independently of
A large database defined as a single relation may result in data
each other. There must be correspondence between the three levels
duplication. This repetition of data may result in:
i.e. how they actually correspond with each other. DBMS is
 Making relations very large.
responsible for correspondence between the three types of schema.
 It isn't easy to maintain and update data as it would
This correspondence is called Mapping.
involve searching many records in relation.
There are basically two types of mapping in the database
 Wastage and poor utilization of disk space and resources.
architecture:
 The likelihood of errors and inconsistencies increases.
o Conceptual/ Internal Mapping
So to handle these problems, we should analyse and decompose
o External / Conceptual Mapping
the relations with redundant data into smaller, simpler, and well-
Conceptual/ Internal Mapping
structured relations that are satisfying desirable properties.
Normalization is a process of decomposing the relations into  A table is in BCNF if every functional dependency X → Y, X
relations with fewer attributes. is the super key of the table.
What is Normalization?  For BCNF, the table should be in 3NF, and for every FD,
 Normalization is the process of organizing the data in the LHS is super key.
database. Rules for BCNF
 Normalization is used to minimize the redundancy from a Rule 1: The table should be in the 3rd Normal Form.
relation or set of relations. It is also used to eliminate Rule 2: X should be a super key for every functional dependency
undesirable characteristics like Insertion, Update, and (FD) X−>Y in a given relation.
Deletion Anomalies. Fourth normal form (4NF)
 Normalization divides the larger table into smaller and  A relation will be in 4NF if it is in Boyce Codd normal form
links them using relationships. and has no multi-valued dependency.
 The normal form is used to reduce redundancy from the  For a dependency A → B, if for a single value of A, multiple
database table. values of B exists, then the relation will be a multi-valued
Types of Normal Forms: dependency.
Normalization works through a series of stages called Normal Fifth normal form (5NF)
forms. The normal forms apply to individual relations. The relation is o A relation is in 5NF if it is in 4NF and not contains any join
said to be in particular normal form if it satisfies constraints. dependency and joining should be lossless.
Following are the various types of Normal forms: o 5NF is satisfied when all the tables are broken into as many
1NF: A relation is in 1NF if it contains an atomic value. tables as possible in order to avoid redundancy.
2NF: A relation will be in 2NF if it is in 1NF and all non-key o 5NF is also known as Project-join normal form (PJ/NF).
attributes are fully functional dependent on the primary key.
3NF: A relation will be in 3NF if it is in 2NF and no transition A relation R is in Fifth Normal Form if and only if everyone joins
dependency exists. dependency in R is implied by the candidate keys of R. A relation
BCNF: A stronger definition of 3NF is known as Boyce Codd's decomposed into two relations must have lossless join Property,
which ensures that no spurious or extra tuples are generated
normal form. when relations are reunited through a natural join.
4NF: A relation will be in 4NF if it is in Boyce Codd's normal form Properties
and has no multi-valued dependency. A relation R is in 5NF if and only if it satisfies the following
5NF: A relation is in 5NF. If it is in 4NF and does not contain any join conditions:
dependency, joining should be lossless. 1. R should be already in 4NF.
First Normal Form (1NF) 2. It cannot be further non loss decomposed (join
 A relation will be 1NF if it contains an atomic value. dependency).
@ Join Dependency
 It states that an attribute of a table cannot hold multiple
Join decomposition is a further generalization of multivalued
values. It must hold only single-valued attribute. dependencies. If the join of R1 and R2 over C is equal to relation
 First normal form disallows the multi-valued attribute, R then we can say that a join dependency (JD) exists, where R1
composite attribute, and their combinations. and R2 are the decomposition R1(A, B, C) and R2(C, D) of a
Second Normal Form (2NF) given relations R (A, B, C, D). Alternatively, R1 and R2 are a
 In the 2NF, relational must be in 1NF. lossless decomposition of R. A JD ⋈ {R1, R2, …, Rn} is said to
 In the second normal form, all non-key attributes are fully hold over a relation R if R1, R2, ….., Rn is a lossless-join
functional dependent on the primary key decomposition. The *(A, B, C, D), (C, D) will be a JD of R if the
join of joins attribute is equal to the relation R. Here, *(R1, R2, R3)
Third Normal Form (3NF)
is used to indicate that relation R1, R2, R3 and so on are a JD of
 A relation will be in 3NF if it is in 2NF and not contain any
R. Let R is a relation schema R1, R2, R3……..Rn be the
transitive partial dependency. decomposition of R. r( R ) is said to satisfy join dependency if and
 3NF is used to reduce the data duplication. It is also used only if
to achieve the data integrity.
 If there is no transitive dependency for non-prime
attributes, then the relation must be in third normal form. Joint Dependency
A relation is in third normal form if it holds at least one of the o Join decomposition is a further generalization of
following conditions for every non-trivial function dependency X → Multivalued dependencies.
Y. o If the join of R1 and R2 over C is equal to relation R, then
1. X is a super key. we can say that a join dependency (JD) exists.
2. Y is a prime attribute, i.e., each element of Y is o Where R1 and R2 are the decompositions R1(A, B, C) and
R2(C, D) of a given relations R (A, B, C, D).
part of some candidate key.
Boyce Codd normal form (BCNF) o Alternatively, R1 and R2 are a lossless decomposition of R.
Application of the general definitions of 2NF and 3NF may o A JD ⋈ {R1, R2,..., Rn} is said to hold over a relation R if R1,
identify additional redundancy caused by dependencies that R2,....., Rn is a lossless-join decomposition.
violate one or more candidate keys. However, despite these o The *(A, B, C, D), (C, D) will be a JD of R if the join of join's
additional constraints, dependencies can still exist that will cause attribute is equal to the relation R.
redundancy to be present in 3NF relations. This weakness in 3NF o Here, *(R1, R2, R3) is used to indicate that relation R1, R2,
R3 and so on are a JD of R
resulted in the presentation of a stronger normal form
called the Boyce-Codd Normal Form (Codd, 1974). Although, 3NF
What is Join?
is an adequate normal form for relational databases, still, this Join is an operation in DBMS(Database Management System)
(3NF) normal form may not remove 100% redundancy because of that combines the row of two or more tables based on related
X−>Y functional dependency if X is not a candidate key of the columns between them. The main purpose of Join is to retrieve
given relation. This can be solved by Boyce-Codd Normal Form the data from multiple tables in other words Join is used to
(BCNF). perform multi-table query. It is denoted by ⨝.
Syntax-
 BCNF is the advance version of 3NF. It is stricter than 3NF. R3 <- ⨝(R1) <join_condition> (R2)
where R1 and R2 are two relations to be join and R3 is a relation
that will holds the result of join operation.
Types of Join Table A Table B
1. Inner Join Number Square Number Cube
2. Outer join
Inner join
Inner Join is a join operation in DBMS that combines two or more 2 4 2 8
table based on related columns and return only rows that have
matching values among tables.Inner join of two types.
3 9
 Equi Join 3 27

 Natural Join
Equi Join 4 16 5 75
Equi Join is a type of Inner join in which we use equivalence(‘=’)
condition in join condition. A⟕B
Example: Result:
Table A Table B
Number Square Cube
Column Column Column Column
A B A B 2 4 8

a a a a
3 9 27

a b a c 4 16 –

Right Outer Join


A ⨝ A.Column B = B.Column B (B) It is also called right join. This type of outer join retrieve all records
Result: from right table and retrive maching record from right table.
Example:
Column Column
Table A and Table B are same as in left outer join
A B
A⟖B
Number Square Cube
a a

Natural Join 2 4 8
Natural join is a type of inner join in which we not need of any
comparison operators. In natural join columns should have the
same name and domain. There should be at least one common 3 9 27
attribute between two tables.
Eample:
Table A Table B 5 – 75

Number Square Full Outer Join


Number Cube
In full outer join all the rows from both table are inserted in result
table
2 4
2 8 Eaxmple:
Table A and Table B are same as in left outer join
A⟗B
3 9
3 27 Result:
A⨝B Number Square Cube

Number Square Cube


2 4 8

2 4 8
3 9 27

3 9 27
4 16 –
Outer Join

Outer join is a type of join that retrieve matching as well as non- 5 – 75


maching records from related tables.
There three types of outer join
@ Concurrently control is a very important concept of DBMS
 Left outer join which ensures the simultaneous execution or manipulation of data
 Right outer join by several processes or user without resulting in data
 Full outer join inconsistency. Concurrency Control deals with interleaved
Left Outer Join execution of more than one transaction.
It is also called left join. This type of outer join retrieve all records #Executing a single transaction at a time will increase the
from left table and retrive maching record from right table. waiting time of the other transactions which may result in
Example: delay in the overall execution. Hence for increasing the overall
throughput and efficiency of the system, several transactions
are executed. #Concurrently control is a very important
concept of DBMS which ensures the simultaneous execution
or manipulation of data by several processes or user without Components of ER model:-
resulting in data inconsistency. #Concurrency control provides ER Model consists of Entities (strong & weak), Attributes (key,
a procedure that is able to control concurrent execution of composite, multivalued, derived), and Relationships (1-1, 1-many,
the operations in the database. many-1, many-many) among Entities in a Database System.
Concurrency Control Protocols Entity
Concurrency control protocols are the set of rules which are An Entity may be an object with a physical existence – a particular
maintained in order to solve the concurrency control problems in person, car, house, or employee – or it may be an object with a
the database. It ensures that the concurrent transactions can conceptual existence – a company, a job, or a university course.
execute properly while maintaining the database consistency. The Entity Set: An Entity is an object of Entity Type and a set of all
concurrent execution of a transaction is provided with atomicity, entities is called an entity set. For Example, E1 is an entity having
consistency, isolation, durability, and serializability via the Entity Type Student and the set of all students is called Entity Set.
concurrency control protocols. In ER diagram, Entity Type is represented as:
 Locked based concurrency control protocol @ DBMS Architecture
 Timestamp based concurrency control protocol The DBMS design depends upon its architecture. The basic client/server
@ 2-Phase Locking Protocol: Two phase locking is a widely used architecture is used to deal with a large number of PCs, web servers,
technique which ensures strict ordering of lock acquisition and database servers and other components that are connected with networks.
release. Two phase locking protocol works in two phases. #The client/server architecture consists of many PCs and a workstation
 Growing Phase: In this phase, the transaction starts acquiring which are connected via the network. #DBMS architecture depends upon
locks before performing any modification on the data items. how users are connected to the database to get their request done.
Types:-
Once a transaction acquires a lock, that lock can’t be released
1-Tier Architecture
until the transaction reaches the end of the execution. In this architecture, the database is directly available to the user. It means
 Shrinking Phase: In this phase, the transaction releases all the the user can directly sit on the DBMS and uses it. #Any changes done here
acquired locks once it performs all the modifications on the will directly be done on the database itself. It doesn't provide a handy tool
data item. Once the transaction starts releasing the locks, it for end users. #The 1-Tier architecture is used for development of the local
cannot acquire any locks further. application, where programmers can directly communicate with the
Timestamp based Protocol: database for the quick response.
In this protocol each transaction has a timestamp attached to it. 2-Tier Architecture
Timestamp is nothing but the time in which a transaction enters The 2-Tier architecture is same as basic client-server. In the two-tier
into the system. * The conflicting pairs of operations can be architecture, applications on the client end can directly communicate with
resolved by the timestamp ordering protocol through the utilization the database at the server side. For this interaction, API's
of the timestamp values of the transactions. Therefore, like: ODBC, JDBC are used. #The user interfaces and application programs
guaranteeing that the transactions take place in the correct order. are run on the client-side. #The server side is responsible to provide the
@ Concurrent Execution in DBMS functionalities like: query processing and transaction management. #To
In a multi-user system, multiple users can access and use the same communicate with the DBMS, client-side application establishes a
database at one time, which is known as the concurrent execution connection with the server side.
of the database. It means that the same database is executed 3-Tier Architecture
simultaneously on a multi-user system by different users. #While working The 3-Tier architecture contains another layer between the client and server.
on the database transactions, there occurs the requirement of using In this architecture, client can't directly communicate with the server. #The
application on the client-end interacts with an application server which
the database by multiple users for performing different operations,
further communicates with the database system. #End user has no idea
and in that case, concurrent execution of the database is performed.
about the existence of the database beyond the application server. The
# The thing is that the simultaneous execution that is performed
database also has no idea about any other user beyond the application.
should be done in an interleaved manner, and no operation should #The 3-Tier architecture is used in case of large web application.
affect the other executing operations, thus maintaining the
consistency of the database. Thus, on making the concurrent
execution of the transaction operations, there occur several
challenging problems that need to be solved.

@ ER Model
The Entity Relational Model is a model for identifying entities to be
represented in the database and representation of how those
entities are related. The ER data model specifies enterprise schema
that represents the overall logical structure of a database
graphically.
The Entity Relationship Diagram explains the relationship among
the entities present in the database. ER models are used to model
real-world objects like a person, a car, or a company and the
relation between these real-world objects. In short, the ER Diagram
is the structural format of the database.
Symbols Used in ER Model
 Rectangles: Rectangles represent Entities in the ER Model.
 Ellipses: Ellipses represent Attributes in the ER Model.
 Diamond: Diamonds represent Relationships among Entities.
 Lines: Lines represent attributes to entities and entity sets with other
relationship types.
 Double Ellipse: Double Ellipses represent Multi-Valued Attributes
 Double Rectangle: Double Rectangle represents a Weak Entity.

You might also like