DBMS Module-1 PPT Updated

Download as pdf or txt
Download as pdf or txt
You are on page 1of 100

DBMS [21ISE37A]

Module 1
Introduction to Database

Dr. Arvind S. Kapse,


Professor, ISE
Data:-
 Data is the collection of facts & figures.
 Data is the collection of related & meaningful information.

Database:-
 Database is the collection data.
 Database is the software to manage the data.( e.g. Oracle, MySQL, DB2, etc..)

Database Management System (DBMS):-


 DBMS is the collection of interrelated data and set of programs to access to those
data.
 Collection of interrelated data
 Set of programs to access the data
 DBMS contains information about a particular enterprise
 DBMS provides 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
 Manufacturing: production, inventory, orders, supply chain
 Human resources: employee records, salaries, tax deductions

Databases touch all aspects of our lives


In the early days, database applications were built on top of
file systems

Drawbacks of using file systems to store data:

 Data redundancy and inconsistency


Multiple file formats, duplication 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 part
of program code

 Hard to add new constraints or change existing ones


Drawbacks of using file systems (cont.)

 Atomicity of updates
Failures may leave database in an inconsistent state with partial
updates carried out
E.g. transfer of funds from one account to another should either
complete or not happen at all

 Concurrent access by multiple users


Concurrent accessed needed for performance
Uncontrolled concurrent accesses can lead to inconsistencies
E.g. two people reading a balance and updating it at the same time

 Security problems

 Database systems offer solutions to all the above problems


 Hierarchical Model (HDBMS) (1960)

 1:M (One-Many)
 Network Model (NDBMS) (1970)

N:M (Many-Many)
 Relational Model (RDBMS) (1978)

USN Name Mob City


Instances and Schemas
 The collection of information stored in the
database at a particular moment is called
an instance of the database.

 The overall design of the database is


called the database schema.
Physical level describes how the data are actually stored.

Logical level: describes what data are stored in the database, and
what relationships exist among those data.

View level: application programs hide details of data types.


Views can also hide information (e.g., salary) for security
purposes.
A collection of tools for describing

data
data relationships
data semantics
data constraints

Entity-Relationship model

Relational model

Other models:
object-oriented model
semi-structured data models

Older models: network model and hierarchical model


Database Users
Users are differentiated by the way they expect to interact with
the system.
Naive users – The typical user interface for naive users is a
forms interface, where the user can fill in appropriate fields of the form.
Naive users may also simply read the reports generated from the
database.

Application programmers – are computer professionals who write


application programs. An application programmer to construct forms &
reports without writing a program.

Sophisticated users – interact with the system without writing a


programs. Instead, they form their requests in a database query
language. They submit each such query to a query processor.

Specialized users – who write specialized database applications that do


not fit into the traditional data processing
framework.
Rectangles represent entity sets.
Diamonds represent relationship sets.
Lines link attributes to entity sets and entity sets to relationship sets.
Ellipses represent attributes
Double ellipses represent multivalued attributes.
Dashed ellipses denote derived attributes.
Underline indicates primary key attributes
 Entity
 An entity is a real-world thing which can be distinctly
identified like a person, place or a concept. It is an object which
is distinguishable from others. If we cannot distinguish it from
others then it is an object but not an entity. An entity can be of
two types:

 Tangible Entity: Tangible Entities are those entities which exist


in the real world physically. Example: Person, car, etc.

 Intangible Entity: Intangible Entities are those entities which


exist only logically and have no physical
existence. Example: Bank Account, etc.
 An entity type is an ER diagram is defined by a name(here, STUDENT)
and a set of attributes(here, Roll_no, Student_name, Age,
Mobile_no). The table below shows how the data of different entities(
different students) are stored.

 The E-R representation of the above Student Entity Type is done below.

 Note: We use a rectangle to represent an entity type in the E-R diagram, not entity.
 Types of Entity type

• Strong Entity Type


