0% found this document useful (0 votes)
23 views29 pages

DB Project Milestone 4 (28,40,43)

Uploaded by

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

DB Project Milestone 4 (28,40,43)

Uploaded by

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

Attendence Management System

Database Design Document


V 3.0

By
1 <Muhammad Raqib Hayat> <NUM-BSCS-2022-40>
2 <Mamoon Haseeb Khan> < NUM-BSCS-2022-28>
3 <Muhammad Zaeem Rana> < NUM-BSCS-2022-43>

Department of Computer Sciences


Namal University
Mianwali, Pakistan
Submission Date: 30th June, 2024
<Project Title>

REVISION HISTORY
Date Version Description Approved by
In documentation although we did not do much
more modifications because user just need to add
30/6/24 V.3.0 User Interface and we add user interface and it did
not afftect other documentation of previous
milestone.
We added the data and also added the data about
10/6/24 V.2.0
Entitiess and Relationships in this version
Specify the changes implemented subsequent to the
submission of the previous document. These
22/04/24 V 1.0
changes should be based on the suggestions given
by the person who approved the document.

Instructions:
 Place the latest revisions at the top of the table.
 The Revision History pertains only to changes in the document's content or any updates
made after a suggestion from the approving authority. It does not apply to the template's
formatting.

2
<Project Title>

TABLE OF CONTENTS

CHAPTER 1: PROJECT OVERVIEW.........................................................................................................4


1.1. INTRODUCTION:........................................................................................................................4
1.2. PROBLEM STATEMENT:............................................................................................................4
1.3. PROJECT OBJECTIVES:.............................................................................................................4
1.4. DOCUMENT OBJECTIVES:.......................................................................................................4
CHAPTER 2: DETAILED DATABASE DESIGN.......................................................................................5
2.1. ENTITY:........................................................................................................................................5
2.2. DATA DICTIONARY:...................................................................................................................5
2.3. RELATIONSHIPS:........................................................................................................................5
2.4. ENTITY RELATIONSHIP DIAGRAM:.......................................................................................6
CHAPTER 3 : Logical DATABASE DESIGN..............................................................................................7
3.1. RELATIONAL SCHEMA:............................................................................................................7
3.2. FUNCTIONAL DEPENDENCIES:..............................................................................................7
3.3. NORMALIZATION:.....................................................................................................................7
CHAPTER 4 : Physical DATABASE DESIGN............................................................................................8
4.1. STRUCTURE OF THE TABLES:.................................................................................................8
4.2. DATA SAMPLES INSIDE TABLES:...........................................................................................8
4.3. QUERIES RESULTS:....................................................................................................................8
CHAPTER 5 : Interface Design.....................................................................................................................9
5.1. LANGUAGE/FRAMEWORK:.....................................................................................................9
5.2. DATABASE CONNECTIVITY:...................................................................................................9
5.3. STORED PROCEDURES AND FUNCTIONS:...........................................................................9
5.4. INTERFACES:..............................................................................................................................9
CHAPTER 6 : CONCLUSION...................................................................................................................10
6.1. LESSONS LEARNED:...............................................................................................................10
6.2. CHALLENGES AND SOLUTIONS:..........................................................................................10
6.3. FUTURE WORK AND IMPROVEMENTS:..............................................................................10
6.4. FINAL THOUGHTS:..................................................................................................................10
REFERENCES.............................................................................................................................................11

3
<Project Title>

CHAPTER 1: PROJECT OVERVIEW


1.1. INTRODUCTION:
We are making Attendance Management System. It is just like the traditional Attendance which
was taken on registers. We are just converting the register system into a digital form so that we do
not need any register for attendance. The instructor can log in to any device and can take
attendance and even he/she can take attendance on the mobile phone.

1.2. PROBLEM STATEMENT:


We are solving the problem that there will be no need for registers for taking attendance
or we do not need any calculations that how many absentees have been done for a
particular student it will all be manual but the bad thing is that it is also some manual
system where the instructor has to call all the students manually to take attendance.

1.3 PROJECT OBJECTIVES:


The major objectives of our Attendance Management System are:

 Our AMS will be efficient and fast because we will make our ERDs in an efficient
