Académique Documents
Professionnel Documents
Culture Documents
juT Data
The quantities, characters, or symbols on
which operations are performed by a
computer, which may be stored and
transmitted in the form of electrical signals
and recorded on magnetic, optical, or
mechanical recording media.
Source: Google- What is data?
Information is data that has been processed in
such a way as to be meaningful to the person
who receives it.
jfty;: Information
jfty; vd;gJ mjid
ngw;Wf;nfhs;gtWf;F tpsf;fj;ijf;
nfhLf;ff; $ba tifapy;
Kiwtopg;gLj;jYf;fl;gLj;jg; gl;l
juthFk;.
,
,
,
:
1.
2. ER
3. ER
4.
5.
6. DDL
7. DML
gpuNahf nray;Kiwfs;
1. Njitfisf; fz;lwpjy;
2. ER tiuglj;ij jahupj;jy;
3.ER tiuglj;ij njhlu;GKiw juTj;js
ml;ltizf;F khw;Wjy;
4. ,ay;ghf;fy;
5. xUikg;ghL fl;Lg;ghbly;
6.DDL cgNahfpj;J njhlu;GKiw
juTj;jsk; cUthf;fy;
7. DML cgNahfpj;J juT Kfhikj;Jtk;
nra;jy;
.
, , ,
, ,
.
.
.
.
.
.
.
6.
1.
2.
3.
4.
5.
7.
, ,
, , ,
...
ER
1.
2. ,
3. () ()
4. (),
5.
ER tiuglj;ij jahupj;jy;
,dq;fhzg;gl;l nghJg; ngau;r; nrhw;fisAk;> tpidr;
nrhw;fisAk; Ntwhf;fpf; nfhs;sy;.
nghJg; ngau;r; nrhw;fs;> cUnghUs;> gz;Gfs;
vd;gtw;iw Ntwhf;fpf; nfhs;sy;.
nghJg; ngau;fs;fisAk; (cUnghUs;fs;)>
tpidr;nrhw;fisAk; (njhlu;GKiw) njhlu;G gLj;jy;
nghJg; ngau;fis (gz;Gfs;)> cUnghUs;fSld;
mDtjpj;jy; (Secondment)
vz;zstpid mwpe;J nfhs;sy;
ER
1: M
1 M
ER tiuglj;ij njhlu;GKiw
juTj;js ml;ltizf;F khw;Wjy;
njhlu;G
Kiw
Xd;W xd;W
nray;Kiw
cUnghUs;fs; ,uz;il ml;ltizfs; ,uz;lhf
khw;WjYk;> xU cUnghUspd; Kjd;ikr; rhtpia
mLj;j cUnghUspy; me;epar; rhtpahf mikj;jYk;
juTj;jsk; xd;wpd; $Wfs;.
md;whl
tho;tpd;
NjitfSf;Fg;
gad;gLj;Jthu;.
njhlu;Gepiyj; juTj;jsk; (Relational Database)
, .
(Table) ml;ltiz
(Record/Row/Tuple) gjpT/tupir
(Field/ Attribute) Gyk;
njhlu;Gepiyj; juTj;jsk;
(Relational Database)
(DBMS)
(Relational Database)
.
,t;tpsf;fj;jpw;fika juTj;js
Kfhikj;Jt Kiwiknahd;iwg; (DBMS)
gad;gLj;jp ml;ltizfs; gytw;iw
cUthf;Ftjhy; khj;jpuk; mJ xU
juTj;js Kfhikj;Jt Kiwik
(Relational Database) nahd;whf
miktjpy;iy vd;gJ ftzpf;fg;gl
Ntz;ba tplakhFk;.
.
cUthf;fg;gl;l ml;ltizfSf;fpilapy;
njhlu;GKiw cUthf;ff; $bathW
ml;ltizfs; cUthf;fg;gl Ntz;Lk;.
juT
Kiwapdhy; fpilf;Fk; ed;ikfs
(redundancy)
.
juT kpifikiaf; Fiwj;Jf;nfhs;syhk;
(inconsistency)
.
xUq;fpirtpd;ikia jtpu;Jf; nfhs;sf;
$
; baik
(share) .
juitg; gfpu;e;J gad;gLj;jf;$baik
njhlu;r;rp
(standards) .
epakq;fis mKy;gLj;jf;$baik
(security)
(integrity)
(redundancy) kpifik
kpifikapd; fhuzkhf ,lf;nfhs;ssT
tPzhf;fg;gLfpd;wJ.
kpifikapid KOikahf ePf;fKbAk; vdNth
.
my;yJ KOikahf ePf;fg;gl Ntz;Lk; vd;gJ
fUj;jhFk;.
(inconsistency)
.
.
.
.
.
. .
.
.
.
cjhuzkhf
.
.
.
ml;ltiznahd;wpd; Kjd;ikr;rhtp NtnwhU
ml;ltizapy; me;epar;rhtpahf ghtpf;fg;gLkplj;J
xNu juT kPz;Lk; kPz;Lk; gjpT nra;ag;gLfpd;wJ.
,J jtpu;f;f KbahjjhFk;. ,q;F kpifik gw;wpa
rpf;fy; Njhd;Wfpd;wJ.
.
mt;thwhd kPs;gjpTfs; eilngwhtpbd; ml;ltiz
,uz;bw;fpilapyhd njhlu;GKiw Vw;glhJ.
(share)
juitg; gfpu;eJ
; gad;gLj;jf;$baik
""
/ .
juTj;jsnkhd;wpy; juT vd;gJ mq;F
Nrkpf;fg;gl;bUf;Fk; ngWkhdq;fs; MFk;.
" / "
.
mt;thW Nrkpf;fg;gl;bUf;Fk;
ngWkhdq;fs; %yk; gadu; xUtuhy;
tpsf;fnkhd;iw ngwKbAkhapd; mJ
jftyhFk;
.
gadu;fs; ,Utifg;gLtu;
(single user) jdpg;gadu;
(multi user) gw;g
; adu;
.
,t;tpU re;ju;g;gq;fspd;NghJk; juT gfpu;T
eilngWfpd;wJ.
(application)
.
xNu jilitapy; cUthf;fg;gl;l
juitg;gad;gLj;jp Gjpa gpuNahfq;fis
cUthf;fyhk;
.
,r;re;ju;g;gj;jpy; gpuNahf nkd;nghUs;fs;
juit gfpu;e;J gad;gLj;Jfpd;wd.
(share).
juitg; gfpu;e;J gad;gLj;jy;
juTj;jsk;
gpuNahfk;;
gadu;
(standards) epakq;fs;
epakq;fs;
(application) gpuNahfq;fs;
(data representation) juT
gpujpepjpj;Jtk;
(data exchange)juT gupkhw;wk;
(data naming)juT ngauply;
(documentation) Mtzg;gLj;jy;
,
.
(security)
ghJfhg;G
modify, update,
delete, etc) .
gy;NtWgl;l gadu;fSf;F (retrieve, modify,
update, delete, etc)cupkkspj;jy;.
.
,yj;jpuzpay; juTj;jsnkhd;wpy;
fl;lhak; ,Uf;f Ntz;ba xU mk;rkhFk;
kPsg
; jpT Vw;gLjypd; tpiythy;
cz;lhtjhFk;
.
njhlu;Gepiyj; juTj;jsk;
.
,U tplaq;fs;
G+u;j;jpahf;fg;gl Ntz;Lk;.
.
rfy juTfSk; ml;ltizfspy; khj;jpuk; Nrkpj;jy;
(operations)
.
rfy nraw;ghLfs; (operations) %yKk; gioa ml;ltizfs;
ghtpf;fg;gl;L Gjpa ml;ltizfs; cUthFjy;.
SQL .
vdNt> SQL fl;lisfs; %yk; fpilf;Fk; midj;J ngWNgWfSk;
ml;ltizfshFk;.
Gyq;fs;
.
(date ) , ,
. ,
.
.
cjhuzk;:
jpfjp(date) Gynkhd;nwdpd; mjid tUlk;>
khjk;> jpfjp vd njhlu;Gepiyj;
juTj;jsnkhd;wpw;F KbahJ. mt;thW
Njitnadpd; nkdnghUspDs; nra;ag;gl
Ntz;Lk;.
mJ jpfjpjhd; vd mwpa njhlu;Gepiyj;
juTj;jsnkhd;wpw;F KbahJ.
Gyq;fs;
student table
index name
address
class
1022
S.M.G.D. Dayasiri
8B
566
G.M.D. Priyangani
11 C
923
F.D.C. Jayasingha
10 B
Gyq;fs;
gjpT
student table
index name
address
class
1022
S.M.G.D. Dayasiri
8B
566
G.M.D. Priyangani
11 C
923
F.D.C. Jayasingha
10 B
gjpT
(records)
.
ml;ltiz
student table
index name
address
class
1022
S.M.G.D. Dayasiri
8B
566
G.M.D. Priyangani
11 C
923
F.D.C. Jayasingha
10 B
ml;ltiznahd;wpy; gjpTfs;
. G+r;rpakhf
,Uf;fyhk;
. Xd;whf ,Uf;fyhk;
. Xd;wpw;F
; Nkw;gl;ljhf
,Uf;fyhk;
ml;ltiznahd;wpd; ,ay;Gfs;
index name
address
class
1022
S.M.G.D. Dayasiri
8B
566
G.M.D. Priyangani
11 C
923
F.D.C. Jayasingha
10 B
epiy(Degree)
# of fields
Vz;zsit(Cardinality)
# of records
student table
ml;ltiznahd;wpd; ,ay;Gfs;
.
gjpTfspd; gpujpfs; ,Uf;f KbahJ
(unordered).
njhlu;Gepiyfs;
- xd;W
xd;W (1:1)
- xd;W - gy (1:m)
- gy - gy (m:n)
1
table
table
table
-
xd;W - xd;W (1:1) njhlu;Gepiyia fl;bnaOg;gy;
student (Pkey index)
index
name
address
S001
Athula
Badulla
S002
Saman
Kandy
tableId
title
T001
Table 1
T002
Table 2
njhlu;nghd;W ,y;iy
?
tpdty; xd;W1
table (Pkey tableId)
tableId
name
address
S001
T002
Athula Badulla
S002
T001
Saman Kandy
tableId
title
T001
Table 1
T002
Table 2
tpdty; 2
student (Pkey index)
index
name
address
tableId
index
title
S001
Athula
Badulla
T001
S001
Table 1
S002
Saman
Kandy
T002
S002
Table 2
1 2
njhlu;Gepiyia fl;bnaOg;gy
Xd;W - xd;W
xd;W - gy njhlu;Gepiyia
m
student
class
.
.
ghlrhiy Kiwiknahd;wpy;
xU khztUf;F tFg;gpy; khj;jpuk; ,Uf;fyhk;
xU tFg;gpy; khztu; xUtu; my;yJ gyu;
,Uf;fyhk;.
xd;W - gy njhlu;Gepiyia
student
class
.
.
.
.
index
classId
name
address
S001
C012
Athula Badulla
S002
C012
Saman Kandy
classId
title
C012
Grade 12
C013
Grade 13
index
name
address
classId
index
title
S001
Athula
Badulla
C012
S001
Grade 12
S002
Saman
Kandy
C012
S002
Grade 12
C013
Grade 13
name
address
S001
Athula Badulla
S002
Saman Kandy
classId
title
C012
Grade 12
C013
Grade 13
index
C012
S001
C012
S002
njhlu;Gepiyia fl;bnaOg;gy;
njhlu;Gepiy
nray;Kiw
-
Xd;W-xd;W
xU cUnghUspd; Kjd;ikr; rhtpia mLj;j cUnghUspy;
me;epar; rhtpahf mikj;jy;
1: M 1 M
Xd;W-gy
gy- gy njhlu;Gepiy
m
student
ghlrhiy
sport
Kiwiknahd;wpy;
njhlu;Gepiyia fl;bnaOg;gy;
sportId
name
address
S001
SP001
Athula
Badulla
S001
SP002
Athula
Badulla
sportd
name
SP001
Badminton
SP002
Cricket
,J
xU(Pkey
jPu;t
hf mikahjJ Vd; vd sport
fye;
JiuahlTk;
student
index)
(Pkey
sportId)
index
name
address
sportId
index
title
S001
Athula
Badulla
SP001
S001
Badminton
S002
Saman
Kandy
SP001
S002
Badminton
njhlu;Gepiyia fl;bnaOg;gy;
sport (Pkey sportId)
name
address
S001
Athula
Badulla
S002
Saman
Kandy
studentSport(Pkey index+sportId)
sportId
name
SP001
Badminton
SP002
Cricket
index
sportId
S001
SP001
S002
SP001
S001
SP002
S002
SP002
Xd;W - xd;W
-
Xd;W - gy
gy - gy
xU cUnghUspd; Kjd;ikr; rhtpia mLj;j cUnghUspy;
me;epar; rhtpahf mikj;jy;
1: M 1 M
1:M ,d; 1 w;Fupa gf;fj;jpYs;s cUnghUspd; Kjd;ikr;
rhtpia :M gf;fj;jpYs;s cUnghUspd; me;epar;rhtpahf
ghtpj;jy;
Gjpjhf ml;ltiznahd;iw cUthf;fp mit ,uz;bdJk;
Kjd;ikr; rhtpfisAk; ,izj;J cUthf;fg;gl;l me;epar;rhtp
Gjpa ml;ltizapy; Kjd;ikr; rhtpahf gad;gLj;jy;
,ay;ghf;Fjy;
Kjy; ,ay;G
(Fields)
,uz;lhk; ,ay;G
%d;wlhk; ,ay;G
,ay;G tbtk;
Kjy; ,ay;ghf;fy;
SName
Desk
DName Coach1
Name1
Coach2
Name2
710
Saman
D001
Desk1
515
Nimal
D002
712
Sudath
D003
T125
Anil
T127
Sunil
T130
Wimal
Desk2
T127
Sunil
T125
Anil
T130
Wimal
Desk3
T130
Wimal
T125
Anil
T127
Sunil
:
ER
Fwpg;G:
ER tiuglk; rupahf cUthf;fg;gl;lhy; ,e;epiy
fhzg;glhJ
Coach3 Name3
Kjy; ,ay;ghf;fy;
StudentCoach (1st Normal form)
SName
Desk
DName
Coach
Name
710
Saman
D001
Desk1
T125
Anil
710
Saman
D001
Desk1
T127
Sunil
710
Saman
D001
Desk1
T130
Wimal
515
Nimal
D002
Desk2
T127
Sunil
515
Nimal
D002
Desk2
T125
Anil
515
Nimal
D002
Desk2
T130
Wimal
712
Sudath
D003
Desk3
T130
Wimal
712
Sudath
D003
Desk3
T125
Anil
712
Sudath
D003
Desk3
T127
Sunil
STIndex
,uz;lhk; ,ay;ghf;fy;
gjpTfs; ml;ltizap;d; Kjd;ikr;rhtpapyd;wp
NtW tplaq;fspy; jq;fpapUf;ff;$lhJ .(
Njitg;gbd; fyg;Gr;rhtp)
cjhuzj;jpw;F fzf;fPl;L Kiwiknahd;wpy;
thbf;ifahsupd; Kftupiaf; fUj;jpw;nfhs;f.
customer ml;ltiznahd;wpw;F Kftup
mtrpakhtJ Nghy; Orders, Shipping, Invoices,
Accounts Receivable, Collections Mfpatw;wpw;Fk;
Njitg;gLfpd;wJ.
,uz;lhk; ,ay;ghf;fy;
thbf;ifahsupd; (customer) Kftupia
xt;nthU ml;ltizapYk;; jdpj;jdpahf
gjpT nra;tjw;Fg; gjpyhf customer
ml;ltizapy; my;yJ address
ml;ltizapy; jdpahf gjpayhk;
,uz;lhk; ,ay;ghf;fy;
SName
Desk
DName
Coach
Coach
Name
710
Saman
D001
Desk1
T125
T125
Anil
710
Saman
D001
Desk1
T127
T127
Sunil
710
Saman
D001
Desk1
T130
T130
Wimal
515
Nimal
D002
Desk2
T127
515
Nimal
D002
Desk2
T125
515
Nimal
D002
Desk2
T130
712
Sudath
D003
Desk3
T130
712
Sudath
D003
Desk3
T125
712
Sudath
D003
Desk3
T127
STIndex
,uz;lhk; ,ay;ghf;fy;
STIndex
Coach
STIndex
710
T125
710
SName
Desk
DName
710
Saman
D001
Desk1
T127
515
Nimal
D002
Desk2
710
T130
712
Sudath
D003
Desk3
515
T127
515
T125
515
T130
712
T130
712
T125
712
T127
Name
T125
Anil
T127
Sunil
T130
Wimal
%d;whk;; ,ay;ghf;fy;
cjhuzj;jpw;F Ckpau; Ml;Nru;gG (Employee
Recruitment )ml;ltizapy;> xU Nju;T ehLdu;
(candidate)gy;fiyf;fofg; ngau; kw;Wk; Kftup
cs;slf;fg;gl;bUf;ff;$Lk;. Mdhy; FO mQ;ry;
Kiwapy; jfty; mDg;g> rfy
gy;fiyf;fyfq;fspd; ngau;g;gl;bay; Njitg;gLk;.
gy;fiyf;fyfq;fspd; tpguq;fs; candidate
ml;ltizapy; Nrkpf;fg;gl;bUg;gpd;
Nju;T ehLdu;fs; ,y;yhj gy;fiyf;foq;fis
gl;bay;gLj;j Kbahj epiyNaw;gLk;. MfNt
gy;fiyf;fofj;jpw;nfd gpwpnjhU ml;ltizia
cUthf;fp mjid candidate ml;ltizAld;
rhtpg;Gynkhd;Wld; njhlu;G gLj;jTk;. (university
code key
%d;whk;; ,ay;ghf;fy;
StudentCoach (3rd Normal form)
STIndex
Coach
710
T125
710
T127
710
515
SName
Desk
DName
710
Saman
D001
Desk1
515
Nimal
D002
Desk2
712
Sudath
D003
Desk3
STIndex
T130
T127
515
T125
515
T130
712
T130
712
T125
712
T127
Name
T125
Anil
T127
Sunil
T130
Wimal
StudentCoach (3rd Normal form)
STIndex
Coach
T125
710
T127
710
T130
515
T127
515
T125
515
T130
712
712
SName
Desk
710
Saman
D001
515
Nimal
D002
712
Sudath
D003
STIndex
710
712
Coach
(3rd
Normal form)
Coach
Name
T125
Anil
T127
Sunil
T130
T125
T127
T130
Wimal
DName
D001
Desk1
D002
Desk2
D003
Desk3
Types of constraints
fl;Lj;jpl;l tiffs;
A NOT NULL constrain
jdpj;Jt fl;Lg;ghL
A primary key constraint
Kjd;ikr;rhtpf; fl;Lg;ghL
me;epar;rhtpf; fl;Lg;ghL
A (table) check constraint
ml;ltiz rupghu;jj
; y; fl;Lg;ghL
A unique constraint
A unique constraint (also referred to as a
unique key constraint) is a rule that forbids
duplicate values in one or more columns
within a table. Unique and primary keys are
the supported unique constraints. For
example, a unique constraint can be defined
on the supplier identifier in the supplier table
to ensure that the same supplier identifier is
not given to two suppliers.
jdpj;Jt fl;Lg;ghL
jdpj;Jt fl;Lg;ghL vd;gJ xU
ml;ltiznahd;wpd; xU my;yJ gy
Gyq;fspy; xNu juT ,d;ndhUKiw gjpT
nra;ag;gLjiy jLf;fpd;wJ. jdpj;Jt kw;Wk;
Kjd;ikr;rhtp Mfpad jdpj;Jt
fl;Lg;ghLfSf;F cjTfpd;wd.
cjhuzj;jpw;F> supplier ml;ltizapy; toq;Fdu;
xUtiu jdpj;Jtkhf ,dq;fhz;gjw;F xt;nthU
toq;FdUf;Fk; milahsq;fhzp
(identifier)toq;fg;gLfpd;wJ. ,jd;%yk; xNu
milahsq;fhzp ,d;DnkhU toq;FdUf;F
toq;fg;glhkypUg;gij jdpj;Jt fl;Lg;ghL cWjp
nra;fpwJ.
Kjd;ikr;rhtpf; fl;Lg;ghL
A primary key constraint is a column or combination of
columns that has the same properties as a unique constraint.
You can use a primary key and foreign key constraints to
define relationships between tables.
Kjd;ikr;rhtpf; fl;Lg;ghL vd;gJ jdpj;Jt
fl;Lg
; ;ghl;by; cs;sJ Nghd;w gz;Gfisf; nfhz;l xU
my;yJ gy Gyq;fspd; Nru;fi
; fahFk;.
ml;ltizfSf;fpilapyhd njhlu;ig tiuaWf;f>
Kjd;ikr;rhtpf; fl;Lg;ghl;ilAk; me;epar;rhtpf;
fl;Lg;ghl;ilAk; ghtpf;fyhk;.
PARTICIPATION CONSTRAINT
gq;Nfw;G fl;Lg;ghL
An employee MUST work for a department
xU njhopyhsp jpizf;fsnkhd;wpw;fhf Ntiynra;a
Ntz;Lk;.
An employee entity can exist only if it participates in a WORKS_FOR
relationship instance
Derived Attribute
Derived Attributes
Another one
Types of Databases
Flat-file.
Flat file databases most closely resemble paper files and
file cabinets. Flat file databases, while simple to create and
access, contain lots of redundant information. These
redundancies slow down the search process, making the
flat-file type of database inefficient.
Hierarchical.
Hierarchical databases relate tables in a
parent/child format. Although this reduces
redundancy and increases organization, it is still a
limiting way to handle data. The fact that child
tables at the same level don't have links to each
other makes searching problematic.
Relational.
Relational databases link tables with common
"key" fields allowing for sophisticated
relationships between tables. Table links can be
"indexed" or stored for future use, resulting in
quicker searches in this type of database.
Object-oriented.
Object oriented databases are structurally similar
to relational databases. While most other types of
databases are designed to hold text and numbers,
object-oriented databases are designed to store
audio, video and other mixed media objects.
Network