Sunteți pe pagina 1din 23

Introduction

Term Database requires understanding of data and information

Data: It can be anything like name, place or number, etc. Data usually refers to raw data, or
unprocessed data.

Information: It is organized or classified data so that it has some meaningful values to the receiver.

Information is the processed data on which decisions and actions are based.

Difference between Data and Information?


Data Information

Data is raw facts and figures Information is a processed form of data

For example: 12 is data For example: When 12 is stored in row column


form as shown it is information.

Age 12

Data are atomic level pieces of information Information is a collection of data

Data does not help in decision making Information helps in decision making

Database
• A database is a shared collection of logically related data designed to meet the information
needs of an organization

• The related information when placed is an organized form makes a database.

• The organization of data/information is necessary because unorganized information has no


meaning.
Before DBMSs were introduced, organizations usually stored information in file processing
system which has a number of disadvantages:

• Data redundancy and inconsistency

• Difficulty in accessing data

• Data isolation

• Integrity problems

• Atomicity problems

• Concurrent-access anomalies

• Security problems
Uses of DBMS:
(i) Effective and efficient management of data

(ii) Query processing and management

(iii) Easy to understand and user friendly

(iv) Security and integrity of data

(v) Better Decision making

(vi) Data sharing and storage

(vii) Better access to accurate data

(viii) Ensures error free information

Components of DBMS:
A DBMS constitutes of five components that help in the use and
management of data in an organization.

These are:
(i) Data,

(ii) Hardware,

(iii) Software

(iv) User and

(v) Procedure.
(i) Data:
Data is a collection of raw facts that are stored and used inside a
database in order to form meaningful information.

(ii) Hardware:
Hardware is a collection of physical components of a computer
system. It includes secondary storage devices like disk drives
(floppy, CD.), processor, etc.

(iii) Software:
Software refers to the program that a database system uses in order
to run a DBMS application. It is the platform through which data is
accessed from the physical location (hardware) where data is stored.
For example, a Software named “Database Manager”.

(iv) User:
Users are the people who use the database applications. They can be
Database Administrators, Application programmers, Database
designers, End users, etc.

(v) Procedure:
A set of instructions that describe the working of a DBMS is called
its procedure.

Database Management System


• DBMS A database management system is the software system that
allows users to define, create and maintain a database and provides
controlled access to the data.
• A database management system (DBMS) is basically a collection of
programs that enables users to store, modify, and extract information
from a database as per the requirements.
Operations on databases
• To add new information
• To view or retrieve the stored information
• To modify or edit the existing
• To remove or delete the unwanted information
• Arranging the information in a desired order etc.

Applications of DBMS
• 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

The design of a DBMS depends on its architecture. It


can be centralized or decentralized or hierarchical.

3-tier Architecture
A 3-tier architecture separates its tiers from each other based on the
complexity of the users and how they use the data present in the database.
It is the most widely used architecture to design a DBMS.
• Database (Data) Tier − At this tier, the database resides along with its query
processing languages. We also have the relations that define the data and
their constraints at this level.

• Application (Middle) Tier − At this tier reside the application server and the
programs that access the database. For a user, this application tier presents
an abstracted view of the database. End-users are unaware of any existence
of the database beyond the application. At the other end, the database tier is
not aware of any other user beyond the application tier. Hence, the application
layer sits in the middle and acts as a mediator between the end-user and the
database.

• User (Presentation) Tier − End-users operate on this tier and they know
nothing about any existence of the database beyond this layer. At this layer,
multiple views of the database can be provided by the application. All views
are generated by applications that reside in the application tier.
• External or View level: It is the users’ view of the database. This level describes that part of
the database that is relevant to each user.

– For example, one user may view dates in the form (day, month, year), while another
may view dates as (year, month, day).

• Conceptual or logical level: It is the community view of the database. This level describes
what data is stored in the database and the relationships among the data.

• It represents:

– All entities, their attributes, and their relationships;

– The constraints on the data;

– Security and integrity information.