manner.
 An instructor can log in at any place with any device and can take attendance.
 We will also make the Front end or GUI of our AMS to make it user friendly.

1.4 DOCUMENT OBJECTIVES:


We are trying to make our project in such a way that our main focus remains on the
scope and our main focus will be on Database instead of Front and designing etc. Our
AMS will be efficent in terms of working as our main focus remains on the database.

4
<Project Title>

CHAPTER 2: DETAILED DATABASE DESIGN


1.3. ENTITY:
Sr. Entity Name Description
No
01 Student Student entity represents the student whose attendance is taken
and this entity contains the Student_ID, Student_Name, and
Student_Mail
02 Attendance_Recor It is an associative entity between three entities Student,
d Classes, and course and it contains data about attendance
status and Attendence records data
03 Classes Class is just like the slot or period and it contains the data
about the class such as room, schedule, and class_ID
04 Course Course entity tells us about course details and it contains
course name and description as attributes.
05 Instructor The instructor is the person who is managing or taking the
attendance. This entity includes the name and email of the
instructor

1.3.1. Student:
Sr. No Name Data Type Constraint Description
01 Student_ID Int Primary key It is the unique identity
(Primary Key) number for every student in
the class.
02 Student_Name Varchar(255 NOT NULL It is the name of the student
)
03 Student_Email Varchar(255 Unique or NOT It is the email_Id of the
) NULL student which is also unique
for every student

1.3.2. Attendence_Record:
Sr. Name Data Type Constraint Description
No
01 Record_ID Int Primary Key It is the record number that
(Primary Key) identifies each record
uniquely
02 Student_ID Int Foreign Key and It is the student ID or
unique Student roll number which
is the foreign key here
03 Class_ID Int Foreign key and It is the class_ID that
Unique uniquely identifies each
class or slot and it is foreign
key here

5
<Project Title>

04 Course_ID Int Foreign key and It is the course ID or course


Unique code that uniquely identifies
each course and it is also
foreign key here
05 Enrollment_ID int NOT NULL It is the unique enrollment
ID which was assigned to
student at the time of course
enrollment.
06 Daate Date NOT NULL It is the date when the class
is taken
07 Attendance_Statu int NOT NULL It is the main attribute of the
s system which indicates the
attendance status of the
student in form 0 or 1.

1.3.3. Classes:
Sr. No Name Data Type Constraint Description
01 Class_ID Int Primary key It is the ID of the class which
(Primary Key) uniquely identifies each class
or slot number.
02 Course_ID Int Foreign key or It is the foreign key here
Unique which indicates the course
code or course ID
03 Instructor_ID int Foreign key or The unique ID of every
Unique Instructor is the Instructor ID
here.
04 Room Varchar(255 Not NULL It is the room name and
) number of rooms where class
currently occurred
05 Schedule Varchar(255 NOT NULL It is the schedule of timings of
) the class

1.3.4. Course:
Sr. Name Data Type Constraint Description
No
01 Course_ID Int Primary key It is the course ID of the
(Primary Key) class which uniquely
identifies each course.
02 Course_Name Varchar(255 NOT NULL It is the name of the course
)
03 Course_Descriptio Varchar(255 Not NULL It defines the content of the
n ) course
04 Instructor_ID int Foreign key It is the foreign key here
that uniquely identifies
each instructor.

6
<Project Title>

7
<Project Title>

2.1.5: Instructor:
Sr. No Name Data Type Constraint Description
01 Instructor_ID Int Primary key It is the instructor ID of the
(Primary Key) Instructor which uniquely
identifies each instructor
02 Instructor_Nam Varchar(255 NOT NULL It is the name of the
e ) instructor
03 Instructor_Emai Varchar(255 Not NULL or It is the email of the
l ) Unique instructor and every
instructor has a unique mail