• Weak Entity Type

 Strong Entity Type: Strong entity are those entity types which has a key attribute.
The primary key helps in identifying each entity uniquely. It is represented by a
rectangle. In the above example, Roll_no identifies each element of the table
uniquely and hence, we can say that STUDENT is a strong entity type.
 Weak Entity Type: Weak entity type doesn't have a key
attribute.
 Weak entity type can't be identified on its own.
 It depends upon some other strong entity for its distinct identity.
 This can be understood with a real-life example:
 There can be children only if the parent exits. There can be no independent
existence of children.
 There can be a room only if building exits.
 There can be no independent existence of a room.
 A weak entity is represented by a double outlined rectangle.
 The relationship between a weak entity type and strong entity type is called an
identifying relationship.
 An entity set that does not have sufficient attributes to form a primary key
is referred to as a weak entity set.

 The existence of a weak entity set depends on the existence of a identifying


entity set (Owner) it must relate to the identifying entity set via a total, one-
to-many relationship set from the identifying to the weak entity set.

 Identifying relationship depicted using a double diamond.

 The discriminator (or partial key) of a weak entity set is the set of attributes
that distinguishes among all the entities of a weak entity set.

 The primary key of a weak entity set is formed by the primary key of the
strong entity set on which the weak entity set is existence dependent, plus
the weak entity set’s discriminator.
 We depict a weak entity set by double rectangles.

 We underline the discriminator of a weak entity set with a dashed


line.

 payment-number – discriminator of the payment entity set

 Primary key for payment – (loan-number, payment-number)


 Entity Set

 Entity Set is a collection of entities of the same entity type.


 Entity type is a superset of the entity set as all the entities are
included in the entity type.
 Example 1: In the below example, two entities E1 (2, Angel, 19,
8709054568) and E2(4, Analisa, 21, 9847852156) form an entity set.
 Example 2: We can form another entity set by taking three entities from the
table. (2, Angel, 19, 8709054568) , (3, Priya, 20, 9864257315) and (4,
Analisa, 21, 9847852156) can also form a entity set.
 Similary, we can form any combination of the entity set using any of the
entities from the entity type 'STUDENT’.
 Also, we can understand that if we take all the records to the entity set we get
the entity type 'STUDENT’.
 So, we can say that the entity type is the superset of the entity set.
Participation Constraints

Total participation (indicated by double line): every entity in the entity


set participates in at least one relationship in the relationship set
E.g. participation of loan in borrower is total
every loan must have a customer associated to it via borrower

Partial participation: some entities may not participate in any


relationship in the relationship set
E.g. participation of customer in borrower is partial
Mapping Cardinality

One to One relationship

1) A customer is associated with at most one loan via


the relationship
borrower
2) A loan is associated with at most one customer via
borrower
Mapping Cardinality

One to Many relationship

In the one-to-many relationship a loan is associated


with at most
one customer via borrower, a customer is associated
with
several (including 0) loans via borrower
Mapping Cardinality

Many to Many relationship

1) A customer is associated with several (possibly 0) loans


via borrower
2) A loan is associated with several (possibly 0)
customers
via borrower
Mapping Cardinality

Many to One relationship

In a many-to-one relationship a loan is associated with


several
(including 0) customers via borrower, a customer is
associated
with at most one loan via borrower
Roles
 Entity sets of a relationship need not be distinct
 The labels “manager” and “worker” are called roles; they
specify how
employee entities interact via the works-for relationship set.
 Roles are indicated in E-R diagrams by labeling the lines that
connect
diamonds to rectangles.
 Role labels are optional.
 Keys Dependencies

 Foreign key dependencies appear as arrows from the foreign key attributes of the
referencing relation to the primary key of the referenced relation.
 Do not confuse a schema diagram with an E-R diagram.
 In particular, E-R diagrams do not show foreign key attributes explicitly, whereas
schema diagrams show them explicitly.
Design Issues in ER Diagram

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy