0% found this document useful (0 votes)
50 views111 pages

Ramya - Syllabus-& Unit - 1.

Uploaded by

mugeshmsd5
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)
50 views111 pages

Ramya - Syllabus-& Unit - 1.

Uploaded by

mugeshmsd5
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/ 111

DATABASE MANAGEMENT SYSTEMS

UNIT-I

Dr.P.Ramya
Associate Professor
Department of Computer Science and Engineering

1 Dr.P.Ramya Database Management Systems 4/7/2024


Syllabus
UNIT I - INTRODUCTION 9

Database Systems– DBMS Architecture – Data Independence – Data Models - Entity-relationship model, network model,

relational and object oriented data models

UNIT II - DATABASE DESIGN 9

Relational Model Concepts – Relational Algebra – SQL – Basic Queries – Views – Constraints - Embedded SQL - Database

Design – Functional Dependencies – Normal Forms –1NF – 2NF- 3NF- BCNF - Join Dependencies and Fifth Normal

Form.

UNIT III - TRANSACTION PROCESSING 9

Transaction Processing – Properties of Transactions - Serializability – Transaction Support in SQL -Locking Techniques –

Time Stamp Ordering - Recovery Concepts – Shadow Paging – Log Based Recovery – Database Security Issues.

UNIT IV - FILES AND INDEXING - 9

File Operations – Hashing Techniques – Indexing – Single level and Multi-level Indexes – B+ Tree –Static Hashing - Query

Processing Overview – Algorithms for SELECT and JOIN operations

UNIT V - SPECIAL DATABASES 9

Distributed Databases: Architecture – OODBMS – Object-Based Databases - OO Data Model - OO Languages –Object

Relational Databases - XML – Structure of XML - Temporal Databases – Mobile Databases.


• TEXT BOOK :

• Abraham Silberschatz, Henry F. Korth and S. Sudharshan, “Database


System Concepts”, Sixth Edition, Tata Mc Graw Hill, 2011.

• REFERENCES:

• Ramez Elmasri and Shamkant B. Navathe, “Fundamentals of


Database Systems”, Fifth Edition, Pearson Education, 2008.

• Raghu Ramakrishnan, ―Database Management Systems‖, Fourth


Edition, McGraw-Hill College Publications, 2015.
Data - Is an information
Ex: Employee name, Marks of the student

Database - The collection of data in order to store and retrieve data.

DBMS - A computerized data-keeping system.


- The main purpose of the database is to operate a large amount of
information by storing, retrieving and managing data.
• Multiple file formats, duplication of information in different
files
• Renaming Human resource in one place . Other
places cant change automatically in file system.
• Need to write a new program to carry out each new task
• Multiple files and formats
• Consistency- Uniformity
• Integrity constraints (e.g. account balance > 0)
• Hard to add new constraints or change existing ones
• If we enter random word also Employee ID
accepted in file systems
• 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
• File systems are not recommended while going for the concurrent
access.
• Concurrent accessed needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
– Example: Two people reading a balance and updating it
at the same time
• Confidential datas are not allowed everyone to
access the data.
• Need to check whether right user is accessing
database.
• 2 people have access to this file.
• They both can see all the column in file system.
• But in DBMS we use multiple views ( can hide few columns)
File System DBMS

The file system is software that manages and organizes


DBMS is software for managing the database.
the files in a storage medium within a computer.

Redundant data can be present in a file system. In DBMS there is no redundant data.

It doesn’t provide backup and recovery of data if it is It provides backup and recovery of data even if it is
lost. lost.

There is no efficient query processing in the file


Efficient query processing is there in DBMS.
system.

There is more data consistency because of the


There is less data consistency in the file system.
process of normalization.

File systems provide less security in comparison to DBMS has more security mechanisms as compared to
DBMS. file systems.

Only one user can access data at a time. Multiple users can access data at a time.

Cobol, C++ Oracle, SQL Server