1.4. RELATIONSHIPS:
Sr. No Participating Entities Relation Business Rule
01 Student, Student contains A Student contains one or
Attendence_Record Attendence_Records more than one attendance
records.
02 Classes, Classes contain One class contains one or
Attendence_Record Attendence_Records more than one attendance
record.
03 Course, Courses have One course contains one or
Attendence_Record attendance record. more than one
Attendence_Records
04 Course , Classes Course has classes One course can be taught in
one or more classes
05 Course, Instructor Instructor teaches One instructor can teach one
course or more than one course
06 Classes, Instructor Instructor schedule One instructor can schedule
classes one or more one classes

8
<Project Title>

1.5. ENTITY RELATIONSHIP DIAGRAM:

CHAPTER 3 : LOGICAL DATABASE DESIGN


3.1. RELATIONAL SCHEMA:

9
<Project Title>

3.2: FUNCTIONAL DEPENDENCIES:

10
<Project Title>

3.3:NORMALIZATION:
In this part of our database project, we needed to identify transitive and partial
dependencies. However, after carefully checking our database structure, we found that there
are no such dependencies. This is because our design ensures that no non-key attribute
depends on another non-key attribute, and every non-key attribute is fully dependent on the
primary key. Therefore, the only dependencies in our database are functional ones, which we
explained in the previous section. By following this design, we have avoided redundancy and
maintained data integrity, keeping our database in the Third Normal Form (3NF).

1NF:
As there are no repeating groups and no multivalued attributes so it is already in 1NF
2NF:
As there are no partial dependencies so we can say that it is already in 2NF
3NF:
11
<Project Title>

As there is no transitive dependency so we can say that our ERD or relational schema is
already in 3NF.

12
<Project Title>

CHAPTER 4 : PHYSICAL DATABASE DESIGN


4.1. STRUCTURE OF THE TABLES:
Describe Student;

Describe Attendence_Record;

Describe Classes;

Describe Course;

Describe Instructor;

13
<Project Title>

4.2. DATA SAMPLES INSIDE TABLES:


Select * from student;

Select * from Attendence_Record;

Select * from classes;

14
<Project Title>

Select * from course;

Select * from Instructor;

4.3. QUERIES RESULTS:


Query # 1:
Retrieve the course name and instructor name for all classes:

SELECT c.Course_Name, i.Instructor_Name


FROM Classes cl
JOIN Course c ON cl.Course_ID = c.Course_ID
JOIN Instructor i ON cl.Instructor_ID = i.Instructor_ID;

15
<Project Title>

Query # 2:
Get the average attendance status for each student
SELECT s.Student_Name, AVG(ar.Attendence_slot) AS Avg_Attendance
FROM Attendence_Record ar
JOIN Student s ON ar.Student_ID = s.Student_ID
GROUP BY s.Student_Name;

Query # 3:
Find the courses that have more than 2 classes scheduled:
SELECT c.Course_Name, COUNT(cl.Class_ID) AS Class_Count
FROM Classes cl
JOIN Course c ON cl.Course_ID = c.Course_ID
GROUP BY c.Course_Name
HAVING COUNT(cl.Class_ID) > 2;

Query # 4:

16
<Project Title>

Retrieve the student name, course name, and attendance status


fora specific student:

SELECT s.Student_Name, c.Course_Name, ar.Attendence_Slot


FROM Attendence_Record ar
JOIN Student s ON ar.Student_ID = s.Student_ID
JOIN Classes cl ON ar.Class_ID = cl.Class_ID
JOIN Course c ON cl.Course_ID = c.Course_ID
WHERE s.Student_Name = 'Muhammad Zaeem Rana';

Query # 5:
Find the courses that have an instructor with the email
"[email protected]":
SELECT c.Course_Name
FROM Course c
JOIN Classes cl ON c.Course_ID = cl.Course_ID
JOIN Instructor i ON cl.Instructor_ID = i.Instructor_ID
WHERE i.Instructor_Email = '[email protected]';

Query # 6:
Retrieve the student name, course name, and attendance
statusfor all students who have attended at least one class:

SELECT s.Student_Name, c.Course_Name, ar.Attendence_Slot


FROM Attendence_Record ar
JOIN Student s ON ar.Student_ID = s.Student_ID
JOIN Classes cl ON ar.Class_ID = cl.Class_ID

17
<Project Title>

