DBMS Unit 1
DBMS Unit 1
DBMS Unit 1
Database:
For example: The college Database organizes the data about the admin,
staff, students and faculty etc.
Using the database, you can easily retrieve, insert, and delete the
information.
Data Retrieval: It is used to retrieve the data from the database which
can be used by applications for various purposes.
Characteristics of DBMS:
Disadvantages of DBMS:
Size: It occupies a large space of disks and large memory to run them
efficiently.
2-Tier architecture:
If the architecture of DBMS is 2-tier, then it must have an
application through which the DBMS can be accessed.
Programmers use 2-tier architecture where they access the DBMS
by means of an application. Here the application tier is entirely
independent of the database in terms of operation, design, and
programming.
3-Tier architecture:
A 3-tier architecture separates its tiers from each other based on
the complexity of the users and how they use the data present in
the database. It is the most widely used architecture to design a
DBMS.
Database (Data) Tier − At this tier, the database resides along
with its query processing languages. We also have the relations
that define the data and their constraints at this level.
Application (Middle) Tier − At this tier reside the application
server and the programs that access the database. For a user, this
application tier presents an abstracted view of the database. End-
users are unaware of any existence of the database beyond the
application. At the other end, the database tier is not aware of
any other user beyond the application tier. Hence, the application
layer sits in the middle and acts as a mediator between the end-
user and the database.
User (Presentation) Tier − End-users operate on this tier and they
know nothing about any existence of the database beyond this
layer. At this layer, multiple views of the database can be
provided by the application. All views are generated by
applications that reside in the application tier.
6. Compiled DML:
o The DML complier converts the high level Queries into low
a.Authorization Manager
b.Integrity Manager
c.Transaction Manager
d.File manager
e.Buffer Manager
1. Physical Level
2. Conceptual Level
3. External Level
Hierarchical Model
Network Model
Entity-relationship Model
Relational Model
Hierarchical Model
This database model organises data into a tree-like-structure, with a
single root, to which all the other data is linked. The heirarchy starts
from the Root data, and expands like a tree, adding child nodes to the
parent nodes.
In this model, a child node will only have a single parent node.
This model efficiently describes many real-world relationships like
index of a book, recipes etc.
In hierarchical model, data is organised into tree-like structure with one
one-to-many relationship between two different types of data, for
example, one department can have many courses, many professors and
of-course many students.
Network Model
This is an extension of the Hierarchical model. In this model data is
organised more like a graph, and are allowed to have more than one
parent node.
In this database model data is more related as more relationships are
established in this database model. Also, as the data is more related,
hence accessing the data is also easier and fast. This database model was
used to map many-to-many data relationships.
This was the most widely used database model, before Relational Model
was introduced.
Entity-relationship Model
In this database model, relationships are created by dividing object of
interest into entity and its characteristics into attributes.
Different entities are related using relationships.
E-R Models are defined to represent the relationships into pictorial form
to make it easier for different stakeholders to understand.
This model is good to design a database, which can then be turned into
tables in relational model(explained below).
Let's take an example, If we have to design a School Database,
then Student will be an entity with attributes name, age, address etc.
As Address is generally complex, it can be
another entity with attributes street name, pincode, city etc, and there
will be a relationship between them.
Relational Model
In this model, data is organised in two-dimensional tables and the
relationship is maintained by storing a common field.
This model was introduced by E.F Codd in 1970, and since then it has
been the most widely used database model, infact, we can say the only
database model used around the world.
The basic structure of data in the relational model is tables. All the
information related to a particular type is stored in rows of that table.
Hence, tables are also known as relations in relational model.
In the coming tutorials we will learn how to design tables, normalize
them to reduce data redundancy and how to use Structured Query
language to access data from tables.
8. All Database languages:
Data Definition Language (DDL):
statements are used to classify the database structure or schema. It is a
type of language that allows the DBA or user to depict and name those
entities, attributes, and relationships that are required for the application
along with any associated integrity and security constraints. Here are the
lists of tasks that come under DDL:
• CREATE - used to create objects in the database.
• ALTER - used to alters the structure of the database.
• DROP - used to delete objects from the database.
• TRUNCATE - used to remove all records from a table, including all
spaces allocated for the records are removed.
• COMMENT - used to add comments to the data dictionary •
RENAME - used to rename an object.
Data Manipulation Language:
A language that offers a set of operations to support the fundamental
data manipulation operations on the data held in the database. Data
Manipulation Language (DML) statements are used to manage data
within schema objects. Here are the lists of tasks that come under DML:
• SELECT - It retrieves data from a database.
• INSERT - It inserts data into a table.
• UPDATE - It updates existing data within a table.
• DELETE - It deletes all records from a table, the space for the records
remain.
• MERGE - UPSERT operation (insert or update).
• CALL - It calls a PL/SQL or Java subprogram.
• EXPLAIN PLAN - It explains access path to data.
• LOCK TABLE - It controls concurrency.
Data Control Language:
There are another two forms of database sub-languages. The Data
Control Language (DCL) is used to control privilege in Database. To
perform any operation in the database, such as for creating tables,
sequences or views we need privileges. Privileges are of two types,
• System - creating a session, table, etc. are all types of system privilege.
• Object - any command or query to work on tables comes under object
privilege. DCL is used to define two commands. These are:
• Grant - It gives user access privileges to a database.
• Revoke - It takes back permissions from the user.
Transaction Control Language (TCL):
Transaction Control statements are used to run the changes made by
DML statements. It allows statements to be grouped into logical
transactions.
• COMMIT - It saves the work done.
• SAVEPOINT - It identifies a point in a transaction to which you can
later roll back.
• ROLLBACK - It restores the database to original since the last
COMMIT.
• SET TRANSACTION - It changes the transaction options like
isolation level and what rollback segment to use.
Attributes
Attributes are the properties of entities. Attributes are represented by
means of ellipses. Every ellipse represents one attribute and is directly
connected to its entity (rectangle).
If the attributes are composite, they are further divided in a tree like
structure. Every node is then connected to its attribute. That is,
composite attributes are represented by ellipses that are connected with
an ellipse.
Specialization –
In specialization, an entity is divided into sub-entities based on
their characteristics. It is a top-down approach where higher level
entity is specialized into two or more lower level entities. For
Example, EMPLOYEE entity in an Employee management system
can be specialized into DEVELOPER, TESTER etc. as shown in
Figure . In this case, common attributes like E_NAME, E_SAL etc.
become part of higher entity (EMPLOYEE) and specialized
attributes like TES_TYPE become part of specialized entity
(TESTER).
Aggregation –
An ER diagram is not capable of representing relationship
between an entity and a relationship which may be required in
some scenarios. In those cases, a relationship with its
corresponding entities is aggregated into a higher level entity. For
Example, Employee working for a project may require some
machinery. So, REQUIRE relationship is needed between
relationship WORKS_FOR and entity MACHINERY. Using
aggregation, WORKS_FOR relationship with its entities EMPLOYEE
and PROJECT is aggregated into single entity and relationship
REQUIRE is created between aggregated entity and MACHINERY.
13.Examples of ER Daigram:
1.Hospital Management System:
2.Bank Management System:
3.Library Management System:
THANK YOU