• Internal or storage level: It is the physical representation of the database on the computer.
This level describes how the data is stored in the database.
Data Independence-Achievement of Layered Architecture of DBMS
Data independence is the type of data transparency that matters for a
centralized DBMS. It refers to the immunity of user applications to
changes made in the definition and organization of data.
• Two kinds of data independence:
Logical Data Independence: The capacity to change the
conceptual schema without having to change the external
schemas and their application programs.
Physical Data Independence: The capacity to change the internal
schema without having to change the conceptual schema.
• The processes of transforming requests and results between the
levels are called mappings.
• When a schema at a lower level is changed, only the mappings
between this schema and higher-level schemas need to be
changed in a DBMS that fully supports data independence. The
higher-level schemas themselves are unchanged. Hence, the
application programs need not be changed since they refer to the
external schemas.
Data Abstraction- in general, abstraction is the process of taking away or removing
characteristics from something in order to reduce it to a set of essential characteristics.
• A major purpose of database system is to provide user with an abstract view of data.
That is, system hides certain details of how the data are stored and maintained.

Levels of Abstraction(view of data)

• Physical level: describes how a record (e.g., customer) is stored.


• Logical level: describes what data stored in database, and the relationships among the
data. DBA, who decides what information to keep in the database, use the logical
level of abstraction.
• View level: describe only part of database. application programs hide details of data
types. Complexity remain due to variety of information stored. Views can also hide
information (such as an employee’s salary) for security purposes.

_ Physical level describes how a record (e.g., customer) is stored.


_ Logical level: describes data stored in database, and the
• relationships among the data.
• type customer = record
• name : string;
• street : string;
• city : integer;
• end;
• _ View level: application programs hide details of data types.
• Views can also hide information (e.g., salary) for security
• purposes.

View of Data

Components of Database System


• Storage Manager- Is responsible for storing, retrieving and updating the data in the
database. It is a program module which provides the interface between the low-level data
stored in the database and application programs and queries submitted to the system.

Components of Storage Manager

➢ Authorization and Integrity Manager

➢ Transaction Manager

➢ File Manager

➢ Buffer Manager

• Query Processor- Is responsible for the execution of the query Components :

• DDL Interpreter

• DML Compiler

• Query Evaluation Engine


Types of Database System
Based on Number of users =

• Single user DBMS

• Multi user DBMS

Based on site Location =

• Centralized System

• Parallel System

• Distributed System

• Client –Server system

Data models, Schemas, and Instances


• Data model:-A set of concepts to describe the structure of a database, and certain
constraints that the database should obey.

• Schema:- The overall description of the database is called the Database Schema.

– A schema is defined as an outline or a plan that describes the records and


relationships existing at the particular level.

• Instance:- Data in the database at a particular moment in time.

DATA BASE SCHEMA DATA MODEL


1. A SKELETON STRUCTURE THAT 1. Defines that how logical
REPRESENTS THE LOGICAL structure of the DB is to be
VIEW OF ENTIRE DB. maintained.
2. DESCRIBES OVERALL DESIGN 2. Introduces features of
OF DATABASE AND abstraction in DBMS.
FORMULATES CONSTRAINTS
TO BE APPLIED ON DATA.
3. IT DEFINES THAT HOW DATA 3. It defines that how data is
WILL BE ORGANISED AND connected to each other, how
HOW RELATIONS ARE they are processed and stored
ASSOCIATED AMONG THEM. inside the system.
The very first data model used could have been flat data model. Where the
data used are to be kept in the same plane.
Earlier, the data models were not scientific and were prone to introduce lots
of duplication and update anomalies.

ER
object based
logical model
Object
oriented
data models
types N/W

record based
Hierarchical
logical model

Relational

Entity relationship Model


• It works around real-world entities and the associations among them.
• At view level, the ER model is considered a good option for designing databases.
• E-R diagram is used in conceptual design and it gives pictorial representation for all the
requirements
• This must be shown to the user for evaluation purpose and it must be done iteratively till to
get valid E-R diagram

Components of E-R diagram


• Entities
• Relationship
• Attributes

Entity : Something that exists and can be


distinguished from other entities
Ex:
Student entity with unique roll number
Account Entity with unique account
number
Entity Set : A set of entities of the same type
Ex:
All the student entities in a college
Entity sets need not be disjoint
Types of Entities
Entities with physical Existance
Ex: Student,Book,Customer

Entities with logical Existance


Ex: sale, University,course
Note: No! An entity cannot be an attribute of another entity. If you want to create a
GENERALIZATION or AGGREGATION schema…it can be done… For example:

