Database Group Project1
Database Group Project1
VERSI
TY
School
ofcomput
ing
Adv
anceddat
abase
Gr
ouppr
oject
Pr
ojectTi
tl
e:HUMANRESOURCEMANAGEMENTSYSTEM
Gr
oupmember
s i
dnumber
1.
Asmamawgi
rmay
=EI
TM/
TUR/
181552/
16
2.
Sear
eber
he=UGR/
178479/
12
3.
Dawi
tgebr
emedhi
n=ugr
/178339/
12
4.
Hai
l
ushabr
ehal
ey=ugr
/181510/
16
5.
Eyobf
eseha=ugr
/179147/
12
Usi
ngSQLinaHumanResourceManagementSy stem (HRMS)i
nvolv
esvari
oustaskssuchas
managi
ngempl
oyeer
ecor
ds,tracki
ngat
tendance,processi
ngpayr
oll
,andgener
ati
ngreport
s.
Bel
owaresomekeyf
unct
ionali
ti
esandexamplesofhowSQLcanbeusedi nanHRMS:
▎1.Dat
abaseDesi
gn
Fi
rst
,youneedt
odesi
gny
ourdat
abaseschema.Commont
abl
esi
nanHRMSmi
ghti
ncl
ude:
•Empl
oyees:
Stor
esempl
oyeedet
ail
s.
•Depar
tment
s:St
oresdepar
tmenti
nfor
mat
ion.
•At
tendance:
Tracksempl
oyeeat
tendance.
•Pay
rol
l
:Managessal
aryandpay
mentdet
ail
s.
•Per
for
mance:
Recor
dsempl
oyeeper
for
manceev
aluat
ions.
▎ Exampl
eSchema
CREATETABLEEmpl
oyees(
Empl
oyeeI
DINTPRI
MARYKEY,
Fi
rst
NameVARCHAR(
50)
,
Last
NameVARCHAR(
50)
,
Depar
tment
IDI
NT,
Hi
reDat
eDATE,
Sal
aryDECI
MAL(
10,
2),
FOREI
GNKEY(
Depar
tment
ID)REFERENCESDepar
tment
s(Depar
tment
ID)
)
;
CREATETABLEDepar
tment
s(
Depar
tment
IDI
NTPRI
MARYKEY,
Depar
tment
NameVARCHAR(
50)
)
;
CREATETABLEAt
tendance(
At
tendanceI
DINTPRI
MARYKEY,
Empl
oyeeI
DINT,
Dat
eDATE,
St
atusVARCHAR(
10)
,
FOREI
GNKEY(
Empl
oyeeI
D)REFERENCESEmpl
oyees(
Empl
oyeeI
D)
)
;
CREATETABLEPay
rol
l(
Pay
rol
l
IDI
NTPRI
MARYKEY,
Empl
oyeeI
DINT,
Pay
Dat
eDATE,
AmountDECI
MAL(
10,
2),
FOREI
GNKEY(
Empl
oyeeI
D)REFERENCESEmpl
oyees(
Empl
oyeeI
D)
)
;
▎2.I
nser
ti
ngDat
a
Youcani
nser
templ
oyeer
ecor
dsi
ntot
hedat
abaseusi
ngSQLI
NSERTst
atement
s.
I
NSERTI
NTOEmpl
oyees(
Empl
oyeeI
D,Fi
rst
Name,
Last
Name,
Depar
tment
ID,
Hir
eDat
e,Sal
ary
)
VALUES(
1,'
John'
,'
Doe'
,1,
'2023-
01-
15'
,60000.
00)
;
▎3.Quer
yingDat
a
Youcanr
etr
iev
einf
ormat
ionaboutempl
oyees,
att
endance,
orpay
rol
lusi
ngSELECTst
atement
s.
-
-Getal
lempl
oyeesi
naspeci
fi
cdepar
tment
SELECT*FROM Empl
oyeesWHEREDepar
tment
ID=1;
-
-Getat
tendancer
ecor
dsf
oraspeci
fi
cempl
oyee
SELECT*FROM At
tendanceWHEREEmpl
oyeeI
D=1;
-
-Getpay
rol
ldet
ail
sforanempl
oyee
SELECT*FROM Pay
rol
lWHEREEmpl
oyeeI
D=1;
▎4.Updat
ingRecor
ds
Youmayneedt
oupdat
eempl
oyeei
nfor
mat
ionorat
tendancest
atus.
-
-Updat
eempl
oyeesal
ary
UPDATEEmpl
oyeesSETSal
ary=65000.
00WHEREEmpl
oyeeI
D=1;
-
-Updat
eat
tendancest
atus
UPDATEAt
tendanceSETSt
atus='
Present
'WHEREEmpl
oyeeI
D=1ANDDat
e='
2023-
10-
01'
;
▎5.Del
eti
ngRecor
ds
Youcanr
emov
erecor
dsi
fnecessar
y.
-
-Del
eteanempl
oyeer
ecor
d
DELETEFROM Empl
oyeesWHEREEmpl
oyeeI
D=1;
-
-Del
eteat
tendancer
ecor
dforaspeci
fi
cdat
e
DELETEFROM At
tendanceWHEREEmpl
oyeeI
D=1ANDDat
e='
2023-
10-
01'
;
▎6.Gener
ati
ngRepor
ts
Youcangener
ater
epor
tsbycombi
ningdat
afr
om mul
ti
plet
abl
esusi
ngJOI
Nst
atement
s.
-
-Getar
epor
tofempl
oyeeswi
tht
hei
rdepar
tmentnames
SELECTe.
Fir
stName,
e.Last
Name,
d.Depar
tment
Name
FROM Empl
oyeese
JOI
NDepar
tment
sdONe.
Depar
tment
ID=d.
Depar
tment
ID;
-
-Gett
otal
sal
arypay
outf
oreachdepar
tment
SELECTd.
Depar
tment
Name,
SUM(
e.Sal
ary
)ASTot
alSal
ary
FROM Empl
oyeese
JOI
NDepar
tment
sdONe.
Depar
tment
ID=d.
Depar
tment
ID
GROUPBYd.
Depar
tment
Name;
▎7.Adv
ancedFeat
ures
Youmi
ghtal
soi
mpl
ementst
oredpr
ocedur
es,
tri
gger
s,andv
iewsf
ormor
ecompl
exoper
ati
ons.
▎Exampl
eofaSt
oredPr
ocedur
e
CREATEPROCEDUREGet
Empl
oyeeAt
tendance(
@Empl
oyeeI
DINT)
AS
BEGI
N
SELECT*FROM At
tendanceWHEREEmpl
oyeeI
D=@Empl
oyeeI
D;
END;
▎Concl
usi
on