Data Independence and Keys
Data Independence and Keys
37
3. Internal View/Level
1. It is the lowest level of
data abstraction.
2. It is close to the
physical storage method.
3. Internal view is expressed by the internal schema which contains
the definition of stored record
4. Internal view does not deal with
representing the data field.
it views a
physical device directly instead
physical device as a collection of physical pages and
allocate the space in terms of
5. The separation of
logical pages.
need to specify the
logical description of data base without the
physical structure is called physical data
independence.
6. Separating the external view from the conceptual view enable uus
to change the conceptual view without affecting the external view
is called logical data independence.
2.3 DATA INDEPENDENCE
The ability to use the data base without knowing the representation
details is called data independence."
The reason for data independence are as follows
1. To allow the DBA to make change in the content, location,
representation and organization of a data base without causing
reprogramming of application program which use the data base.
2. To provide the centralization of control need by DBA to ensure
the security and integrity of data base
3. To simplify the application program development in particular, to
facilitate the development of programs for interactive data
progressing.
4. To facilitate data sharing by allowing the same data to appear
to be organized differently for different application program.
c2ncep
Physical data independence change in the internal
and exter ZIelhoa
schema and will not affect the change in ternal
logical schema
conceptual schema.
2.3.1 Data Makung
Independence-Achievement
of DBMs
of Layered Architectue thattk
SChena
A major objective
for three-level architecture is to
independence, which means that upper levels are unaffectedprovide
by
dat
in lower levels. changes 4 DIFFER
dala orchaa
Logical data independence indicates that the
can be
changed without affecting the existing conceptual schem
external schemas 2 his very d
datla are he
The change would be absorbed
and conceptual levels.
by the mapping between the externa stucture of
3 Appication p
Logical data independence also insulates
recordsapplication
fron new fields
operations such as combining two into one programs
or splitting a he data ba
existing record into two or more records.
4 tis conce
This would require a change in the
so as to leave the external view
external/conceptual mapping sChema.
unchanged.
(b) Physical Data Independence
Physical data independence indicates that the
structures or devices could be changed without physical storag
schema. affecting conceptua
The change would be absorbed by the
conceptual and internal levels. mapping between the
Physical data independence is achieved
by the
presence of
internal level of the database and the
from the conceptual level of the databasemapping or transformau
to the internal leve
Conceptual level to internal level mapping, therefore provides
means to go from the
conceptual view (conceptual records) to
internal view and hence to the stored data in the datada
(physical records).
I f there is a need to change the file
organization or
the P
physical device used as a result of growth in the database o
pe
n e w
MA
DATA BASE LANGUAGE AND ITS ARCHITECTURE 39
technology, a
change is required in the
mapping between the conceptual/internal
conceptual
and internal levels.
This change is
necessary to maintain the conceptual level invariant.
The physical data
independence criterion requires that the
conceptual level does not specify storage structures or the access
methods (indexing,
the physical
hashing etc.) used to retrieve the data from
storage medium.
Making the conceptual schema physically data independent means
that the external
schema, which is defined on the conceptual
schema, is in turn physically data
independent.
2.4 DIFFERENCE BETWEEN LOGICAL DATA INDEPENDENCE
AND PHYSICAL DATA INDEPENDENCE
Logical Data Independence Physical Data Independence
It is concerned with the structure of the
1. It is concerned with storage of the data.
data or changing the data definition.
2 It is very difficult as the retrieving of2. It is easy to retrieve.
data are heavily dependent on logical
structure of data.
3. Application program need not be changed 3. Physical data base is concerned with
if new fields are added or deleted from the change of the storage device.
the data base.
4. It is concerned with the conceptual4. tis concerned with the internal schema.
schema.
Conceptual view
Physical
Data Independence
Internal View
Figure 2.5
2.5 MAPPING
The conceptual data base is the model or abstraction of th
to the data base.
the
objects of concern
MS
S ACOERs
Description of the above table:
Entity STUDENT Roll
76
2 9107 Shevta 35 39 Rpenies
o
83
3 9104 Baljit 35 37 Are
Degree 6 82
2 A pri
prin
Key The
Any two individual entities in the set are prohibited from Prin
6.6. Prir
the same value of having
key attributes at the same time. The various 7. If tht
7.
types of keys are as follows
att
1. Primary key
8. We
2. Foreign key
of
3. Super key 9. Prir
4. Alternate key
2.2 Fore
5. Candidate key
Afo-
2.7.1 Primary Key par
T h e term primary key denotes a ta
key that is choosen by the aad tabl
base designer as the principle mean of identifying unique
Cord
Fore
re
within a table.
and
.The primary key should be choosen in such ale of la
must not change.
a way that i1s n he
For example in table student, Roll no. is the primary key
ey. This
Rol
all the Roll
no.
no. are unique and all the student have a uny youme r
aprmarNy
ofal
With the help of primary key one can get the informauo
other items of that table.
s ACCESSs DATABAS BASE LANGUAGE AND ITS ARCHITECTURE 45
Student
Roll# Name Fee status Rank
W,
w. C++ 9102 Ram Paid 3
C++ 9104 Sita Not Paid 4
9105 Gourav Paid 13
9106 Ram Paid 3
Here the primary key is Roll #. All the information about a particular
can be known by knowing the Roll # of the student.
student
Properties of Primary Key
82 1. A relation can contain only one primary key.
known a s single
2. A primary key may be composed of a single attribute
known as composite key.
primary key or more than one attribute
3. A primary key is the minimum super key.
should not be
4. The data values for the primary key attribute(s)
ributes null.
known as Prime
nce of 5. Attributes which are part of a primary key are
set. attributes.
candidate keys.
naving 6. Primary key always chosen from the possible
is
m o r e than o n e
attribute then those
arious key is made of
7. If the primary
attributes are irreducable.
that from primary key
the convention that the attribute(s)
8. We use
is underlined.
of relation
duplicate values.
cannot contain
9. Primary key
2.7.2 Foreign key more columns in a table
A foreign key is the
combination of one or
in another table (child
reference a primary key
(parent table) that
table). in table
acting a s a primary key
one
data is a key which is
Foreign key in a n o t h e r table.
Then this type
cord n o n primary key
and is acting a s
is called as foreign key.
of key item is acting like a primary
alue in the relatio
n the fig. 2.7 item-code as purchase-Id
purchase relation
ke attribute is a foreign key in item-code is
This in item relation
relation so
ause
Pnary key in the purchase acting as a primary key.
it is not
Roll a
primary key and in purchase when there is only one table
to have a foreign
key referencing and
s it possible be a case in which
there can
all In a data base? yes,
DBMS WITH MS
46
ACCE
CCES
PRIMARY KEY
PURCHASE
PURCHASE PURCHASE
DATA
ITEM-CODE
ID
FOREIGN
KEY
ITEM COST
ITEM ITEM-CODE ITEM-QUALITY
PRIMARY KEY
Figure 2.7
guarantee uniqueness.
must hold.
3.
3. Uniqueness and irreducability properties
4. A relation must have atleast one candidate key.