Consider you have four ENTITIES→ Dogs,Cats,Tiger,Lion. Now if you want an entity
that stores the information of Wild Animals and Domestic Animals. You can
generalise the above four entities as Dogs AND Cats under Domestic Animals
table(this table will have common attributes from Dogs and Cats tables) and
similarly for Wild Animals. This is the concept of Generalisation.

Specialisation: This concept is used to do the exact opposite of what we did in


Generalisation. We will have two ENTITIES in the beginning→Wild Animals and
Domestic Animals. Now for our reference we further specialize the ENTITIES by
splitting them to Dogs,Cats,Tiger,Lion. All these smaller entities will be related

Weak and Strong Entity:


 A weak entity is an entity that depends on the existence of
another entity. In more technical terms it can defined as an entity
that cannot be identified by its own attributes.
 It uses a foreign key combined with its attributed to form the
primary key.
 An entity like order item is a good example for this.
 The order item will be meaningless without an order, so it depends
on the existence of order.
 An entity set that has a primary key is called as Strong entity set.
 A weak entity set does not have a primary key but we need a means
of distinguishing among all those entries in the entity set that
depend on one particular strong entity set.
 The discriminator of a weak entity set is a set of attributes that
allows this distinction be made.
 A member of a strong entity set is called dominant entity and
member of weak entity set is called as subordinate entity.
Attribute: A characteristic of an entity.

Domain: A set of possible values for an attribute.

Attribute types:

o Simple and composite attributes.


o Single-valued and multi-valued attributes
o Derived attributes

Simple attribute − Simple attributes are atomic values, which cannot


be divided further. For example, a student's phone number is an atomic
value of 10 digits.

Composite attribute − Composite attributes are made of more than


one simple attribute. For example, a student's complete name may have
first_name and last_name.
Derived attribute − Derived attributes are the attributes that do not
exist in the physical database, but their values are derived from other
attributes present in the database.

For example, average_salary in a department should not be saved


directly in the database, instead it can be derived. For another example,
age can be derived from data_of_birth.

Single-value attribute − Single-value attributes contain single value.

For example − Social_Security_Number.

Multi-value attribute − Multi-value attributes may contain more than


one values.

For example, a person can have more than one phone number,
email_address, etc.

Figure 1 Composite Attributes


Figure 2 Composite, Multivalued and Derived attributes

➢ Relationship: An association among two or more entities


➢ Relationship set: A set of relationship of the same type. Like
entities, a relationship too can have attributes. These attributes
are called descriptive attributes.

Entity-Relationship Model

Degree of a Relationship Set


It Refers to number of entity sets that participate in a relationship set.

 Binary = degree 2

 Ternary = degree 3

 n-ary
Generally, most relationship sets in a database system are binary

Mapping Cardinalities
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:

o One to one
o One to many
o Many to one
o Many to many
ER Representation
Total and Partial Participation / Participation of an Entity Set in a
Relationship Set
Total participation (indicated by double line): every entity in the entity set participates in at least
one relationship in the relationship set

Partial participation: some entities may not participate in any relationship in the relationship set.

Example:

• we could decide that a person is a customer only if they have bought a product.

 On the other hand, we could say that a customer is a person whom we know about and
whom we hope might buy something—that is, we can have people listed as customers in our
database who never buy a product.

 In the first case, the customer entity has total participation in the bought relationship
(all customers have bought a product, and we can’t have a customer who hasn’t bought a
product), while in the second case it has partial participation (a customer can buy a
product).

 These are referred to as the participation constraints of the relationship.

 Employee head of department

 Not all employees become a head, but department will always be headed by one employee.

 So, employee participated partially in relationship.

Generalization

Example :
Specialization

Example:

Aggregation
 Aggregation is a process when relation between two entity is treated as a single entity.

 Here the relation between Center and Course, is acting as an Entity in relation with Visitor.
 The E-R model cannot express relationships among relationships.
 The solution is to use aggregation.
Relational Model

Relational Model
• It uses a collection of tables to represent both data and the relationships among those data
• Each table has multiple columns, and each column has unique name
• The relational model hides low-level implementation details from database developers and
users
• The relational model is the most widely used model. The relational model is at a lower level
of abstraction than E-R model.
• Database designs are carried out in the E-R model and then translated to the relational
model

S-ar putea să vă placă și