Unit 1 Dbms
Unit 1 Dbms
Database System
Or
Data: Facts, figures, statistics etc. having no particular meaning (e.g. 1, ABC, 19 etc).
Record: Collection of related data items, e.g. in the above example the three data
items had no meaning. But if we organize them in the following way, then they
collectively represent meaningful information.
Roll Name Age
1 ABC 19
2 DEF 22
3 XYZ 28
The columns of this relation are called Fields, Attributes or Domains. The rows are
called Tuples or Records.
Data inconsistency mean that different files may contain different information of
a particular object or person. Actually redundancy leads to inconsistency.When the
same data is stored in multiple locations, the inconsistency may occur.
• Data Isolation
• Data Atomicity
Data atomicity means data or record is either entered as a whole or it
is not entered at all.
• Data Dependence
• Data Sharing
The computer file-based processing system do not provide the proper security
system against illegal access of data. Anyone can easily change or delete valuable data
stored in the data file. It is the most complicated problem of file-processing system.
• Incompatible File Format
3.Data Access and Availability: DBMS provides efficient data access and retrieval
mechanisms that enable quick and easy data access. It allows multiple users to access the
data simultaneously, ensuring data availability.
4.Data Integrity : Integrity means that the data in the database is accurate. Centralized
control of the data helps in permitting the administrator to define integrity constraints to
the data in the database. For example: in customer database we can can enforce an
integrity that it must accept the customer only from Noida and Meerut city.
5.Security : The DBA can define authorization checks to be carried out whenever access
to sensitive data is attempted.To prevent illegal access, alteration, or theft, database
management systems (DBMS) include a number of security features, including
encryption, authentication, and authorization. Sensitive data is safeguarded against both
internal and external attacks thanks to this.
6.Improved Data Backup and Recovery: DBMS provides backup and recovery
mechanisms that ensure data is not lost in case of a system failure. It allows restoring data
to a specific point in time, ensuring data consistency. Database management systems
(DBMS) offer backup and recovery features that let businesses swiftly and effectively
restore lost or damaged data. This guarantees business continuity and lowers the chance
of data loss.
7.Data independence: By separating the logical and physical views of data, database
management systems (DBMS) enable users to work with data without being aware of its
exact location or structure. This offers adaptability and lowers the possibility of data
damage as a result of modifications to the underlying hardware or software.
The overall purpose of DBMS is to allow he users to define, store, retrieve and update the
information contained in the database on demand. I DBMS allows users the following tasks:
Data Definition: It helps in creation, modification and removal of definitions that define the
organization of data in database.
Data Updation: It helps in insertion, modification and deletion of the actual data in the database.
Data Retrieval: It helps in retrieval of data from the database which can be used by applications for
various purposes.
User Administration: It helps in registering and monitoring users, enforcing data security, monitoring
performance, maintaining data integrity, dealing with concurrency control and recovering
information corrupted by unexpected failure.
Database Applications:
Databases touch all aspects of our lives. Some of the major areas of application are as follows:
1. Banking
2. Airlines
3. Universities
5. Human resources
Enterprise Information
◦ Accounting: For payments, receipts, account balances, assets and other accounting information.
◦ Human resources: For information about employees, salaries, payroll taxes, and benefits, and for
generation of paychecks.
Manufacturing: For management of the supply chain and for tracking production of items in
factories, inventories of items inwarehouses and stores, and orders for items.
Online retailers: For sales data noted above plus online order tracking, generation of
recommendation lists, and maintenance of online product evaluations. ◦ Banking: For customer
information, accounts, loans, and banking transactions.
◦ Credit card transactions: For purchases on credit cards and generation of monthly statements.
◦ Finance: For storing information about holdings, sales, and purchases of financial instruments
such as stocks and bonds; also for storing real-time market data to enable online trading by
customers and automated trading by the firm.
◦ Universities: For student information, course registrations, and grades (in addition to standard
enterprise information such as human resources and accounting).
◦ Airlines: For reservations and schedule information. Airlines were among the first to
use databases in a geographically distributed manner.
◦ Telecommunication: For keeping records of calls made, generating monthly bills, maintaining
balances on prepaid calling cards, and storing information about the communication networks.
Topic:Advantages of DBMS:
1.Reduction in data Redundancy: Data redundancy refers to the duplication of data
(i.e storing same data multiple times). In a database system, by having a
centralized database and centralized control of data the unnecessary duplication of
data is avoided. It also eliminates the extra time for processing the large volume of
data. It results in saving the storage space.
2. Data Consistency: DBMS allows defining constraints and rules to ensure that data is
consistent and accurate. DBMS ensures data consistency by enforcing data validation
rules and constraints. This ensures that data is accurate and consistent across
different applications and users.
3.Data Access and Availability: DBMS provides efficient data access and retrieval
mechanisms that enable quick and easy data access. It allows multiple users to access
the data simultaneously, ensuring data availability.
4.Data Integrity : Integrity means that the data in the database is accurate.
Centralized control of the data helps in permitting the administrator to define integrity
constraints to the data in the database. For example: in customer database we can can
enforce an integrity that it must accept the customer only from Noida and Meerut city.
5.Security : The DBA can define authorization checks to be carried out whenever
access to sensitive data is attempted.To prevent illegal access, alteration, or theft,
database management systems (DBMS) include a number of security features,
including encryption, authentication, and authorization. Sensitive data is safeguarded
against both internal and external attacks thanks to this.
6.Improved Data Backup and Recovery: DBMS provides backup and recovery
mechanisms that ensure data is not lost in case of a system failure. It allows restoring
data to a specific point in time, ensuring data consistency. Database management
systems (DBMS) offer backup and recovery features that let businesses swiftly and
effectively restore lost or damaged data. This guarantees business continuity and
lowers the chance of data loss.
7.Data independence: By separating the logical and physical views of data, database
management systems (DBMS) enable users to work with data without being aware of
its exact location or structure. This offers adaptability and lowers the possibility of
data damage as a result of modifications to the underlying hardware or software.
5. Hierarchical Model
The hierarchical data model is one of the oldest data models, developed in
the 1950s by IBM. In this data model, the data is organized in a hierarchical
tree-like structure. This data model can be easily visualized because each
record in DBMS has one parent and many children (possibly 0)
Network Model
A network model is nothing but a generalization of the hierarchical data
model as this data model allows many to many relationships therefore in
this model a record can also have more than one parent.
TOPIC:ThreeTierschemaArchitectur
(or)
○ The internal level has an internal schema which describes the physical
storage structure of the database.
○ It uses the physical data model. It is used to define that how the data will
be stored in a block.
○ The conceptual level describes what data are to be stored in the database
and also describes what relationship exists among those data.
○ Each view schema describes the database part that a particular user
group is interested and hides the remaining database from that user
group.
○ The view schema describes the end user interaction with database
sysems.
TOPIC:Database users.
A Database User is defined as a person who interacts with data daily, updating,
reading, and modifying the given data
A Database Administrator (DBA) is a person/team who defines the schema and also
controls the database. Database Administrator manages and controls three levels of
database internal level, conceptual level, and external level of Database
management system architecture
→Database Administrator ensures held responsible to maintain integrity and
security of database restricting from unauthorized users. It grants permission to
users of the database and contains a profile of each and every user in the database.
2)Application programmers:
These users are computer professionals who write application programs using some
tools. E.g. Software developers
3)Sophisticated users:
These users interact with system without writing program. They form their request
in a database query language.
E.g. Analyst.
4)Parametric End Users : These are unsophisticated who don’t have any
DBMS knowledge but they frequently use the database applications in their
daily life to get the desired results. For example:Clerks in any bank is a
naive user
Data Base Designers are the users who design the structure of database
which includes tables, indexes, views, triggers, stored procedures and
constraints which are usually enforced before the database is created or
populated with data
Topic:Instances,Schema,data-independence
Instance:
The collection of information stored in the database at a particular moment is called an
instance
of the database.
Each variable has a particular value at a given instant. The values of the variables in a program
at a point in time correspond to an instance of a database schema.
schema:
The overall design of the database is called the database schema. Schemas are changed
infrequently, if at all. The concept of database schemas and instances can be understood
by analogy to a program written in a programming language.
Conceptual Data Independence: The data at conceptual level schema and external
level schema must be independent.Adding or deleting attributes of a table should not
affect the user’s view of the table.
Disk Storage
• Data Storage Manager
• The storage manager is responsible for managing the storage and retrieval of data on
the disk.
• . It helps us to maintain the integrity and consistency of the database by applying the
constraints.
• It provides an interface between the query processor and the file system, and ensures
the integrity, consistency, security, and efficiency of the database.
• It consists of several subcomponents, such as the authorization manager, the
integrity manager, the transaction manager, the file manager, and the buffer manager
• Authorization manager: checks the permissions of the users to access the data, and
enforces role-based access control.
• Integrity manager: ensures that the data satisfies the integrity constraints, such as
primary keys, foreign keys, or check constraints.
• Transaction manager :controls the concurrent access of the data by multiple users,
and ensures the atomicity, consistency, isolation, and durability (ACID) properties of
the transactions.
• File manager: manages the allocation of space on the disk, and the data structures
used to represent the data, such as records, pages, or segments.
• Buffer manager: manages the transfer of data between the main memory and the
disk
Query Manager:
• Query processor processes the query coming from the user side. Its responsibility
is to manage DML and DDL commands.
• 🡪DDL Interpreter:The DDL interpreter processes data definition language (DDL)
statements, which are used to create or modify the structure of the database objects,
such as tables, indexes, or views
• 🡪DML Compiler:The DML compiler processes data manipulation language (DML)
statements, which are used to insert, delete, or update data in the database.
• 🡪Query Evaluation Engine(Query Optimizer:
• :The query evaluation engine executes the low-level instructions generated by the
DML compiler, using the storage manager to access the data on the disk.
It starts by taking the evaluation plan for the question, runs it, and then returns the
result. Simply said, the query evaluation engine evaluates the SQL commands used
to
access the database's contents before returning the result of the query
Disk Storage
• A DBMS can use various kinds of Data Structures as a part of physical system
implementation in the form of disk storage.
• Data Dictionary:Data Dictionary − Store all the queries. Queries are checked
according to the SQL configuration, if the queries are valid ok. Otherwise, it
generates errors.
• Indices:
These indices are used to access and retrieve the data in a very fast and efficient way.
Database users:
1)Application programmers:
These users are computer professionals who write application programs using some tools.
E.g. Software developers
2)Sophisticated users:
These users interact with system without writing program. They form their request in a
database query language.
The primary cause of this was that the majority of users accessed such systems using
computer terminals with limited processing power and merely display capabilities. Only
display data and controls were delivered from the computer system to the display
terminals, which were connected to the central node by a variety of communications
networks, while all processing was done remotely on the computer system.
The majority of users switched from terminals to PCs and workstations as hardware
prices decreased.. As a result, the DBMS itself continued to operate as a centralized
DBMS, where all DBMS functionality, application program execution, and UI
processing were done on a single computer
Two-Tier Architecture: In this model, clients communicate directly with the database
server. The client handles the presentation logic, and the server manages the database
operations.
Three-Tier Architecture: In 3-Tier Architecture, there is another layer between the client
and the server. The client does not directly communicate with the server. Instead, it
interacts with an application server which further communicates with the database system
and then the query processing and transaction management takes place. This intermediate
layer acts as a medium for the exchange of partially processed data between the server and
the client. This type of architecture is used in the case of large web applications.
Topic:Entity Relationship Model:
•
•
Representation of Entities:
• Entities: An entity may be any object, class, person or place.They are represented
using the rectangle-shaped box. These rectangles are named with the entity set they
represent.
Entity Set: An Entity is an object of Entity Type and a set of all entities is called an
entity set. For Example, E1 is an entity having Entity Type Student and the set of all
students is called Entity Set.
2. Weak Entity
A Weak entity is the one that depends on its owner entity i.e. a strong entity for its
existence. A weak entity is denoted by the double rectangle. Weak entity do not
have the primary key instead it has a partial key that uniquely discriminates the
weak entities. The primary key of a weak entity is a composite key formed from
the primary key of the
strong entity and partial key of the weak entity. The collection of similar weak
entities is called Weak Entity Set. The relationship between a weak entity and a
strong entity is always denoted with an Identifying Relationship i.e. double
diamond.
For Example, A company may store the information of dependents (Parents, Children,
Spouse) of an Employee. But the dependents don’t have existed without the employee.
So Dependent will be a Weak Entity Type and Employee will be Identifying Entity
type for Dependent, which means it is Strong Entity Type.
A weak entity type is represented by a Double Rectangle. The participation of weak
entity types is always total. The relationship between the weak entity type and its
identifying strong entity type is called identifying relationship and it is represented by
a double diamond.
Representation of Attributes
2)Attributes
Attributes are the properties that define the entity type. For example, Roll_No, Name,
DOB, Age, Address, and Mobile_No are the attributes that define entity type Student.
In ER diagram, the attribute is represented by an oval.
1. Key Attribute
The attribute which uniquely identifies each entity in the entity set is called the key
attribute. For example, Roll_No will be unique for each student. In ER diagram, the
key attribute is represented by an oval with underlying lines.
2. Composite Attribute
An attribute composed of many other attributes is called a composite attribute. For
example, the Address attribute of the student Entity type consists of Street, City, State,
and Country. In ER diagram, the composite attribute is represented by an oval
comprising of ovals.
3. Multivalued Attribute
An attribute consisting of 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. Derived Attribute
An attribute that can be 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.
The Complete Entity Type Student with its Attributes can be represented as:
5.Single valued Attributes: If an attribute can take only a single value for each entity
instance, it is a single valued attribute. example for single valued attribute : age of a
student. It can take only one value for a particular student.
6.Simple attribute If an attribute cannot be divided into simpler components, it is a
simple attribute. Example for simple attribute : employee_id of an employee
Entity-Relationship Set
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 as enrolled in C1, and S3 as registered
in C3.
Unary Relationship
Roles and Recursive Relation: When an entity sets appear in more than one
relationship, it is useful to add labels to connecting lines. These labels are called as
roles. Example In this example, Husband and wife are referred as roles
4)n-ary Relationship: When there are n entities set participating in a relation, the
relationship is called an n-ary relationship.
Cardinality Ratios
The number of times an entity of an entity set participates in a relationship set is
known as cardinality. 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.
One-to-One Cardinality
Using Sets, it can be represented as:
•
specifies that each student must be enrolled in at least one course where the “student”
is the entity set and relationship “enrolled in”
2)Partial participation
• It specifies that each entity in the entity set may or may not participate in the
relationship instance of the relationship set, is also called as optional
participation
• It is represented using a single line between the entity set and relationship set in
the ER diagram
Car, Truck and Motorcycle are all subclasses of the superclass Vehicle. They all inherit
common attributes from vehicle such as speed, colour etc. while they have different
attributes also i.e Number of wheels in Car is 4 while in Motorcycle is 2.
Superclasses
A superclass is the class from which many subclasses can be created. The
subclasses inherit the characteristics of a superclass. The superclass is also known as
the parent class or base class.
In the above example, Vehicle is the Superclass and its subclasses are Car, Truck and
Motorcycle.
Inheritance
Inheritance is basically the process of basing a class on another class i.e to build a class
on a existing class. The new class contains all the features and functionalities of the old
class in addition to its own.
The class which is newly created is known as the subclass or child class and the original
class is the parent class or the superclass.
Inheritance is an important feature of Generalization and Specialization. It allows
lower-level entities to inherit the attributes of higher-level entities.
We can have three sub entities as Car, Truck, Motorcycle and these three entities can be
generalized into one general super class as Vehicle.
Specialization
In specialization, an entity is divided into sub-entities based on its characteristics. It is a
top-down approach where the higher-level entity is specialized into two or more
lower-level entitiesIt breaks an entity into multiple entities from higher level (super
class) to lower level (sub class). The breaking of higher level entity is based on some
distinguishing characteristics of the entities in super class.
It is a top down approach in which we first define the super class and then sub class and
then their attributes and relationships.Specialization is the opposite of generalization. In
specialization, a group of entities is divided into sub groups based on their
characteristics.