DBMS_Module1_2025
DBMS_Module1_2025
Systems
(3:0:2)
Sub Code:BCS403
Text Book:
Fundamentals of Database Systems
- Elmasri and Navathe, Addison Wesley, 7 th Ed.
Reference books:
Database Management Systems:
Raghu Ramakrishnan and Johannes Gehrke,
McGraw-Hill, 3rd Edition, 2014.
Database System Concepts : Silberschatz,
Korth and Sudharshan, 7th Edition,
Mc-GrawHill, 2022.
Introduction to Database
Data
Data is raw fact or figures or entity.
When activities in the organization takes place, the
effect of these activities need to be recorded which
is known as Data.
Information
Processed data is called information.
The purpose of data processing is to generate the
information required for carrying out the activities.
Why do we need a database?
Keep records of our:
Clients
Staff
Volunteers
To keep a record of activities
and interventions;
Keep sales records;
Develop reports;
Perform research
Longitudinal tracking
Database
Database may be defined in simple terms as a
collection of data
A database is a collection of related data.
Databases are used every where.
The database can be of any size and of varying
complexity.
A database may be generated and maintained manually
or it may be computerized.
Ex: Amazon.com – commercial db 2
terabytes (a terabyte is 1012 bytes worth of storage) and
is stored on 200 different computers (called servers).
Why Study Databases?
Databases are useful
Many computing applications deal with large
amounts of information
Database systems give a set of tools for storing,
searching and managing this information
Databases in CS/IS
Basic concepts and skills with database systems
are part of the skill set you will be assumed to
have as a CS/IS graduate
Database Management System
A Database Management System (DBMS) is a
collection of program that enables user to create
and maintain a database.
DBMS provides:
- Persistence
- Concurrency
- Integrity
- Security
- Data independence
Database Systems
The database and DBMS software together called
as a database system.
Who will be using the database and what tasks will they
perform?
How often will the data be modified? Who will make these
modifications?
Who will be providing IT support for the database?
additional hardware?
Who will be responsible for maintaining the data?
Will data access be offered over the Internet? If so, what level
Introduction
Basic Definitions
Database: A collection of related data.
Other features:
Protection or Security measures to prevent
unauthorized access
Presentation and Visualization of data
Example of a Database
Mini-world for the example: Part of a
UNIVERSITY environment.
Some mini-world entities:
STUDENTs
COURSEs
SECTIONs (of COURSEs)
(academic) DEPARTMENTs
INSTRUCTORs
data.
This allows the DBMS software to work with different
CALL Sales(’2004-04-01’,’2004-04-02’);
A Brief History of Database
Applications
We now give a brief historical overview of the applications
that use DBMSs and how these applications provided the
impetus for new types of database systems.
Early Database Applications Using Hierarchical and
Network Systems
Providing Data Abstraction and Application Flexibility
with Relational Databases
Object-Oriented Applications and the Need for More
Complex Databases
Interchanging Data on the Web for E-Commerce
Using XML
Extending Database Capabilities for New Applications
Databases versus Information Retrieval
When not to use DBMS:
Advantages:
database.
Also called database instance (or occurrence
or snapshot).
The term instance is also applied to
individual database components, e.g. record
instance, table instance, entity instance
Example of a database state
Distinction between database schema &
database state
The database schema changes very infrequently.
The database state changes every time the
database is updated.
• The DBMS is partly responsible for ensuring that
every state of the database is a valid state—that
is, a state that satisfies the structure and
constraints specified in the schema.
1.6a
1.5a
Physical data independence:
Applicable value
Do not know the value
Value is missing
Complex Attributes
Arbitrary Nesting of Composite and Multivalued
attributes
( ) , { }
Two types:
Total participation
Partial participation
Total Participation :
Every entity instance must be connected through the
relationship to another instance of the other participating
entity types.
Here the participation of Employee in works_for is called
total participation.
Means, every entity in the total set of employee
Find relationships
• One Bank has many branches and each branch belongs to only one
bank, hence the cardinality between Bank and Branch is One to Many.
• One Branch offers many loans and each loan is associated with one
branch, hence the cardinality between Branch and Loan is One to Many.
• One Branch maintains multiple accounts and each account is
associated to one and only one Branch, hence the cardinality between
Branch and Account is One to Many
• One Loan can be availed by multiple customers, and each Customer
can avail multiple loans, hence the cardinality between Loan and
Customer is Many to Many.
• One Customer can hold multiple accounts, and each Account can be
held by multiple Customers, hence the cardinality between Customer
and Account is Many to Many
Solution Step 2: Identify relationships between entities
• Bank has Branch
• Branch maintains accounts
• Branch offers loans
• Account is held by customer
• Loan is availed by customer
Solution Step 2: Analyze cardinality of relationships
•Bank has Branch : A bank has many branches->1:N
•Branch maintains accounts: One branch maintains
many accounts-> 1:N
•Branch offers loans : One branch offers many loans -
> 1:N
•Account is held by customer -> M:N
•Loan is availed by customer -> M:N
Step 3: Identify the key attributes
• BankCode (Bank Code) is the key attribute for the Entity “Bank”,
as it identifies the bank uniquely.
• Branch# (Branch Number) is the key attribute for “Branch” Entity.
• Customer# (Customer Number) is the key attribute for “Customer”
Entity.
• Loan# (Loan Number) is the key attribute for “Loan” Entity.
• Account No (Account Number) is the key attribute for “Account”
Entity.
Merits
• Easy to understand. Represented in Business Users
Language.
• Can be understood by non-technical specialist.
• Intuitive and helps in Physical Database creation.
• Can be generalized and specialized based on needs.
• Can help in database design.
• Gives a higher level description of the system.
Demerits
• Physical design derived from E-R Model may have
some amount of ambiguities or inconsistency.
• Sometime diagrams may lead to misinterpretations
Exercise 2.7 The Prescriptions-R-X chain of
pharmacies has ordered to give you a free
lifetime supply of medicines if you design its
database. Given the rising cost of health care,
you agree. Here's the information that you
gather:
Patients are identified by an SSN, and their names,
addresses, and ages must be recorded.
Doctors are identified by an SSN. For each doctor,
the name, specialty, and years of experience must
be recorded.
Each pharmaceutical company is identified by name
and has a phone number.
For each drug, the trade name and formula must be
recorded.
Each drug is sold by a given pharmaceutical company, and
the trade name identifies a drug uniquely from among the
products of that company. If a pharmaceutical company is
deleted, you need not keep track of its products any longer.
Each pharmacy has a name, address, and phone number.
Every patient has a primary physician. Every doctor has at
least one patient.
Each pharmacy sells several drugs and has a price for
each. A drug could be sold at several pharmacies, and the
price could vary from one pharmacy to another.
Doctors prescribe drugs for patients. A doctor could
prescribe one or more drugs for several patients, and a
patient could obtain prescriptions from several doctors.
Each prescription has a date and a quantity associated
with it. You can assume that if a doctor prescribes the
same drug for the same patient more than once, only the
last such prescription needs to be stored.
Pharmaceutical companies have long-term contracts with
pharmacies. A pharmaceutical company can contract with
several pharmacies, and a pharmacy can contract with
several pharmaceutical companies. For each contract,
you have to store a start date, an end date, and the text of
the contract.
Pharmacies appoint a supervisor for each contract. There
must always be a supervisor for each contract, but the
contract supervisor can change over the lifetime of the
contract.
Draw an ER diagram that captures the above
information. Identify any constraints that are not
captured by the ER diagram.
Exercise 2.8 : Although you always wanted to be an artist, you ended
up being an expert on databases. So now you set up a database
company, ArtBase, that builds a product for art galleries. The core of
this product is a database with a schema that captures all the
information that galleries need to maintain.
Galleries keep information about artists, their names (which are unique),
birthplaces, age, and style of art.
For each piece of artwork, the artist, the year it was made, its unique
title, its type of art (e.g., painting, lithograph, sculpture, photograph), and
its price must be stored. Pieces of artwork are also classfied into groups
of various kinds, for example, portraits, still lifes, works by Picasso, or
works of the 19th century; a given piece may belong to more than one
group.
Each group is identified by a name (like those above) that describes the
group.
Finally, galleries keep information about customers. For each customer,
galleries keep their unique name, address, total amount of dollars they
have spent in the gallery (very important!), and the artists and groups of
art that each customer tends to like.
Draw the ER diagram for the database.
Proper Naming of Schema Constructs
When designing a database schema, the choice
of names for entity types, attributes, relationship
types, and (particularly) roles is not always
straightforward.
One should choose names that convey, as much
as possible, the meanings attached to the
different constructs in the schema.
We choose to use singular names for entity
types, rather than plural ones, because the
entity type name applies to each individual entity
belonging to that entity type.
In our ER diagrams, we will use the convention
that entity type and relationship type names are
uppercase letters, attribute names have their
initial letter capitalized, and role names are
lowercase letters.
As a general practice, given a narrative
description of the database requirements, the
nouns appearing in the narrative tend to give
rise to entity type names, and the verbs tend to
indicate names of relationship types.
Attribute names generally arise from additional
nouns that describe the nouns corresponding to
entity types.
Another naming consideration involves choosing
binary relationship names to make the ER
diagram of the schema readable from left to right
and from top to bottom.
pla
Match Player
ye
d
Tea Pl
m_pl Pl ay
ayed ay ed
er _i
_o n
f
Team Ground