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

DBMS(Unit1)

This document provides an overview of Database Management Systems (DBMS), comparing them to file systems and discussing their architecture, data models, and interfaces. It covers key concepts such as data independence, SQL commands, and the Entity-Relationship model, along with cardinality in relationships. The document serves as a foundational guide for understanding the structure and functionality of databases in various applications.
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)
5 views

DBMS(Unit1)

This document provides an overview of Database Management Systems (DBMS), comparing them to file systems and discussing their architecture, data models, and interfaces. It covers key concepts such as data independence, SQL commands, and the Entity-Relationship model, along with cardinality in relationships. The document serves as a foundational guide for understanding the structure and functionality of databases in various applications.
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/ 24

DATABASE MANAGEMENT

SYSTEM
BCS501

B. TECH V SEM
UNIT 1

Introduction
Overview, Database System vs File System, Database System
Concept and Architecture, Data Model Schema and Instances,
Data Independence and Database Language and Interfaces,
Data Definitions Language, DML, Overall Database Structure.
Data Modeling Using the Entity Relationship Model: ER
Model Concepts, Notation for ER Diagram, Mapping
Constraints, Keys, Concepts of Super Key, Candidate Key,
Primary Key, Generalization, Aggregation, Reduction of an ER
Diagrams to Tables, Extended ER Model, Relationship of
Higher Degree
Overview
Data: Data is raw, unorganized facts that need to be processed.
Database: Database is a collection of interrelated data. We are all using databases almost every
day in our life.
Refer to the following as examples:

• Google Search Engine


• ATM
• Airlines
• Irctc
Database Management System (DBMS): Database Management System is a collection of
interrelated data and a set of programs to access those data. A Database Management System
(DBMS) is software that enables users to create, store, manage, and retrieve data in a structured
way. It ensures data consistency, security, and efficient management. DBMS provides
mechanisms to define the structure of the data (data model), manipulate the data (querying,
updating, and deleting), and ensure data integrity.

Database System vs. File System

1. File System:

• Data Redundancy: Data is often duplicated in multiple files, leading to redundancy.


• Data Integrity: Limited control over data integrity and inconsistency problems arise.
• Data Access: Data retrieval can be slower and complex, requiring specific knowledge
of file formats.
• Concurrency Control: File systems have limited mechanisms for handling concurrent
access.
• Security: Basic file-level security, with no granular access controls.
• Storage: Stores unstructured data in its storage system.
• Complexity: File system is quite simple when compared to DBMS.

2. Database System (DBMS):

• Data Redundancy: Minimizes redundancy by organizing data into tables that can be
related via foreign keys.
• Data Integrity: Enforces rules (constraints) to ensure data consistency.
• Data Access: Provides query languages like SQL for efficient and flexible data access.
• Concurrency Control: Supports advanced concurrency control mechanisms.
• Security: Offers fine-grained access control and authentication mechanisms.
• Storage: Stores structured data in its storage system.
• Complexity: DBMS is complexity than file system.
Database System Concepts and Architecture

The architecture of a DBMS defines how data is stored, retrieved, and managed within the
system.

1. Two- Level Architecture: The 2-tier architecture is similar to a basic Client server
model. The application at the client end directly communicates with the database on the server
side.

2. Three-Level Architecture: The 3-Tier architecture contains another layer between


the client and server. In this architecture, client can't directly communicate with the server.

• Physical/Internal Level: Describes how the data is physically stored in the system, i.e.,
the physical storage details.
• Conceptual Level: Defines the logical structure of the entire database, which includes
tables, columns, and relationships between data.
• External Level: Describes the view of the database presented to end-users or
applications. Different users may have different external views of the same data.
Data Models, Schemas, and Instances

1. Data Model:

A data model is a conceptual framework that defines how data is structured, stored, and
managed in a DBMS. Common data models include:

• Relational Model: The data in this model is kept in the form of a table that is two-
dimensional. All of the data is kept in the form of rows and columns. Tables are the
foundation of a relational paradigm.

• Object-Oriented Model: Data is represented as objects similar to those used in object-