DBMS provides
• Defining
• Constructing
• Manipulating
• Sharing
• Protecting
• Maintaining
Applications of DBMS
• Banking

• Airlines

• Universities

• Railways

• Finance
Database System Applications
• DBMS contains information about a particular enterprise
– Collection of interrelated data
– Set of programs to access the data
– An environment that is both convenient and efficient to use
• Database Applications:
– Banking: all transactions
– Airlines: reservations, schedules
– Universities: registration, grades
– Sales: customers, products, purchases
– Online retailers: order tracking, customized
recommendations
– Manufacturing: production, inventory, orders, supply chain
– Human resources: employee records, salaries, tax
deductions
• Databases touch all aspects of our lives
Why Study Databases??
• A database, data is organized strictly in row and column
format. The rows are called Tuple or Record.

• The data items within one row may belong to different data
types. On the other hand, the columns are often called
Domain or Attribute.
Is to separate the user application and the
physical database
Level of Abstraction
• Abstraction – Hiding the complexity

• Physical or Internal Level - Defines


how the data is actually stored.

• Logical or Conceptual Level - what


data are stored in the database.

• View or External Level - This level


is for the end-user interaction.

Multiple Views (ATM) & Security


Instances and Schemas

• Schema – the logical structure of the database.

(The overall design of the database is called the database


schema)

• Instance – the actual content of the database at a


particular point in time.

(The collection of information stored in the database at a


particular moment is called an instance of the database.)
Data Models
• Entity-Relationship Model

• Relational Model

• Hierarchical Model

• Network Model

• Object-Oriented Data Model


Entity-Relationship Model
• Represent the real-world problem in the pictorial form
– Entity – a “thing” in the real world

– Attributes – Properties that describe the entities


Entity-Relationship Model
• Entity
rrLi

Attributes

Relations
hips
• Advantages
• It is easy to develop relational model using E-R
Model.

• Disadvantages
• It is just used for database design not for
implementation.
Relational Model
• Most widely used model.

• Data is maintained in the form of table.

• All the information is stored in the form of row and columns.


• Total Number of Columns-Degree of the table.
Advantages :
• Structural Independence
• Conceptual Simplicity
• Design, implementation, maintenance & Usage
Ease.
• Greater Flexibility
Disadvantages:
• May have slower Processing
• Not as good for transaction process than
hierarchical & Network Model
Hierarchical Model
• This model organizes the data in the
hierarchical tree structure.

• The hierarchy starts from the root


which has root data and then it
expands in the form of a tree adding
child node to the parent node.

• One-to-many relationship
Advantages:

• It is very simple and fast to traverse through a tree-like


structure.

• Any change in the parent node is automatically reflected in


the child node so, the integrity of data is maintained.

Disadvantages:

• Complex relationships are not supported.

• If a parent node is deleted then the child node is


automatically deleted.
Network Model
• Is an extension of the hierarchical
model.
• A record can have more than one
parent
• Example: node student has two
parents i.e. CSE Department and
Library.
• This was not possible in the
hierarchical model.
Advantages:
• 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.
Disadvantages:
• Any change like updation, deletion, insertion
is very complex.
Object-Oriented Data Model
• The real-world problems are more closely represented through the object-oriented
data model. Both the data and relationship are present in a single structure known as
an object.

• Two are more objects are connected through links.

• We use this link to relate one object to other objects.

• The two objects are connected through a common attribute i.e the Department_id
There are different types of attributes
in DBMS:
• Simple attributes - cannot be divided further (Weight )

• Composite attributes - can be divided further (Name)

• Single Valued attributes – Hold single value for a single entity ( Room_No)

• Multi-Valued attributes - Holds multiple values for an single entity (Ph_No)

• Derived attributes – A value that is derivable from the value of a related

attribute (data of Birth)


Simple attributes
Composite attributes
Single Valued attributes
Multi-Valued attributes
Derived attributes
Database Languages