JOIN Course c ON cl.Course_ID = c.Course_ID


WHERE ar.Attendence_Slot = 1
ORDER BY s.Student_Name, c.Course_Name;

Query # 7:
Find the courses that have a schedule that conflicts with another
course's schedule:
SELECT c1.Course_Name AS Course1, c2.Course_Name AS Course2
FROM Classes cl1
JOIN Course c1 ON cl1.Course_ID = c1.Course_ID
JOIN Classes cl2 ON cl1.Schdule = cl2.Schedule AND cl1.Class_ID <> cl2.Class_ID
JOIN Course c2 ON cl2.Course_ID = c2.Course_ID
GROUP BY c1.Course_Name, c2.Course_Name
HAVING COUNT(DISTINCT cl1.Class_ID) > 0 AND COUNT(DISTINCT cl2.Class_ID) >
0
LIMIT 0, 1000;

Query # 8:
Retrieve the student name, course name, and attendance status
for all students who have attended at least one class with a
passing attendance status (Attendence_Status = 1):
SELECT s.Student_Name, c.Course_Name, ar.Attendence_Slot
FROM Attendence_Record ar
JOIN Student s ON ar.Student_ID = s.Student_ID
JOIN Classes cl ON ar.Class_ID = cl.Class_ID
JOIN Course c ON cl.Course_ID = c.Course_ID

18
<Project Title>

WHERE ar.Attendence_Slot = 1
ORDER BY s.Student_Name, c.Course_Name;

Query # 9:
Find the courses that have no scheduled classes:
SELECT c.Course_Name
FROM Course c
LEFT JOIN Classes cl ON c.Course_ID = cl.Course_ID
WHERE cl.Class_ID IS NULL;

Query # 10:
Retrieve the student name, course name, and attendance status
for all students who have attended at least one class, and order
the results by student name and course name:
SELECT s.Student_Name, c.Course_Name, ar.Attendence_Slot
FROM Attendence_Record ar
JOIN Student s ON ar.Student_ID = s.Student_ID
JOIN Classes cl ON ar.Class_ID = cl.Class_ID
JOIN Course c ON cl.Course_ID = c.Course_ID
ORDER BY s.Student_Name, c.Course_Name;

19
<Project Title>

20
<Project Title>

CHAPTER 5

21
<Project Title>

: Interface Design

5.1. LANGUAGE/FRAMEWORK:
For GUI we are using Python language and basically we are using the Tkinter for GUI in Python and
Message box for Display tables. Although first we tried to make our User Iterface in HTML and in CSS
but it was very difficult to connect and making the GUI and user friendly as easy to we converted or
shifted to Python

5.2. DATABASE CONNECTIVITY:


To connect a GUI client to a MySQL database, we typically use a MySQL database connector, such as the
MySQL Connector/Python library. This library provides a Python interface for interacting with a MySQL
database and facilitates the connection between your GUI application and the database.

5.3. STORED PROCEDURES AND FUNCTIONS:


First Procedure:
DELIMITER //

CREATE PROCEDURE InsertStudent(IN p_student_id INT, IN p_student_name VARCHAR(255), IN


p_student_email VARCHAR(255))
BEGIN
INSERT INTO Student (Student_ID, Student_Name, Student_Email) VALUES (p_student_id,
p_student_name, p_student_email);
END //

CREATE PROCEDURE UpdateStudent(IN p_student_id INT, IN p_student_name VARCHAR(255), IN


p_student_email VARCHAR(255))
BEGIN
UPDATE Student SET Student_Name = p_student_name, Student_Email = p_student_email WHERE
Student_ID = p_student_id;
END //

CREATE PROCEDURE DeleteStudent(IN p_student_id INT)


BEGIN
DELETE FROM Student WHERE Student_ID = p_student_id;
END //

22
<Project Title>

2nd Procedure:

CREATE PROCEDURE SearchStudent(IN p_student_id INT)


BEGIN
SELECT * FROM Student WHERE Student_ID = p_student_id;
END //

DELIMITER //