oriented programming.

• Hierarchical Model: Data is organized in a tree-like structure. This concept uses a


hierarchical tree structure to organise the data. The hierarchy begins at the root, which
contains root data, and then grows into a tree as child nodes are added to the parent
node.
• Network Model: Data is organized in a graph with nodes and links.

2. Schema:

• Schema refers to the structure of the database, defining the organization of data and
relationships between tables.
o Physical Schema: Describes how data is physically stored. o Logical Schema:
Describes the logical structure, i.e., tables, attributes, and relationships. o View
Schema: Describes the views of the database tailored to different users.

3. Instance:

An instance is the actual data in the database at a particular moment in time. While the schema
remains fixed, the instance may change as data is inserted, updated, or deleted.

Data Independence

Data Independence is the ability to change the schema at one level without affecting the
schema at the next higher level. It is crucial for maintaining flexibility in database systems.

• Logical Data Independence: Ability to change the conceptual schema without


affecting the external schema or application programs. For example, adding a new
attribute to a table without changing application programs.
• Physical Data Independence: Ability to change the internal schema (like how data is
stored) without affecting the conceptual schema.

Database Interface

A database interface provides a way for users or applications to interact with the database
management system (DBMS) to access, manipulate, and manage data. These interfaces vary
based on the user’s role, the complexity of the operations, and how data is accessed.

1. Menu-Based Interfaces for Browsing: These interfaces present the user with lists of
options, called menus, that lead the user through the formulation of a request. Pulldown
menus are becoming a very popular technique in window-based user interfaces. They
are often used in browsing interfaces, which allow a user to look through the contents
of a database in an exploratory and unstructured manner.

2. Form-Based Interfaces: A form-based interfaces displays a form to each user. Users


can fill out all of the form entries to insert new data, or they fill out only certain entries,
in which case the DBMS will retrieve matching data for the remaining entries. Many
DBMSs have forms specification languages, special languages that help programmers
specify such forms.

3. Graphical-User Interfaces: A Graphical User Interfaces (GUI) typically displays a


schema to the user in diagrammatic form. The user can then specify a query by
manipulating the diagram. In many cases, GUI utilize both menus and forms. Most GUI
use a pointing device such as a mouse, to pick certain parts of the displayed schema
diagram.

4. Natural Language Interface: These interfaces accept requests written in English or


some other language and attempt to "understand them. A natural language interface
usually has its own "schema" which is similar to the database conceptual schema.

5. Interfaces for Parametric Users: Parametric users, such as bank tellers, often have a
small set of operation that they must perform repeatedly system analyst and
programmers design and implement a special interface for a known class of naive users.
6. Interfaces for the DBA: Most database system contain privileged commands that can
be used only by the DBA's staff. These includes commands for creating accounts,
setting system parameters etc.

SQL Commands

o SQL commands are instructions. It is used to communicate with the database. It is also
used to perform specific tasks, functions, and queries of data.
o SQL can perform various tasks like create a table, add data to tables, drop the table,
modify the table, set permission for users.
Types of SQL Commands
There are four types of SQL commands: DDL, DML, DCL, TCL.

1. Data Definition Language (DDL)

o DDL changes the structure of the table like creating a table, deleting a table, altering a
table, etc.
o All the command of DDL are auto-committed that means it permanently save all the
changes in the database.
2. Data Manipulation Language

o DML commands are used to modify the database. It is responsible for all form of
changes in the database.
o The command of DML is not auto-committed that means it can't permanently save all
the changes in the database. They can be rollback.
Following are the some commands that come under DML:
Overall Database Structure
A database system is partitioned into modules that deal with each of the responsibilies of the
overall system. The functional components of a database system can be broadly divided into
two components; The Storage Manager and the Query Processor.
1.The Storage Manager (SM)

A storage manager han program module that provides the interface between the low level data
stored in the database and the application programs and queries submite dote the system.

The SM components includes:

Authorisation and Integrity Manager: Which tests for the statisfaction of integrity
constraints and checks the authority of users to access data.