• Data Definition Language (DDL)

• Data Manipulation Language (DML)

• Data Control Language (DCL)

• Transaction Control Language (TCL)


• DDL is used to define database structure
• Create: It is used to create objects in the database.

• Alter: It is used to alter the structure of the database.

• Drop: It is used to delete objects from the database.

• Truncate: It is used to remove all records from a table.

• Rename: It is used to rename an object.


• DML is used for accessing and manipulating data in a
database.
• Insert: It is used to insert data into a table.

• Update: It is used to update existing data within a table.

• Delete: It is used to delete all records from a table.


• DCL is used to retrieve the stored or saved data.
• Grant: It is used to give user access privileges to a database.

• Revoke: It is used to take back permissions from the user.


• TCL is used to run the changes made by the DML statement.
• Commit: It is used to save the transaction on the database.

• Rollback: It is used to restore the database to original since the last Commit.

• ROLLBACK − to roll back the changes. SAVEPOINT − creates points within the
groups of transactions in which to ROLLBACK.
• DQL used to retrieve data.

• Select: It is used to retrieve data from a database.


Data Independence
One of the most important benefits of using a DBMS!
Mapping Cardinality Constraints

• Express the number of entities to which another entity can be


associated via a relationship set.
• Most useful in describing binary relationship sets.
• For a binary relationship set the mapping cardinality must be one of
the following types:
– One to one
– One to many
– Many to one
– Many to many
One to one
relationship
(1:1)
One to many
relationship
(1:M)
Many to one
relationship
(M:1)
Many to
many
relationship
(M:N)
• Domain – the set of permitted values for each
attribute

• Relationship sets that involve two entity sets


are binary (or degree 2).
• Relationship sets that involve three entity sets
are ternary(or degree 3).
Total and Partial Participation
Total participation (indicated by double line): every entity in the entity
set participates in at least one relationship in the relationship set

participation of student in advisor relation is total


 every student must have an associated instructor
Partial participation: some entities may not participate in any
relationship in the relationship set
Example: participation of instructor in advisor is partial
Expressing Weak Entity Sets

• In E-R diagrams, a weak entity set is depicted via a double


rectangle.
• We underline the discriminator of a weak entity set with a
dashed line.
• The relationship set connecting the weak entity set to the
identifying strong entity set is depicted by a double diamond.
• Primary key for section – (course_id, sec_id, semester, year)
Relationship set
• A relationship set is a set of relationships of
same type.

• A relationship set may be a unary relationship


set or binary relationship set or ternary
relationship set or n-ary relationship set.
Recursive relationship set
• Recursive relation in DBMS is a type of
relationship between two entities of a similar
type entity type.

• In recursive relation, the same entity type


participates in a relationship type more than
once, playing a different role in each instance.
E-R Diagram for a University Enterprise
• Problem

• Drawing of ER model of university database application considering the constraints −

• A university has many departments.

• Each department has multiple instructors (one person is HOD). Here the HOD refers to the

head of department.

• An instructor belongs to only one department.

• Each department offers multiple courses, each subject is taught by a single instructor.

• A student may enroll for many courses offered by different departments.


• Solution

• Follow the steps given below to draw an Entity Relationship (ER) diagram for a University database

application −

• Step 1 − Identifying the entity sets.

• The entity set has multiple instances in a given business scenario.

• As per the given constraints the entity sets are as follows −

• Department

• Course

• Student

• Instructor

• Head of the Department (HOD) is not an entity set. It is a relationship between the instructor and

department entities.
• Step 2 − Identifying the attributes for the given entities

• Department − the relevant attributes are department Name and location.

• Course − The relevant attributes are courseNo, course Name, Duration,


and prerequisite.

• Instructor − The relevant attributes are Instructor Name, Room No, and
telephone number.

• Student − The relevant attributes are Student No, Student Name, and date
of birth.
• Step 3 − Identifying the Key attributes

