Professional Documents
Culture Documents
OR
• A Database is simplistically, a collection of files that contain related data.
• These related files are managed by a specialized piece of software known as
database management system.
• User or application program request the DBMS to retrieve, change, insert,
delete it for them.
Data: - Any raw facts, figures or statistics that can be processed to get some
useful information.
1
New permanent files are created as required.
but over a long period of time files may be in different formats, and
Application programs may be in different languages.
3. So we can see there are problems with the straight file-processing approach:
Data redundancy and inconsistency
Same information may be duplicated in several places.
All copies may not be updated properly.
Difficulty in accessing data
May have to write a new application program to satisfy an
unusual request.
E.g. find all customers with the same postal code.
Could generate this data manually, but a long job...
Data isolation
Data in different files.
Data in different formats.
Difficult to write new application programs.
Multiple users
Want concurrency for faster response time.
Need protection for concurrent updates.
E.g. two customers withdrawing funds from the same account at
the same time - account has $500 in it, and they withdraw $100
and $50. The result could be $350, $400 or $450 if no
protection.
Security problems
Every user of the system should be able to access only the data
they are permitted to see.
E.g. payroll people only handle employee records, and cannot
see customer accounts; tellers only access account data and
cannot see payroll data.
Difficult to enforce this with application programs.
Integrity problems
Data may be required to satisfy constraints.
E.g. no account balance below $25.00.
Again, difficult to enforce or to change constraints with the file-
processing approach.
2
Data type definition - scheme
Value of a variable - instance
Physical scheme
Conceptual scheme
Subschema (can be many)
Advantages of DBMS:-
♣ Minimum Redundancy
♣ Easy in access
♣ Abstraction
♣ Sharing
♣ Security
♣ Integrity
♣ Transaction
♣ Recovery
♣ Concurrency
Minimum Redundancy:-
Abstraction:-
Sharing:-
3
Security:-
Integrity:-
Recovery:-
Easy Access:-
Transaction:-
procedural: the user specifies what data is needed and how to get it
nonprocedural: the user only specifies what data is needed
Easier for user
May not generate code as efficient as that produced by
procedural languages
Database systems are partitioned into modules for different functions. Some
functions (e.g. file systems) may be provided by the operating system.
Components include:
5
Query processor translates statements in a query language into low-
level instructions the database manager understands. (May also
attempt to find an equivalent but more efficient form.)
DML precompiler converts DML statements embedded in an
application program to normal procedure calls in a host language. The
precompiler interacts with the query processor.
DDL compiler converts DDL statements to a set of tables containing
metadata stored in a data dictionary.
Query
evaluation Query processor
engine
7
8
Relationships and Relationship set:-
A Relationship is an association among several entites .for example we
may define a relationship which associates the customer Amit with an account with
A/c no 3001.This specifies that Amit is customer who is accessing in the account
3001.
A relationship set is a set of relationship of same type.
Formally it is a mathematical relation on n>=2 entity set .If E1, E2, E3…………En
are entity set.
Then a relationship set R is subset of
{(e1, e2, e3……, en) |e1 is element of E1, e2 is element of E2…….en is element of
En}
Where (e1, e2, e3…..en) is relationship.
To illustrate this Consider the entity sets Customer and account. We define the
relationship set Cus_Acc to denote the association between customer and the
account in which they are working. This association is depicted by drawing lines.
Weak Entity Sets & Strong Entity Sets:-
An entity set is called a weak entity Set if its existence depends on other entites
called Strong entites. Thus a weak entity set does not have sufficient attributes to
form a primary key. An entity set which has a primary key, is termed a strong entity
set.
Outline Rectangle. As Shown in fig. entity set Departures which the only attribute
date is weak entity set .This because at the fact that although each Departure
9
entity is Distinct different Flight may have Departure on the day. As result
different flight may share the same date value. A weak entity set indicated in E-R
diagram by a doubly outline Rectangle.
FLIGH DEPARTURE
INSTAN
TS C-OF S
SOUR
DESTINATI
CE ON
Data Models:-
Data models are a collection of conceptual tools for describing data, data
relationships, and data semantics and data constraints. There are three
different groups:
At this point, we'll take a closer look at the entity-relationship (E-R) and
object-oriented models.
We'll see later how well this model works to describe real world situations.
Str
eet
Numb Bala
Na
City er nce
me
11
The Object-Oriented Model
Unlike entities in the E-R model, each object has its own unique identity,
independent of the values it contains:
556
Lowery Maple
647
13
Figure: A sample network database
The relational model does not use pointers or links, but relates records by the
values they contain. This allows a formal mathematical foundation to be defined.
Reduction of E-R Schema (Diagram) to Tables:-
A database that conforms to an E-R Database schema can be represented by a
collection of tables. For each entity set and for relationship set in the database,
there is a unique table that is assigned the name of the corresponding entity set or
relationship set. Each table has multiple columns, each of which has a unique name.
Both the E-R model and the relation database model are abstract, logical
representations of real- world enterprises. Because the two models employ similar
design principles, we can convert an E-R design into a relational design converting a
database representation form an E-R diagram to a format is the basis for deriving a
relational-database design from an E-R diagram.
Aggregation:-
LOAN_OFF
ICER
EMPLO
14
YEE
EMP_ EMP_TELEP
EMP_NA HONE
ID ME
The best way to model such as the one just described is to use
aggregation is an abstraction through which relationships are
treated as higher-level entites. Thus, for our example, we
regard the relationship set borrower and entity sets customer and
loan as a higher –level entity set Called borrower, such an entity
set is the same manner as is any other entity set. A common
notation for aggregation is shown in Figure.
We shall see that the database designer needs a good
understanding of the enterprise being modeled to make these
decisions. Specialization and
Generalization:-
Stree
Name City
t
Credit-
rating
Person
Salary
ISA
Customer Employe
e
ISA
Hours- Hours-
Office worked worked
15
Specialization and Generalization:-
Specialization:-
Top –down design process we designate sub grouping
within an entity set that are distinctive from other
entities in the set.
These sub grouping become lower-level entity sets that
have attributes or participate in relationships that do
not apply to the higher-level entity set.
Depicted by a Triangle component labeled ISA (example
customer is a person).
Attribute inheritance:-A lower-level entity set inherits all
the attributes and relationship participation of the
higher level entity set to which it is linked.
Generalization:-
A bottom-up design process combine a number of
entity sets that share the same features into higher-
level entity set.
Specialization and Generalization are simple inversions
of each other; they are represented in an E-R diagram
in the same way.
The terms Specialization and Generalization are used
interchangeably.
16