DB Project Milestone 4 (28,40,43)
DB Project Milestone 4 (28,40,43)
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>
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
3
<Project Title>
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.
4
<Project Title>
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>
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>
9
<Project Title>
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>
Describe Attendence_Record;
Describe Classes;
Describe Course;
Describe Instructor;
13
<Project Title>
14
<Project Title>
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>
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:
17
<Project Title>
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
22
<Project Title>
2nd Procedure:
DELIMITER //
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>
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 //
24
<Project Title>
BEGIN
SELECT * FROM Classes WHERE Class_ID = p_class_id;
END //
DELIMITER
DELIMITER //
5th Procedure:
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.
REFERENCES
(Namal University, n.d.) (For Data of Attendence)
(Chart, n.d.) (For ERD)
28
<Project Title>
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