0% found this document useful (0 votes)
121 views33 pages

Database Systems: Gul Jabeen, PHD Lecturer E.Mail: Gul - Jabeen@Kiu - Edu.Pk Department of Computer Sciences

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 33

Department of Computer Sciences

Database Systems
Lecture 5
Gul Jabeen, PhD
Lecturer
E.Mail: gul.jabeen@kiu.edu.pk
Department of Computer Sciences

BSCS-BSIT-2018-2022 Slide 1
Department of Computer Sciences

Practical example 1
l We want to model a simple university database
• In our database, we have students.
• They have a name, a registration number, and a course of study.
• The university offers lectures. Each lecture may be part of some course
of study in a certain semester. Lectures may have other lectures as
prerequisites.
• They have a title, provide a specific number of credits and have an
unique ID
• Each year, some of these lectures are offered by a professor at a
certain day at a fixed time in a specific room. Students may register
for that lecture.
• Professors have a name and are member of a specific department.

BSCS-BSIT-2018-2022 Slide 2 2
Department of Computer Sciences

How to start?What to do?


• Find the basic entity types
• Find the attributes of entities
• Decide to which entity an attribute should be assigned
• Which attributes are key attributes?
• Some attributes are better modeled as own entities,which ones?
• Define the relationship types
• Which role do entities play? •
• Do relationships require additional entity types?
• Are the relationships total? Identifying?Are weak entities involved?
• What are the cardinalities of the relationship type?

BSCS-BSIT-2018-2022 Slide 3 3
Department of Computer Sciences

Which are our entity types?


• In our database, we have students.They have a name,a registration
number and a course of study.
• The university offers lectures. Each lecture may be part of some course
of study in a certain semester. Lectures may have other lectures as
prerequisites. They have a title, provide a specific number of credits
and have unique ID
• Each year,some of these lectures are offered by a professor at a
certain day at a fixed time in a specific room.Students may attend that
lecture.
• Professors have a name and are member of a specific department.

BSCS-BSIT-2018-2022 Slide 4 4
Department of Computer Sciences

What attributes are there?


l In our database,we have students.They have a name, a
registration number and a course of study.
l The university offers lectures. Each lecture may be part of some
course of study in a certain semester. Lectures may have other
lectures as prerequisites.They have a title, provide a specific
number of credits and have unique ID
l Professors have a name and are member of a specific department.

BSCS-BSIT-2018-2022 Slide 5 5
Department of Computer Sciences

First try… ■ This model is really crappy!


– “Course of study” does not seem to be an attribute
– Used by student and lecture.Even worse, lecture refers to
a course of study in a specific curriculum semester. Use
additional entity type with relationships
■ “Prerequisite lecture” also is not a good attribute
– Prerequisite lectures are also lectures.Use a relationship
instead!
■ “Professor” does not have key attributes

BSCS-BSIT-2018-2022 Slide 6 6
Department of Computer Sciences

Second try
l Second try
• Professors use a surrogate key now
• Key is automatically generated and has no meaning beside unique identification
• Course of study is an entity type now •

BSCS-BSIT-2018-2022 Slide 7 7
Department of Computer Sciences

Which entity types are additionally related?


“Each year, some lectures of the pool of all lectures are offered by a
professor at a certain day at a fixed time in a specific room. Students
may attend that lecture.

BSCS-BSIT-2018-2022 Slide 8 8
Department of Computer Sciences

BSCS-BSIT-2018-2022 Slide 9 9
Department of Computer Sciences

BSCS-BSIT-2018-2022 Slide 10 10
Department of Computer Sciences

PART 2

BSCS-BSIT-2018-2022 Slide 11
Department of Computer Sciences

Practical Example 2
l Lets study another database an Examination System
of an Educational Institution
l During initial study phase, we identified following
major points

BSCS-BSIT-2018-2022 Slide 12
Department of Computer Sciences

Preliminary Study
1. Students are enrolled in programmes/degrees
2. Programmes comprise of different courses
3. Different programmes are offered at the start of semester
4. Students register courses of different programmes at the
start of every semester
5. After valid registration students attend the classes
6. Teachers submit results during and at the end of
semester

BSCS-BSIT-2018-2022 Slide 13
Department of Computer Sciences

Preliminary Study
7. Subjects’ grade points are calculated on the basis of
results submitted
8. Semester GPA is calculated on the basis of subjects’ GPs
9. Cumulative GPA is calculated on the basis of semesters’
GPAs
10. Courses, results, students data is stored in files

BSCS-BSIT-2018-2022 Slide 14
Department of Computer Sciences

Outputs Required
l Teachers and controller need
class list or attendance sheet,
class result; subject and overall
l Students need transcripts,
semester result card, subject
result

