Unit-1 DBMS Notes
Unit-1 DBMS Notes
UNIT–I
Introduction: Concept & Overview of DBMS, Purpose of DBMS, Architecture of
DBMS, Data Models and its Types, Schema and Instances, Data Independence,
DBA,Functions of DBA .
• Redundancy • DATABASE
Inconsistency DATABASE
USER
DBMS
What is a Database?
• A set of information stored in a computer in a
specific manner”
A File-Based System
Limitations of File-Based
Approach Efforts for query answering:
• What is the average grade for BE students?
• List
the activities for all students enrolled in 2019.
• Which personnel are students as well as staff?
Other limitations:
• Data redundancy:Duplication of data
• Data Isolation:Data dependency
• Data inconsistency:No data updation at all places •
Data Security:
• Slow development, high maintenance and fixed queries
Purpose of Database Systems
In the early days, database applications were built
directly on top of file systems, which leads to:
• Data redundancy and inconsistency: data is stored in multiple file
formats resulting induplication of information in different files •
Difficulty in accessing data
– Need to write a new program to carry out each new task
• Data isolation
– Multiple files and formats
• Integrity problems
– Integrity constraints (e.g., account balance > 0) become
“buried” in program code rather than being stated explicitly –
Hard to add new constraints or change existing ones
Purpose of Database Systems (Cont.)
• Atomicity of updates
– Failures may leave database in an inconsistent state with partial updates
carried out
– Example: Transfer of funds from one account to another should either
complete or not happen at all
• Concurrent access by multiple users
– Concurrent access needed for performance
– Uncontrolled concurrent accesses can lead to inconsistencies • Ex:
Two people reading a balance (say 100) and updating it by
withdrawing money (say 50 each) at the same time
• Security problems
– Hard to provide user access to some, but not all, data
Database systems offer solutions to all the
above problems
Advantage of DBMS over file system
• No redundant data
• Data Consistency and Integrity
• Data Security
• Privacy
• Easy access to data
• Easy recovery
• Flexible
Database Applications Examples
• Enterprise Information
– Sales: customers, products, purchases
– Accounting: payments, receipts, assets
– Human Resources: Information about employees, salaries, payroll taxes.
• Banking and finance
– customer information, accounts, loans, and banking transactions.
– Credit card transactions
– Finance: sales and purchases of financial instruments (e.g., stocks and bonds; storing real-time market
data
• Airlines: reservations, schedules
• Telecommunication: records of calls, texts, and data usage, generating monthly bills, maintaining balances
on prepaid calling cards
• Universities: registration, grades, students record
Application of Database.....
Telephone directories
• Train timetables •
Airline bookings •
• Web indexes
Credit card details •
• Library catalogues
Student records •
• Medical records •
Customer histories •
Bank accounts
Stock market prices •
• Stock control
Discussion boards •
• Personnel systems • and so on…
Product catalogues •
The users of the database normally don't interact with the data
dictionary, it is only handled by the database administrators.
The data dictionary holds information about the following
•Details
about all the tables in the database, such as their
owners, their security constraints, when they were created etc.
• Update
• Retrieve
• Organise
• Protect
their data.
Architecture of Database Management System :
•A database system is partitioned into modules that deal
with each of the responsibilities of the overall system. • The
functional components of a database system can be divided
into
• The Disk Storage,
• The storage manager,
• The query processor component,
• The Users and its interaction.
Architecture
of Database
Management
System
1. The disk Storage
• The disk storage or physical storage is use for storing the data. In many big
enterprises,the database range in size from hundred of gigabytes to terabytes
of data. The main memory is not so largeer that it holds that much information
and data. so we needed a larger disk storage for the database. • It contains
DATA , Statistical Dta,Data Dictionary and Indices.
• Authorization and integrity manager, which tests for the satisfaction of integrity
constraints and checks the authority of users to access data.
• Transaction manager, which ensures that the database remains in a consistent (correct)
state despite 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.
3. Query Processor
• The query processor components include:
– DDL interpreter -- interprets DDL statements and records the
definitions in the data dictionary.
– DML compiler -- translates DML statements in a query language
into an evaluation plan consisting of low-level instructions that the
query evaluation engine understands.
• The DML compiler performs query optimization; that is, it picks
the lowest cost evaluation plan from among the various
alternatives.
– Query evaluation engine -- executes low-level instructions
generated by the DML compiler.
Query Processing
1. Parsing and translation
2. Optimization
3. Evaluation
Transaction Management
• A transaction is a collection of operations that performs a single logical function in a
database application
Database Architecture
• Centralized databases
– One to a few cores, shared memory
• Client-server,
– One server machine executes work on behalf of multiple client machines.
• Parallel databases
– Many core shared memory
– Shared disk
– Shared nothing
• Distributed databases
– Geographical distribution
– Schema/data heterogeneity
DBMS Architecture (Centralized/Shared-Memory)
Database Users
Difference between DBMS and Traditional File System •
DBMS is very expensive but, the traditional file system is cheap.
• DBMS is good for the large system but, the traditional file system is good for a small
system having a small number of items.
• DBMS required lots of effort for designing but, the traditional file system is very low
design efforts.
• DBMS is highly secured but, the traditional file system is not secure.
• DBMS is data sharable but, the traditional file system is isolated data sharable. • DBMS is
flexible but, the traditional file system has a lack of flexibility and has many limitations. •
DBMS has no integrity but, the traditional file system has an integrity problem. • DBMS has
a complex backup system but, the traditional file system has a simple backup system. •
DBMS removed data redundancy but, the traditional file system has data redundancy.
External/Conceptual
mapping
Conceptual/Internal
mapping
Three Level
Schema
Architecture of Database.....
1. External level:- It is also called view level. The reason this level is called “view” is
because several users can view their desired data from this level which is internally
fetched from database with the help of conceptual and internal level mapping.
The view schema describes the end user interaction with database systems. 2.
Conceptual level:-It is also called logical level. The whole design of the database such as
relationship among data, schema of data etc. are described in this level. Programmers and
database administrators work at this level.
3. Internal level:- This level is also known as physical level. This level describes how the
data is actually stored in the storage devices. This level is also responsible for allocating
space to the data. This is the lowest level of the architecture.
Database Applications
Database applications are usually partitioned into three parts
• One-tier architecture --Sinle layer architecture,in which database
and application resides in single machine/system.use only DBA
while designing a database.
1-tier
architecture
One-tier
Two-tier architecture Three-tier Architectures
Client Machine Client Machine
USER
Network Network
Data Server
Application
• Data Independence:
• Schema definition
• Storage structure and access-method definition
• Schema and physical-organization modification
• Granting of authorization for data access
• Routine maintenance
• Periodically backing up the database
• Ensuring that enough free disk space is available for normal operations, and upgrading disk
space as required
• Monitoring jobs running on the database
Functions of a DBA.............
• 1. Schema Definition:
• The DBA definition the logical Schema of the database.A Schema refers to the
overall logical structure of the database.
• According to this schema, database will be developed to store required data for an
organization.
• 2. Storage Structure and Access Method Definition:
• The DBA decides how the data is to be represented in the stored database.
• 3. Assisting Application Programmers:
• The DBA provides assistance to application programmers to develop application
programs.
• 4. Physical Organization Modification:
• The DBA modifies the physical organization of the database to reflext the changing
needs of the organization or to improve performance.
Functions of a DBA ...
• 5. Approving Data Access:
• The DBA determines which user needs access to which part of the database. •
According to this,various types of authorizations are granted to different users. •
6. Monitoring Performance:
• The DBA monitors performance of the system.The DBA ensures that better
performance is maintained by making changes in physical or logical schema if
required.
• 7. Backup and Recovery:
• Database should not be lost or damaged.
• The DBA ensures this periodically backing up the database on magnetic tapes or
remote servers.
• In case of failure, such as virus attack database is recovered from this backup.
ata oes
A data model is a collection of concepts for describing data,
its relationships, and its constraints
• Provides a clearer and more accurate description and
representation of data
• Standard platform that enables database designers and end
users to communicate
Components of Data Models
1. Structure Part: Consisting of set of rules according to which
databases can be constructed.
2. Manipulative Part: Define the types of operation that are allowed
on the data.
a) Entity Relationship
b) Object Oriented
c) Semantic
d) Functional
a. Entity-Relationship Data Model
Disadvantages of ER Model
• No industry standard for notation: There is no industry standard for developing an ER model. So one
developer might use notations which are not understood by other developers.
• Hidden information: Some information might be lost or hidden in the ER model. As it is a high level
view so there are chances that some details of information might be hidden.
• In this model, two are more objects are connected through links. We
use this link to relate one object to other objects.
• 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
• This was the most widely used database model, before Relational Model
was introduced.
NETWORK DATA MODEL....
NETWORK DATA MODEL
Advantages of Network Model
• The data can be accessed faster as compared to the hierarchical model. This is because
the data is more related in the network model and there can be more than one path to
reach a particular node. So the data can be accessed in many ways.
• As more and more relationships need to be handled the system might get complex. So, a
user must be having detailed knowledge of the model to work with the model.
• In this model, a child node will only have a single parent node.
• 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.
Hierarchical Data Model
• As it does not support more than one parent of the child node so if we
deleted.
3. Physical Data Models
• It describe how data is stored in the computer, representing information
such as record structures, record ordering and access paths.
• tto describe the behaviour of data at disk level, the way is data and data
relationships are maintained while storing them on the disk.
• Decide the way the DBMS is gi=oing to use sec0ndary storage devoice for
storing and accessing database.
a.Unifying model
b.Frame memory model
Entity–Relationship model
• An Entity–relationship model (ER model) describes the structure of a database with the help of a
diagram, which is known as Entity Relationship Diagram (ER Diagram). An ER model is a design
or blueprint of a database that can later be implemented as a database. The main components of E-R
model are: entity set and relationship set.
• In the following diagram we have two entities Student and College and their relationship. The
relationship between Student and College is many to one as a college can have many students
however a student cannot study in multiple colleges at the same time. Student entity has attributes
such as Stu_Id, Stu_Name & Stu_Addr and College entity has attributes such as Col_ID &
Col_Name.
Entity
• An Entity may be an object with a physical existence – a particular person, car,
house, or employee – or it may be an object with a conceptual existence – a
company, a job, or a university course.
• Representation:- Rectangle
• An Entity is an object of Entity Type and set of all entities is called as entity set.
e.g.; E1 is an entity having Entity Type Student and set of all students is called
Entity Set. In ER diagram, Entity Type is represented as
Attribute
• Attributes are the properties which define the entity type. For example, Roll_No, Name, DOB,
Age, Address, Mobile_No are the attributes which defines entity type Student.
• Representation:- oval
• Key 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.
• Representation:- oval with underlying lines.
• 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)
• Derived Attribute –
An attribute which can be
derived from other attributes
of the entity type is known as
derived attribute. e.g.; Age (can
be derived from DOB).
• Representation:- dashed oval.