Transaction Manager: Which ensures that the database remains in a consistent state despite
of system failures and that concurrent transaction executions proceed without conflicting.
File Manager: Which manages the allocation of space on disk storage and the data structures
used to represent information stored on disk.

Buffer Manager: Which is responsible for fetching data from disk storage into main memory
and deciding what data to cache in main memory. The buffer manager is a critical part of the
database system, since it enables the database to handle data sizes that are much larger than the
size of main memory.

2. The Query Processor (QP)

The QP Components are:

• DDL Interpreter: Which interprets DDL statements and records the definition in the data
dictionary.
• DML Compiler: Which translates DML statements in a query language into an evaluation
plan consisting of low-level instructions that the query evaluation engine understands.

• Query Optimisation: It picks the lowest cost evaluation plan from among the alternatives.

• Query Evaluation Engine: Which executes low-level instructions generated by the DML
Compiler.

ER (Entity Relationship) Diagram in DBMS

o ER model stands for an Entity-Relationship model. It is a high-level data model. This


model is used to define the data elements and relationship for a specified system.
o It develops a conceptual design for the database. It also develops a very simple and easy
to design view of data.
o In ER modelling, the database structure is portrayed as a diagram called an entity-
relationship diagram.
For example, Suppose, we design a school database. In this database, the student will be an
entity with attributes like address, name, id, age, etc. The address can be another entity with
attributes like city, street name, pin code, etc and there will be a relationship between them.
Component of ER Diagram

1. Entity:
An entity may be any object, class, person or place. In the ER diagram, an entity can be
represented as rectangles.

Consider an organization as an example- manager, product, employee, department etc. can be


taken as an entity.
a. Weak Entity

An entity that depends on another entity called a weak entity. The weak entity doesn't contain
any key attribute of its own. The weak entity is represented by a double rectangle.

2. Attribute
The attribute is used to describe the property of an entity. Eclipse is used to represent an
attribute.

For example, id, age, contact number, name, etc. can be attributes of a student.

a. Key Attribute

The key attribute is used to represent the main characteristics of an entity. It represents a primary
key. The key attribute is represented by an ellipse with the text underlined.
b. Composite Attribute

An attribute that composed of many other attributes is known as a composite attribute. The
composite attribute is represented by an ellipse, and those ellipses are connected with an ellipse.

c. Multivalued Attribute

An attribute can have more than one value. These attributes are known as a multivalued
attribute. The double oval is used to represent multivalued attribute.

For example, a student can have more than one phone number.
d. Derived Attribute

An attribute that can be derived from other attribute is known as a derived attribute. It can be
represented by a dashed ellipse.

For example, A person's age changes over time and can be derived from another attribute like
Date of birth.

3. Relationship
A relationship is used to describe the relation between entities. Diamond or rhombus is used to
represent the relationship.

Types of relationship are as follows:

a. One-to-One Relationship
When only one instance of an entity is associated with the relationship, then it is known as one
to one relationship.

For example, A female can marry to one male, and a male can marry to one female.

b. One-to-many relationship

When only one instance of the entity on the left, and more than one instance of an entity on the
right associates with the relationship then this is known as a one-to-many relationship.

For example, Scientist can invent many inventions, but the invention is done by the only
specific scientist.

c. Many-to-one relationship

When more than one instance of the entity on the left, and only one instance of an entity on the
right associates with the relationship then it is known as a many-to-one relationship.

For example, Student enrolls for only one course, but a course can have many students.

d. Many-to-many relationship

When more than one instance of the entity on the left, and more than one instance of an entity
on the right associates with the relationship then it is known as a many-to-many relationship.

For example, Employee can assign by many projects and project can have many employees.
Cardinality in DBMS (Mapping Constraints)

DBMS
DBMS stands for Database Management System, which is a tool, or a software used to do
various operations on a Database like the Creation of the Database, Deletion of the Database,
or Updating the current Database. To simplify processing and data querying, the most popular
types of Databases currently in use typically model their data as rows and columns in a set of
tables. The data may then be handled, updated, regulated, and structured with ease. For writing
and querying data, most Databases employ Structured Query Language (SQL).

