0% found this document useful (0 votes)
412 views8 pages

Data Independence and Keys

1. There are two types of data independence: logical data independence and physical data independence. 2. Logical data independence means changing the conceptual schema without affecting the internal and external schemas. Physical data independence means changing the internal and external schemas without affecting the conceptual schema. 3. The key difference is that logical data independence is concerned with the structure of data, while physical data independence is concerned with the storage of data. Logical changes are more difficult as data retrieval depends on the logical structure, while physical changes are easier as they only impact storage.

Uploaded by

Barinder Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
412 views8 pages

Data Independence and Keys

1. There are two types of data independence: logical data independence and physical data independence. 2. Logical data independence means changing the conceptual schema without affecting the internal and external schemas. Physical data independence means changing the internal and external schemas without affecting the conceptual schema. 3. The key difference is that logical data independence is concerned with the structure of data, while physical data independence is concerned with the storage of data. Logical changes are more difficult as data retrieval depends on the logical structure, while physical changes are easier as they only impact storage.

Uploaded by

Barinder Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

DATA BASE LANGUAGE AND ITS ARCHITECTURE

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.

Therefore data independence can be defined as the capacity to change the


schema without having to change the schema at next higher level.

There are two types of data independence.


1. Logical Data Independence.
2. Physical Data Independence.
1. Logical Data Independence :

It means changing the conceptual schema without affecting the


internal and external schema.
The application programmer changes the logic of the program.
38
DBMS WITH MS ACCES
I t will not affect the storage of data and also not the 11
externall view. user or
2. Physical data
Independence Thepk

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

There are two kinds of data


independence: A N D P

Logical data independence


Physical data independence Logical

(a) Logical Data Independence t i sconcem

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.

External External External


View 1 View 2 View 3
Logical data
Independence

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

Attribuate Sr. No Name Roll No. DBMS,


Field 1 9108 N/W, C 9105

Tuple 1 9108 Harmeet 70 35


76
Cardianality 3 Heretihe

Domain 9108 Harmeet 70 35 nientcan

76
2 9107 Shevta 35 39 Rpenies
o
83
3 9104 Baljit 35 37 Are

Degree 6 82
2 A pri
prin

2.7 CONCEPT OF KEY


3 A pr

Key The

A key is a single attribute


combination of two or more attributes
or null
of an entity set which is used to
identity one or more instance d 5. Attr
5.
the set. Roll No. in the student relation iS a
key of entity set attr

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

reference relations are same but distinct such referencing consider


the relation EMP such that EMPC emp-name, Mgr-Id.
i n this relation and mgr-id is
emp-id is primary key a
foreign key
EMP referencing emp-id of EMP relation itself.
So EMP relation is acting as referencing as well as referenced
Thus in the above example we see that there is only one table ie.
EMP and this table has a foreign key i.e. mgr-id.
Properties of Foreign Key
1. For the existence of a foreign key attribute, there must exist a
corresponding key attribute in some other relation or the same
relation.
2. The foreign key relation is usually known as the child relation
and the primary key relation from which foreign key is derive
is known as the parent or target relation.
3.
3 Forelgn key are usually defined when all the relations have betd
created (ie. atleast one tuple should exist in
relation)
4. There may exist more than one foreign key in a
is not mecessary that a foreign
relatioo
key always exists in a rc
5. Foreign key allows the relations to be linked
some relationships with each other.
together in lo
Foreign key
derlined

6. are usually represented


in italics or wiggly ua match

7. Foreign key attribute nmay contain a null value or it must


the primary key data value the
parent relation.
47
.BASE
DAT
LANGUAGE AND ITS ARCHITECTURE
2.7.3 Super key
allow u s
is the set of o n e o r more attributes taken collectively,
It
set.
to identify uniquely an entity in the entity
irreducibility.
It has a property of uniqueness and necessarily
contain two
the relation ever
1. Uniqueness : No legal value in
different tuple with the s a m e value of the attribute.
2. Irreducibility: No proper subset of
attribute has the uniqueness
property.
OR
If w e add the additional attribute to the Primary
Key, the resulting
combination still uniquely identify an instance of entity set. SUc

keys are called super key.


the day of the month key
For Example : If date of birth is the primary key by adding
called super key.
in date of birth field, this key in
candidate key is the super key."
A super set of a

Properties of Super Key


relation should have atleast one super key.
1. Every
2. A key is a subset of a super key.
candidate
o r irreducable super key.
3. Candidate key is a minimal
number of
formed by a combination of any
4. A Super key c a n be
property.
attributes of the relation that satisfjy uniqueness
taken together a r e a super key because
5. All attributes of a relation
relation (table) is unique.
each tuple(row) in a

2.7.4 Alternate key


the primary key in a relationa
key after selecting
Rest of the candidate
is called as alternate key.
and Name combination is candidate key. If Roll
Example: If Roll no. in the candidate key is Name.
no. is Primary key, then the
other key
Name attribute will act as Alternate key.

2.7.5 Candidate key


attribute of a relation which have the
Candidate keys a r e those
and irreducibility.
PIOperty of uniqueness
all the attribute of X has uniqueness
Let X be relation, the set of
a
time n o tuples in the value of X at
roperty meaning that at any given Let S be a set of attributes of
o n e another.
a t time a r e duplicate of if it possesses both of the following
relation X then S is a candidate key
properties
1. Uniqueness: NO 1ega
with the same value for S.
ofX has the uniqueness prop
pe
2. Irreducibility: No proper subset
candidate key is composite
m e a n s that if a
Irreducibility property
attribute) then
no attribute
individual attribut
(consist of more than o n e
unique. For example if
example
which participate into it. is
candidate key, is unique
then
then it
it can
can
combination of (Name, Class) in a relation class indivi
if name and
identified as the candidate key if and only allowed to be N
candidate key is
are not unique. No component of
the
table.
be number of candidate keys in a
There can any
Properties of Candidate Key
keys. For examp
than one candidate
1. A relation can have more

relation. EMP Id and PAN NO (Personal Accou


In EMPLOYEE
acts a s a candida
Number issued by Income Tax Departmcnt)

keysfor the relation.


contain null value since it does
docs nne
22. A candidate key cannot a

guarantee uniqueness.
must hold.
3.
3. Uniqueness and irreducability properties
4. A relation must have atleast one candidate key.

2.7.6 Unique Key


Unique key primary key. The only difference is the
is similar to
does not allow null value
11ique allows Null value. But primary key

You might also like