CREATE PROCEDURE InsertInstructor(IN p_instructor_id INT, IN p_instructor_name


VARCHAR(255), IN p_instructor_email VARCHAR(255))
BEGIN
INSERT INTO Instructor (Instructor_ID, Instructor_Name, Instructor_Email) VALUES
(p_instructor_id, p_instructor_name, p_instructor_email);
END //

CREATE PROCEDURE UpdateInstructor(IN p_instructor_id INT, IN p_instructor_name


VARCHAR(255), IN p_instructor_email VARCHAR(255))
BEGIN
UPDATE Instructor SET Instructor_Name = p_instructor_name, Instructor_Email =
p_instructor_email WHERE Instructor_ID = p_instructor_id;
END //

CREATE PROCEDURE DeleteInstructor(IN p_instructor_id INT)


BEGIN
DELETE FROM Instructor WHERE Instructor_ID = p_instructor_id;
END //

CREATE PROCEDURE SearchInstructor(IN p_instructor_id INT)


BEGIN
SELECT * FROM Instructor WHERE Instructor_ID = p_instructor_id;
END //

DELIMITER

DELIMITER //
3rd Procedure:
CREATE PROCEDURE InsertCourse(IN p_course_id INT, IN p_instructor_id INT, IN
p_course_name VARCHAR(255), IN p_course_desc VARCHAR(255))
BEGIN

23
<Project Title>

INSERT INTO Course (Course_ID, Instructor_ID, Course_Name, Course_Desc) VALUES


(p_course_id, p_instructor_id, p_course_name, p_course_desc);
END //

CREATE PROCEDURE UpdateCourse(IN p_course_id INT, IN p_instructor_id INT, IN


p_course_name VARCHAR(255), IN p_course_desc VARCHAR(255))
BEGIN
UPDATE Course SET Instructor_ID = p_instructor_id, Course_Name = p_course_name,
Course_Desc = p_course_desc WHERE Course_ID = p_course_id;
END //

CREATE PROCEDURE DeleteCourse(IN p_course_id INT)


BEGIN
DELETE FROM Course WHERE Course_ID = p_course_id;
END //

CREATE PROCEDURE SearchCourse(IN p_course_id INT)


BEGIN
SELECT * FROM Course WHERE Course_ID = p_course_id;
END //

DELIMITER

DELIMITER //

4th Procedure:
CREATE PROCEDURE InsertClass(IN p_class_id INT, IN p_course_id INT, IN p_instructor_id
INT, IN p_room VARCHAR(255), IN p_schedule VARCHAR(255))
BEGIN
INSERT INTO Classes (Class_ID, Course_ID, Instructor_ID, Room, Schdule) VALUES
(p_class_id, p_course_id, p_instructor_id, p_room, p_schedule);
END //

CREATE PROCEDURE UpdateClass(IN p_class_id INT, IN p_course_id INT, IN p_instructor_id


INT, IN p_room VARCHAR(255), IN p_schedule VARCHAR(255))
BEGIN
UPDATE Classes SET Course_ID = p_course_id, Instructor_ID = p_instructor_id, Room =
p_room, Schdule = p_schedule WHERE Class_ID = p_class_id;
END //

CREATE PROCEDURE DeleteClass(IN p_class_id INT)


BEGIN
DELETE FROM Classes WHERE Class_ID = p_class_id;
END //

CREATE PROCEDURE SearchClass(IN p_class_id INT)

24
<Project Title>

BEGIN
SELECT * FROM Classes WHERE Class_ID = p_class_id;
END //

DELIMITER

DELIMITER //
5th Procedure:

CREATE PROCEDURE InsertAttendanceRecord(IN p_record_id INT, IN p_student_id INT, IN


p_class_id INT, IN p_course_id INT, IN p_enrollment_id INT, IN p_date DATE, IN
p_attendance_slot INT)
BEGIN
INSERT INTO Attendence_Record (Record_ID, Student_ID, Class_ID, Course_ID,
Enrollment_ID, Daate, Attendence_Slot)
VALUES (p_record_id, p_student_id, p_class_id, p_course_id, p_enrollment_id, p_date,
p_attendance_slot);
END //