Cardinality
Cardinality means how the entities are arranged to each other or what is the relationship
structure between entities in a relationship set. In a Database Management System, Cardinality
represents a number that denotes how many times an entity is participating with another entity
in a relationship set. The Cardinality of DBMS is a very important attribute in representing the
structure of a Database. In a table, the number of rows or tuples represents the Cardinality.

Cardinality Ratio
Cardinality ratio is also called Cardinality Mapping, which represents the mapping of one
entity set to another entity set in a relationship set. We generally take the example of a binary
relationship set where two entities are mapped to each other.

Cardinality is very important in the Database of various businesses. For example, if we want to
track the purchase history of each customer then we can use the one-to-many cardinality to find
the data of a specific customer. The Cardinality model can be used in Databases by Database
Managers for a variety of purposes, but corporations often use it to evaluate customer or
inventory data.

There are four types of Cardinality Mapping in Database Management Systems:

1. One to one
2. Many to one
3. One to many
4. Many to many

One to One
One to one cardinality is represented by a 1:1 symbol. In this, there is at most one relationship
from one entity to another entity. There are a lot of examples of one-to-one cardinality in real
life databases.
For example, one student can have only one student id, and one student id can belong to only
one student. So, the relationship mapping between student and student id will be one to one
cardinality mapping.

Another example is the relationship between the director of the school and the school because
one school can have a maximum of one director, and one director can belong to only one school.

Many to One Cardinality:


In many to one cardinality mapping, from set 1, there can be multiple sets that can make
relationships with a single entity of set 2. Or we can also describe it as from set 2, and one entity
can make a relationship with more than one entity of set 1.

One to one Cardinality is the subset of Many to one Cardinality. It can be represented by M:1.

For example, there are multiple patients in a hospital who are served by a single doctor, so the
relationship between patients and doctors can be represented by Many to one Cardinality.

One to Many Cardinalities:


In One-to-many cardinality mapping, from set 1, there can be a maximum single set that can
make relationships with a single or more than one entity of set 2. Or we can also describe it as
from set 2, more than one entity can make a relationship with only one entity of set 1.

One to one cardinality is the subset of One-to-many Cardinality. It can be represented by 1: M.

For Example, in a hospital, there can be various compounders, so the relationship between the
hospital and compounders can be mapped through One-to-many Cardinality.
Many to Many Cardinalities:
In many, many cardinalities mapping, there can be one or more than one entity that can associate
with one or more than one entity of set 2. In the same way from the end of set 2, one or more
than one entity can make a relation with one or more than one entity of set 1.

It is represented by M: N or N: M.

One to one cardinality, One to many cardinalities, and Many to one cardinality is the subset of
the many to many cardinalities.

For Example, in a college, multiple students can work on a single project, and a single student
can also work on multiple projects. So, the relationship between the project and the student can
be represented by many to many cardinalities.

Keys

o Keys play an important role in the relational database.


o It is used to uniquely identify any record or row of data from the table. It is also used to
establish and identify relationships between tables.
For example, ID is used as a key in the Student table because it is unique for each student. In
the PERSON table, passport_number, license_number, SSN are keys since they are unique for
each person.
Types of keys:

1. Primary key

o It is the first key used to identify one and only one instance of an entity uniquely. An
entity can contain multiple keys, as we saw in the PERSON table. The key which is
most suitable from those lists becomes a primary key.
o In the EMPLOYEE table, ID can be the primary key since it is unique for each
employee. In the EMPLOYEE table, we can even select License_Number and
Passport_Number as primary keys since they are also unique.
o For each entity, the primary key selection is based on requirements and developers.

2. Candidate key

o A candidate key is an attribute or set of attributes that can uniquely identify a tuple.
o Except for the primary key, the remaining attributes are considered a candidate key. The
candidate keys are as strong as the primary key.
For example: In the EMPLOYEE table, id is best suited for the primary key. The rest of the
attributes, like SSN, Passport_Number, License_Number, etc., are considered a candidate key.
3. Super Key
Super key is an attribute set that can uniquely identify a tuple. A super key is a superset of a
candidate key.