BSCS-BSIT-2018-2022 Slide 15
Department of Computer Sciences

Data Flow Diagram

BSCS-BSIT-2018-2022 Slide 16
Department of Computer Sciences

Registration
System Student

Pe
rs
lt n

on
u t i o
s a

al
e r
R ist

De
e g
v id e

tai
o R
Pr e

ls
u rs
Co

EXAMINATION
SYSTEM

Cl
t a
sul t Su ss
e ul R
R
it es Ov bje es
er ct ul
u bm s R al R t
S las l R es
C es ult
ul
t

Teacher Controller
BSCS-BSIT-2018-2022 Slide 17
Department of Computer Sciences

MAIN MODULES

1.Subject registration

2.Result submission

3.Result calculation

BSCS-BSIT-2018-2022 Slide 18
Department of Computer Sciences Re
gis
tra
STUDENT tio
n
De PROGRAM
t ail
& COURSE

q
1.0 Va

Pre-Re
lid
Edit Form

Course
In- 2.0
Va
lid
Check
Pre-Req

ed
rifi
Ve
RESULT
REGISTRATION
es ult
s R
v iou
Pre

BSCS-BSIT-2018-2022 Slide 19
Department of Computer Sciences R
eg
istr
atio
STUDENT nD
eta PROGRAM
il
& COURSE
1.0 Va

Pre-
li d
Edit Form

Req
Course
In-V 2.0
a lid Check
Pre-Req

d
ri fie
Ve
RESULT t
esul REGISTRATION
R
vi ous
Pre

tail
Su
b jec

n De
tG
P 5.0 4.0
t GP

tratio
Update je c Calculate
S ub
Result GP

Regis
Teacher 3.0
Collect Info
lt
Result R esu
Submit Result
BSCS-BSIT-2018-2022 Slide 20
Department of Computer Sciences Re
g i s tr
atio
STUDENT nD
et a PROGRAM & COURSE
il
1.0 Va
lid

q
Course
Pre-Re
Edit Form
Controller In-Va 2.0
lid Check
Overall Result
Pre-Req
8.0
Registration Detail
Verified
Generate
sR esult
Result Previou REGISTRATION
ul t
Res

Detai ation
Subject GP 5.0
P 4.0
RESULT Update ect G

tr
j Calculate
Sub

R e g is
l
Result GP
3.0
Collect
t In fo
Result
R es ul
G
esul t PA
Su bmi t R s
7.0 6.0
Calculate Calculate
CGPA GPA
Subject GP

Teacher GPA
BSCS-BSIT-2018-2022 Slide 21
Department of Computer Sciences

Cross Reference Matrix: 


l This matrix is used to find out that what values or attributes will appear in
which reports,
l For this purpose we write the major item names on a matrix in the row wise
order and the reports which will be generated will be written on top or in
column wise order. 

BSCS-BSIT-2018-2022 Slide 22 22
Department of Computer Sciences

BSCS-BSIT-2018-2022 Slide 23 23
Department of Computer Sciences

Analysis Phase

BSCS-BSIT-2018-2022 Slide 24
Department of Computer Sciences

Candidate Entity Types


l From DFD
• Student
• Controller
• Courses
• Teachers
• Courses Offered
• Programmes
• Registration
• Results
• Semester

BSCS-BSIT-2018-2022 Slide 25
Department of Computer Sciences

Support your ETs by


cross reference
matrix

BSCS-BSIT-2018-2022 Slide 26
Department of Computer Sciences

Candidate Entity Types

PROGRAM COURSES

STUDENT CRS_OFFERED

SEMESTER
TEACHER

BSCS-BSIT-2018-2022 Slide 27
Department of Computer Sciences

Program Student Teaacher Course Semester

Program Code Reg_No


T_Name Course Code Sem_Name
Stdname
Program Duration F_name
F_name Course Name Semester_start
No ofSemester DOB T_Address
Course Credit Semester_End
Level Ph_No T_phone
Address Pre-reqs
Qual
Cur_semes

Multivalued attribute
Experience
CGPA

GPA Salary

Std _sub_detail
Grade
Student_ sub_GPA

BSCS-BSIT-2018-2022 Slide 28
Department of Computer Sciences

BSCS-BSIT-2018-2022 Slide 29
Department of Computer Sciences

BSCS-BSIT-2018-2022 Slide 30
Department of Computer Sciences

Practice Session
l Application of E-R data model
l We study an example scenario and apply
the design phases we have studied so
far. Please draw a complete ER Diagram
with the given example scenario.

BSCS-BSIT-2018-2022 Slide 31
Department of Computer Sciences

THANKS

BSCS-BSIT-2018-2022 Slide 32
Department of Computer Sciences

THANKS

BSCS-BSIT-2018-2022 Slide 33

You might also like