CREATE PROCEDURE UpdateAttendanceRecord(IN p_record_id INT, IN p_student_id INT, IN


p_class_id INT, IN p_course_id INT, IN p_enrollment_id INT, IN p_date DATE, IN
p_attendance_slot INT)
BEGIN
UPDATE Attendence_Record SET Student_ID = p_student_id, Class_ID = p_class_id,
Course_ID = p_course_id, Enrollment_ID = p_enrollment_id, Daate = p_date, Attendence_Slot
= p_attendance_slot
WHERE Record_ID = p_record_id;
END //

CREATE PROCEDURE DeleteAttendanceRecord(IN p_record_id INT)


BEGIN
DELETE FROM Attendence_Record WHERE Record_ID = p_record_id;
END //

CREATE PROCEDURE SearchAttendanceRecord(IN p_record_id INT)


BEGIN
SELECT * FROM Attendence_Record WHERE Record_ID = p_record_id;
END //

DELIMITER

25
<Project Title>

5.4. ;INTERFACES:

26
<Project Title>

27
<Project Title>

CHAPTER 6 : CONCLUSION
6.1. LESSONS LEARNED:
In this project we have learned that every big task must be divided into small milestones and
small tasks so that it can be done easily. If we have to do the complete project in just one task
then it would be very difficult for us to do but as Mam Asiya divided this project into milestones
so it was really a great source of learning for us. We also learned about team work. We also
learned how to tackle problems in such a way that we have to learn many things on the spot . We
cannot completely depend on instructor or on just one member of the project.

6.2. CHALLENGES AND SOLUTIONS:


First challenge was to make proposal . It was the big challenge because we was not sure
what we are going to made and what we will do and what we can do. As we did not
learned any proper course of user Interface so we we not well aware of making UI so we
made it very difficultly. And connenting the UI with Database was also the very big
probelm
6.3. FUTURE WORK AND IMPROVEMENTS:
Although we did not made proper full stack Application of Website of this project but
Inshallah in future we will make a proper website and launch our this Attendence
Management System just like QOBE and we will purchase proper hosting as well.
6.4. FINAL THOUGHTS:
Although it was really intresing because we made it in such a way that in the form of
milestones so we did it as I discussed earlier if we have to complete it in a single ways
then it would be very difficult. We have learned many things while making this project
and one major thing is team work.

REFERENCES
(Namal University, n.d.) (For Data of Attendence)
(Chart, n.d.) (For ERD)

28
<Project Title>

Notes to the Author


[This document is a template for creating a Database Design Document (DDD) for a given project. The
template includes instructions to the author, boilerplate text, and fields that should be replaced with the
values specific to the particular project.

 Blue italicized text enclosed in square brackets (i.e., [text]) provides instructions to the document
author, or describes the intent, assumptions and context for content included in this document.
 Blue italicized text enclosed in angle brackets (i.e., <text>) indicates a field that should be replaced
with information specific to the particular project.
 Text and tables in black are provided as boilerplate examples of wording and formats that may be
used or modified as appropriate.
Delete this “Notes to the Author” page and all instructions to the author (i.e., all blue italicized text
enclosed in square brackets) before finalizing the initial draft of the DDD.]
Formatting Guidelines:

 Level 1 Heading: Font Style: Times New Roman, Font Size: 20, Color: Black, Case: All Caps, Align:
Right, Numbering Style: CHAPTER 1… Should appear in Table of Content
 Level 2 Heading: Font Style: Times New Roman, Font Size 16, Color Black, Case: All Caps, Align:
Lef,t Numbering Style: 1.1, 1.2 … Should appear in Table of Content
 Level 3 Heading: Font Style: Times New Roman, Font Size 14, Color Black, Case: Capitalize each
word, Align: Left, Numbering Style: 1.1.1, 1.1.2 … Should Not appear in Table of Content
 Paragraph: Font Style: Times New Roman, Font Size 12, Color Black, Case: Sentence Case, Align:
Justified, Should Not appear in Table of Content, Add space before and after paragraph.
 Insert caption to the picture with figure number.
 Insert caption to table with table number.
Any text that is in blue and italicized is for your understanding only and should not be included in your
submission document.

29

You might also like