Introduction To RDBMS
Introduction To RDBMS
Introduction
Dr. E.F Codd was the founder of RDBMS
He defined RDBMS is A Relational Model of Data for Large shard
Data Banks
RDBMS Terminology:
Relation !a"le
!u#le $ Row% re&ord
Cardinalit' (u)"er of rows
Attri"ute $ &olu)n% field
Degree $ (u)"er of &olu)ns
*ri)ar' ke' $ uni+ue identifier
Do)ain $ set of legal ,alues
Relational Data Structure
!he s)allest unit of data in the relational )odel is the indi,idual
data ,alue
Data ,alue are assu)ed to "e ato)i& e% no internal stru&ture.
A do)ain is a set of all #ossi"le data ,alues
Attri"utes
Degree
!he nu)"er of attri"utes in a relation is &alled the degree of the
relation.
A relation of degree one is unar'% a relation of degree two is &alled
"inar' et&.
!he nu)"er of tu#les -or. row in a relation is &alled Cardinalit' of
the relation
Relational Data integrity
Most of the relations ha,e on attri"ute whi&h are uni+uel' identif'
ea&h tu#le in the relation.
/n so)e &ases% there are )ore than one attri"ute whi&h &an
uni+uel' identified ea&h tu#le in the relation . !his attri"ute is &alled
as Candidate ke' ie%
Consultan&'
*rodu&tion%
Maintenan&e
0#erations% E&
EMP_N N!ME !"E DEP!RTMENT
E12323 Ale4is Leon 56 Consultan&'
E62789 Ri&hard Bode :1 *rodu&tion
E;1625 <a)es S)ith 99 Consultan&'
E;6232 !ho)as <ohn :: 0#erations
E;9873 Da,id <a&o" 59 Maintenan&e
Cardinality
Tuples
Do
ma
I
n
s
R
e/
a
t
i
o
n
E#am$le
Element table
Symbol Name !tomic no% Melting $t Boiling $t
A6 Alu)inu) 65 255 ;72;
Fe /ron ;8 6366 565:
(i (i&kel ;3 67;3 5638
/n this Ele)ent ta"le there are 5 &andidate ke's su&h that =s')"ol>
=(a)e> =and> =Ato)i& no>.
E,er' relation has at least one &andidate ke'.
/n &ase of "ase relation one &andidate ke' is designated as *ri)ar'
ke' and re)ainir' ke's are &alled alternate ke's.
Foreign ke' is an attri"ute -or. attri"ute &o)"ination of are relation
whose ,alues are re+uired to )at&h those of the #ri)ar' ke' of
so)e other relation -ta"le..
S&i$ment table
Item 'uantity Destination
A6 611 Delhi
Fe 911 Delhi
Au 9 Delhi
=/te)> of the shi#)ent ta"le )at&hes the =s')"ol> of the =Ele)ent
ta"le>. !herefore =ite)> is the =foreign ke'>
(onstraints )or Relational Model%
Relational data )odel in&ludes se,eral t'#es of &onstraints to
)aintain a&&ura&' and integrit' of the data in the data"ase.
!he )a?or integrit' &onstraints@
Do)ain &onstraints
Entit' integrit'
Referential integrit'
0#erational &onstraints.
i) Domain constraints:
A do)ain is a set of ,alues that )a' "e assigned to an attri"ute.
A do)ain definition usuall' &onsists of following
(om$onents:
Do)ain na)e
Meaning
Data t'#e
SiAe -or. length
Allowa"le ,alues -or. Allowa"le range.
BB
ii) Entity integrity:
Entit' integrit' rule is designed to assure that e,er'
relation has #ri)ar' ke' and the ,alue of #ri)ar' ke' is
,alid.
Entit' integrit' guarantees that e,er' #ri)ar' ke'
attri"ute is nonnull.
iii) Re)erential integrity:
/t is a rule that )aintains &onsisten&' a)ong rows of two
ta"les.
!he rule states that the foreign ke' in one relation% either
ea&h foreign ke' ,alue )ust )at&h a #ri)ar' ke' ,alue in
other ta"le -or. foreign ke' ,alue )ust "e null.
i*) $erational (onstraints:
!hese are the &onstraints enfor&ed in the data"ase "'
the "usiness rules -or. real world li)itations.
!nd : Age should "e less than -or. e+ual to 81.
(DD+s Rules
Relational data"ase is the finite &olle&tion of relations and relation
in ter)s of do)ains% attri"ute% asso&iations and tu#les.
Dr. E.F. Codd% #la&es relational )odel>s &hara&teristi&s in three
"road &ategories.
6. Stru&tural features that su##ort the ,iew of the data. !he' in&lude
relations and their undergoing &o)#onents%
;. /ntegrit' features su&h as entit' and referential integrit' and also
a##li&ation s#e&ifi& &onstraints.
5. Data )ani#ulation features for data retrie,al% insertion% deletion and
u#date.
Codd #ro,ides a set of 6; rules whi&h +ualit' a data"ase #rodu&t
as relation.
,% In)ormation rule:
All infor)ation in a relational data"ase in&lude ta"le na)es% &olu)n
na)es is re#resent "' ,alues in ta"les.
!his ,iew of data s#eeds design and learning #ro&ess.
A&tion &an "e taken when the &onstraints are ,iolated.
A&&ess of data &an "e restri&ted.
-% "uaranteed !ccess rule:
E,er' #ie&e of data in a relational data"ase &an "e a&&essed "'
using a &o)"ination of a ta"le% a #ri)ar' ke' ,al,e that identifies
the row and a &olu)n na)e% whi&h identifies
Cser #rodu&ti,it' is i)#ro,ed sin&e there is no need to resort to
using #h'si&al #ointers -or. address.
/t is #ossi"le to retrie,e ea&h indi,idual #ie&e of data stored in
data"ase "' s#e&if'ing the na)e of the ta"le in whi&h it is stored
the &olu)n and #ri)ar' ke' whi&h identifies the &ell in whi&h is
stored.
.% Systematic Treatment o) Nulls Rule:
RDBMS handles re&ords that ha,e unknown -or. ina##li&a"le
,al,es in #redefined fashion.
!hrough the set of rules for handling nulls% user &an distinguish
results of the +ueries that in,ol,e nulls% Aeros and "lanks
/% !cti*e on0line catalog Based on t&e relational model
!he des&ri#tion of the data"ase of its &ontents are data"ase ta"les%
it &an +ueried online ,ia the data )ani#ulation language.
1% (om$re&ensi*e Data sub0language rule:
RBDMS ha,e se,eral languages.
/t allows the user to do the following%
define ta"les and ,iews
+uer' and u#date
set integrit' &onstraints
set authoriAations.
Define transa&tions.
2% 3ie4 u$dating rule:
An' ,iew that &an "e u#dated theoreti&all' &an "e u#dated using
the RDBMS.
Data &onsisten&' is ensured sin&e the &hanges )ade in the ,iew is
trans)itted to the "ase ta"le and Di&e,ersa.
5% 6ig&0le*el insert7 u$date and delete:
RDBMS su##orts insertion% u#dating and deletion of a ta"le le,el.
!he #erfor)an&e is i)#ro,ed sin&e the &o))ands a&t on a set of
re&ords rather than on one re&ord at a ti)e.
8% P&ysical Data inde$endence:
!he e4e&ution of ad ho& re+uest and a##li&ation #rogra)s is not
affe&ted "' &hanges in the #h'si&al data a&&ess and storage
)ethods.
Data "ase ad)inisters &an )ake &hanges to #h'si&al a&&ess and
storage )ethods whi&h i)#ro,e the #erfor)an&e.
9% :ogical data inde$endence:
Logi&al data &hanges in ta"les and ,iews su&h as adding E deleting
&olu)ns or &hanging field need not ne&essitate )odifi&ation in the
#rogra) or for)at of adho& re#ast.
,;% Integrity inde$endence:
Like ta"le and ,iew% integrit' &onstraints are stored in on $line
&atalog and therefore &hanged without &hanges in the a##li&ation
#rogra)s.
,,% Distribution inde$endence:
A##li&ation #rogra)s and adho& re+uest are not affe&ted "'
&hanges in the distri"ution of #h'si&al date.
!his i)#ro,es relia"ilit'.
,-% Non0sub*ersion rule:
/f the RDBMS has a language that a&&esses the infor)ation of a
re&ord atti)e% this language should not "e used to "'#ass the
integrit' &onstraints. !his is ne&essar' for date integrit'.