• Department Name is the key attribute for Department.

• CourseNo is the key attribute for Course entity.

• Instructor Name is the key attribute for the Instructor


entity.

• StudentNo is the key attribute for Student entities.


• Step 4 − Identifying the relationship between entity sets

• The department offers multiple courses and each course


belongs to only one department, hence cardinality between
department and course if one to many.
• One course is enrolled by multiple students
and one student for multiple courses. Hence,
relationships are many to many.
• Step 5 − Complete ER model
• The complete ER Model is as follows −
ER diagram of Bank Management
System ( Example Link)
https://www.geeksforgeeks.org/er-diagram-of-bank-management-system/
• https://www.youtube.com/watch?v=9ev9V_DHUZY
Database System Architecture
• https://www.youtube.com/watch?v=8_W5JT7Jz2Y
• 1.Database systems are partitioned into modules for different functions. Some
functions

(e.g. file systems) may be provided by the operating system.

• 2. Broadly the functional components of a database system are:

• a. Storage Manager (Database Manager)

• 1. Storage manager is a program module that provides the interface between the
low-level data stored

• in the database and the application programs and queries submitted to the
system.

• 2. The storage manager is responsible to the following tasks:

• 1. interaction with the file manager

• 2. efficient storing, retrieving and updating of data

• 3. The important components include:


• a. File manager: It manages allocation of disk space and data
structures used to represent information on disk.

• b. Database manager: It is the interface between low-level data


and application programs and queries.

• c. Transaction manager: Transaction manager ensures that the


database remains in a consistent (correct) state despite system
failures (e.g., power failures and operating system crashes) and
transaction failures.
• d. Authorization and integrity manger – It conducts integrity checks and user

authority to access data.

• e. Buffer manger –It is critical part of DB and stores temporary data.

• In addition, several data structures are required for physical system

implementation:

• a. Data files: They store the database itself.

• b. Data dictionary: It stores information about the structure of the

database. It is used heavily. Great emphasis should be placed on developing a

good design and efficient implementation of the dictionary. In short, it stores

metadata.

• c. Indices: They provide fast access to data items holding particular values.
• b. Query Processor: It is one of the functional components of DBMS. It translates

statements in a query language into low-level instructions the database manager

understands. It may also attempt to find an equivalent but more efficient form.

• It contains following components:

• a. DML compiler - It converts DDL statements to a set of tables containing metadata stored in

a data dictionary.

• It also performs query optimization.

• b. DDL interpreter – It interprets DDL statements and records definitions into data dictionary.

• c. Query evaluation engine – It executes low-level instructions generated by DML compiler.


• In addition, several data structures are required for physical system
implementation:

• a. Data files: They store the database itself.

• b. Data dictionary: It stores information about the structure of the


database. It is used heavily. Great emphasis should be placed on
developing a good design and efficient implementation of the dictionary.
In short, it stores metadata.

• c. Indices: They provide fast access to data items holding particular


values.
• b. Query Processor: It is one of the functional components of DBMS. It translates statements
in a query language into low-level instructions the database manager understands. It may also
attempt to find an equivalent but more efficient form.

• It contains following components:

• a. DML compiler - It converts DDL statements to a set of tables containing metadata stored in a
data dictionary.

• It also performs query optimization.

• b. DDL interpreter – It interprets DDL statements and records definitions into data dictionary.

• c. Query evaluation engine – It executes low-level instructions generated by DML compiler.


Query Processing
1. Parsing and translation
2. Optimization
3. Evaluation
Query Processing (Cont.)
• Alternative ways of evaluating a given query
– Equivalent expressions
– Different algorithms for each operation

• Cost difference between a good and a bad way of


evaluating a query can be enormous
• Need to estimate the cost of operations
– Depends critically on statistical information about relations
which the database must maintain
– Need to estimate statistics for intermediate results to
compute cost of complex expressions

You might also like