For example: In the above EMPLOYEE table, for(EMPLOEE_ID, EMPLOYEE_NAME), the


name of two employees can be the same, but their EMPLYEE_ID can't be the same. Hence,
this combination can also be a key.

The super key would be EMPLOYEE-ID (EMPLOYEE_ID, EMPLOYEE-NAME), etc.

4. Foreign key

o Foreign keys are the column of the table used to point to the primary key of another
table.
o Every employee works in a specific department in a company, and employee and
department are two different entities. So we can't store the department's information in
the employee table. That's why we link these two tables through the primary key of one
table.
o We add the primary key of the DEPARTMENT table, Department_Id, as a new attribute
in the EMPLOYEE table.
o In the EMPLOYEE table, Department_Id is the foreign key, and both the tables are
related.
5. Alternate key
There may be one or more attributes or a combination of attributes that uniquely identify each
tuple in a relation. These attributes or combinations of the attributes are called the candidate
keys. One key is chosen as the primary key from these candidate keys, and the remaining
candidate key, if it exists, is termed the alternate key. In other words, the total number of the
alternate keys is the total number of candidate keys minus the primary key. The alternate key
may or may not exist. If there is only one candidate key in a relation, it does not have an alternate
key.

For example, employee relation has two attributes, Employee_Id and PAN_No, that act as
candidate keys. In this relation, Employee_Id is chosen as the primary key, so the other
candidate key, PAN_No, acts as the Alternate key.

6. Composite key
Whenever a primary key consists of more than one attribute, it is known as a composite key.
This key is also known as Concatenated Key.

For example, in employee relations, we assume that an employee may be assigned multiple
roles, and an employee may work on multiple projects simultaneously. So the primary key will
be composed of all three attributes, namely Emp_ID, Emp_role, and Proj_ID in combination.
So these attributes act as a composite key since the primary key comprises more than one
attribute.

Generalization

o Generalization is like a bottom-up approach in which two or more entities of lower level
combine to form a higher level entity if they have some attributes in common.
o In generalization, an entity of a higher level can also combine with the entities of the
lower level to form a further higher level entity.
o Generalization is more like subclass and superclass system, but the only difference is
the approach. Generalization uses the bottom-up approach.
o In generalization, entities are combined to form a more generalized entity, i.e.,
subclasses are combined to make a superclass.
For example, Faculty and Student entities can be generalized and create a higher level entity
Person.

Specialization

o Specialization is a top-down approach, and it is opposite to Generalization. In


specialization, one higher level entity can be broken down into two lower level entities.
o Specialization is used to identify the subset of an entity set that shares some
distinguishing characteristics.
o Normally, the superclass is defined first, the subclass and its related attributes are
defined next, and relationship set are then added.
For example: In an Employee management system, EMPLOYEE entity can be specialized as
TESTER or DEVELOPER based on what role they play in the company.
ROLE OF DBA

Data Administrator (DA): It refers to Data Administrator, is that particular person who has
the central responsibility for the data. The basic job of the Data Administrator is to decide what
data should be stored in database of which place.

Database Administrator (DBA)

The person having the central control over the system is called database. Administrator The
database administrator is an information technology expert or a well-trained, computer literate
person who is responsible for the technical operations of a database or all databases in an
organisation. In reality, the database administrator may be a department or group rather than
one person. Database administrators should have an excellent knowledge of computers and
organisation structures. The DBA has many different responsibilities, but the overall goal of a
DBA is to maintain the database system and to provide users with access to the required
information when they need it. The DBA makes sure that the database is protected and that any
chance of data loss is minimised. Typical responsibilities of the

DBA are as follows:

• Granting different types of authorisation to regulate which parts of the database various
users can access.

• Ensuring regular and accurate update of the database. Identifying and resolving user's
problem.

• Schema and physical organisation modification.

• Storage structure and access-method definition.

• Processing and maintaining database software and related documents and tools.

You might also like