Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Group Project DB

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

DEPARTMENT OF INFORMATION SYSTEMS

INTERNATIONAL ISLAMIC UNIVERSITY MALAYSIA

Semester 1, 2022/2023

INFO 1303 Database Systems

I-Mac Management System

Section : 2

Team Name: Alpha

Group Members

NAME MATRIC NO

AMMAR HAZIQ BIN ZAINAL 2217763

DANISH DARWIS BIN SHATHIBI 2210665

AIN ZEALOT MOHAMAD QURROTA 2118557

IRYAN SYAUQI BIN AZHAR 2213601

Supervised by
Dr. Atikah Balqis Binti Basri
TABLE OF CONTENT

NO CONTENTS PAGE

1. REPORT 2-11

1.1. INTRODUCTION 2

1.2. PROJECT TEAM ORGANISATION 2

1.3. ENTITIES AND ATTRIBUTES 3

1.4. BUSINESS RULES 4

1.5. ER/EER DIAGRAM 5

1.6. RELATIONS SCHEME 6

1.7. DATA DICTIONARY 7-11

2. SQL SCRIPT 12-15

2.1 SQL SCRIPT (PHYSICAL DATABASE DESIGN) 12-15

3. SQL QUERIES 16-17

3.1 FIVE QUERIES 16-17

1
1.1 Introduction

Our team is working on an I-Mac Management System project that will provide a centralised
system for storing and organising information on the programs, activities, and students engaged
in these programmes. The system presently handles programme registration, student registration,
allocating funds, and tracking status manually. The I-Mac Management System replaces some
manual operations with a computerised system that harvests data, enhances student service, and
reduces operational expenses.

1.2 Project Team Organization

2
1.3 Entities And Attributes

● Entity: Program
Attributes: program_id (varchar, primary key), purpose (varchar), program_name
(varchar), kulliyyah_id (varchar, foreign key), status (varchar)

● Entity: Activity
Attributes: activity_id (varchar, primary key), program_id (varchar, foreign key),
activity_name (varchar), act_date (date),start_time(varchar),end_time(varchar), purpose
(varchar), pic_id (varchar, foreign key), status(varchar).

● Entity: Kulliyyah
Attributes: kulliyyah_id (varchar, primary key), kulliyyah_name (varchar),
contact_details (varchar)

● Entity: Person_in_charge
Attributes: pic_id (varchar, primary key), pic_name (varchar), contact_details (varchar),
kulliyah_id (varchar, foreign key)

● Entity: DSU
Attributes: dsu_id (varchar, primary key), contact_details (varchar), policies_procedures
(varchar)

● Entity: Student
Attributes: student_id (varchar, primary key), student_name (varchar), contact_details
(varchar)

● Entity: Funding
Attributes:funding_id(varchar,primary key), program_id (varchar, primary key, foreign
key), dsu_id (varchar,foreign key), amount (decimal), approved (varchar)

● Entity: Feedback
Attributes: feedback_id (varchar, primary key), program_id (varchar, foreign
key),student_id(varchar,foreign key), score(number), comments(varchar)

● Entity: Registration
Attributes: registration_id(varchar,primary key), student_id(varchar,foreign key),
activity_id(varchar,foreign key).

3
1.4 Business Rules

● Each Kulliyyah is allowed to register for the IIUM Ibn Ummi Maktum Club (I-MaC) and
create a maximum of two programs per year.
● For each program, the Kulliyyah must provide a list of activities that includes details such
as the purpose, name, date, and time.
● There must be one person in charge assigned for each activity.
● Every activity must be approved by the DSU before it can be promoted and offered to
students in the short semester.
● The DSU will allocate funding for approved programs, with a maximum amount of RM
15,000. The amount granted is based on the estimated budget proposed by the Kulliyyah.
● The DSU will assess the budget proposal based on the type and number of planned
activities.
● The DSU will track the progress of each program and activity and record any feedback or
evaluation provided by participants.
● The DSU will record and track the number of participants with disabilities in each
program and activity.

4
1.5 ER/EER Diagram

5
1.6 Relation scheme

● Kulliyyah(kulliyyah_id, kulliyyah_name, contact_details)

● Person_in_charge(pic_id, pic_name, contact_details, kulliyyah_id)

● DSU(dsu_id, contact_details, policies_procedures)

● Student(student_id, student_name, contact_details)

● Program(program_id, purpose, program_name, kulliyah_id, status)

● Activity(activity_id, program_id, activity_name, act_date, start_time, end_time, purpose,


pic_id, status)

● Funding(funding_id,program_id, dsu_id, amount, approved)

● Registration(registration_id,student_id, activity_id)

● Feedback(feedback_id, program_id, student_id, score,comment)

6
1.7 Data Dictionary (METADATA)

Programs

Columns Data type Description

program_id varchar A unique identifier for the program

purpose varchar A description of the purpose or goals of the


program.

program_name varchar Name of the program

kulliyyah_id varchar The ID of the Kulliyah responsible for


organising the program.

status varchar The current status of the program (e.g.


"Pending", "Approved", "Completed").

Kulliyyah

Columns Data type Description

kulliyyah_id varchar A unique identifier for the


Kulliyyah

kulliyyah_name varchar Name of kulliyyah

contact_details varchar Contact information for the


Kulliyyah, such as a phone
number or email address.

7
Person_in_charge

Columns Data Type Description

pic_id varchar A unique identifier for the


person in charge

pic_name varchar Name of the person in charge

contact_details varchar Contact information for the


person in charge, such as a
phone number or email
address.

kulliyyah_id varchar The ID of the Kulliyyah that


the person in charge is
associated with.

DSU

Columns Data Type Description

dsu_id varchar A unique identifier for the


DSU

contact_details varchar Contact information for the


person in charge, such as a
phone number or email
address.

policies_procedures varchar Information about the policies


and procedures for approving
programs and allocating
funding.

8
Activity

Columns Data Type Description

activity_id varchar A unique identifier for the


activity.

program_id varchar The ID of the program that the


activity is part of.

activity_name varchar The name of the activity.

act_date date The date that the activity will


take place.

start_time varchar The time of the activity's start

end_time varchar The time of the activity's end.

purpose varchar A description of the purpose or


goals of the activity.

pic_id varchar The ID of the person in charge


of the activity.

status varchar The current status of the


program (e.g. "Pending",
"Approved", "Completed").

Student

Columns Data Type Description

student_id varchar A unique identifier for the


student

student_name varchar The name of the student

contact_details varchar Contact information for the


student, such as a phone
number or email address.

9
Funding

Columns Data Type Description

funding _id varchar The unique identifier for


funding

program_id varchar The ID of the program that


the funding is allocated to

dsu_id varchar The ID of the DSU that


allocated the funding.

amount decimal The year that the funding was


allocated.

approved varchar Approve or Pending

Feedback

Columns Data Type Description

feedback_id varchar A unique identifier for the


feedback.

program_id varchar The ID of the program that


the feedback is about.

student_id varchar The ID of the student who


provided the feedback.

score int The score provided by the


student for the program, on a
scale of 1 to 5.

comments varchar Any additional comments or


observations provided by the
student about the program.

10
Registration

Columns Data Type Description

registration_id varchar A Unique identifier assigned


to a user when they register
for application.

student_id varchar The ID of the student who


provided the feedback.

activity_id varchar A unique identifier for the


activity.

11
2.1 SQL script

-- Drop table
DROP TABLE Feedback;
DROP TABLE Registration;
DROP TABLE Funding;
DROP TABLE Student;
DROP TABLE DSU;
DROP TABLE Person_in_charge;
DROP TABLE Kulliyyah;
DROP TABLE Activity;
DROP TABLE Program;

-- Create table
CREATE TABLE Kulliyyah (
kulliyyah_id varchar(10) PRIMARY KEY ,
kulliyyah_name VARCHAR(255) NOT NULL,
contact_details VARCHAR(255) NOT NULL
);

CREATE TABLE Program (


program_id varchar(10) PRIMARY KEY,
purpose VARCHAR(255) NOT NULL,
program_name VARCHAR(255) NOT NULL,
kulliyyah_id varchar(10)REFERENCES Kulliyyah(kulliyyah_id),
status VARCHAR(255) NOT NULL
);

CREATE TABLE Person_in_charge (


pic_id varchar(10) PRIMARY KEY,
name VARCHAR(255) NOT NULL,
contact_details VARCHAR(255) NOT NULL,
kulliyyah_id varchar(10)REFERENCES Kulliyyah(kulliyyah_id)
);

CREATE TABLE Activity (


activity_id varchar(10) PRIMARY KEY,
program_id varchar(10) REFERENCES Program(program_id),
activity_name VARCHAR(255) NOT NULL,
act_date DATE NOT NULL,
start_time varchar(20) NOT NULL,
end_time varchar(20) NOT NULL,
purpose VARCHAR(255) NOT NULL,
pic_id varchar(10) REFERENCES Person_in_charge(pic_id),
status VARCHAR(255) NOT NULL
);

CREATE TABLE Student (

12
student_id varchar(10) PRIMARY KEY,
student_name VARCHAR(255) NOT NULL,
contact_details VARCHAR(255) NOT NULL
);

CREATE TABLE DSU (


dsu_id varchar(10) PRIMARY KEY,
contact_details VARCHAR(255) NOT NULL,
policies_procedures VARCHAR(255) NOT NULL
);

CREATE TABLE Funding (


funding_id varchar(10) PRIMARY KEY,
program_id varchar(10) REFERENCES Program(program_id),
dsu_id varchar(10) REFERENCES DSU(dsu_id),
amount NUMERIC(10, 2) CHECK (amount <= 15000),
approved varchar(10) NOT NULL
);

CREATE TABLE Registration (


registration_id varchar(10) PRIMARY KEY,
student_id varchar(10) REFERENCES Student(student_id),
activity_id varchar(10) REFERENCES Activity(activity_id)
);

CREATE TABLE Feedback (


feedback_id varchar(10) PRIMARY KEY,
program_id varchar(10) REFERENCES Program(program_id),
student_id varchar(10) REFERENCES Student(student_id),
score NUMERIC(4, 1),
comments varchar(255) NOT NULL
);

-- INSERT VALUES

INSERT ALL
INTO Kulliyyah values('K1','Engineering','engineering@iium.edu.my')
INTO Kulliyyah values('K2','Law','law@iium.edu.my')
INTO Kulliyyah values('K3','Medicine','medicine@iium.edu.my')
INTO Kulliyyah values('K4','HS','hs@iium.edu.my')
INTO Kulliyyah values('K5','IT','it@iium.edu.my')
select * from dual;

INSERT ALL
INTO Person_in_charge values('P101','Ahmad','ahmad@iium.edu.my','K1')
INTO Person_in_charge values('P102','Sarah','sarah@iium.edu.my','K2')
INTO Person_in_charge values('P103','Ali','ali@iium.edu.my','K3')
INTO Person_in_charge values('P104','Abu','abu@iium.edu.my','K4')

13
INTO Person_in_charge values('P105','Aminah','aminah@iium.edu.my','K5')
select * from dual;

INSERT ALL
INTO DSU values('D1','dsu@iium.edu.my',
'https://www.iium.edu.my/dsu/policies')
select * from dual;

INSERT ALL
INTO Student values('S1','Amir', 'amir@iium.edu.my')
INTO Student values('S2','Syafina', 'syafina@iium.edu.my')
INTO Student values('S3','Syamsul', 'syamsul@iium.edu.my')
INTO Student values('S4','Syafiq', 'syafiq@iium.edu.my')
INTO Student values('S5','Shahrul', 'shahrul@iium.edu.my')
select * from dual;

INSERT ALL
INTO Program values('PRG1','To provide support and resources for students
with disabilities','I-MaC','K1','Approved')
INTO Program values('PRG2','To promote awareness and understanding of
disability issues','Disability Awareness','K2','Pending')
INTO Program values('PRG3','To provide legal resources and support for
students','Legal Aid Clinic','K3','Approved')
select * from dual;

INSERT ALL
INTO Activity values('ACT1','PRG1','Seminar on Disability
Rights','1-Jan-23','10AM','12PM','To provide information on assistive
technology tools and resources','P101','Completed')
INTO Activity values('ACT2','PRG1','Workshop on Assistive
Technology','2-Jan-21','10AM','12PM','To educate students on disability rights
and advocacy','P102','Completed')
INTO Activity values('ACT3','PRG2','Lecture on stress
management','3-Jan-22','10AM','12PM','To educate students on stress management
techniques','P103','Completed')
INTO Activity values('ACT4','PRG2','Yoga
session','4-Jan-21','10AM','12PM','To promote relaxation and
self-care','P103','Completed')
INTO Activity values('ACT5','PRG3','Legal
clinic','5-Jan-23','10AM','12PM','To provide legal advice and resources to
students','P104','Completed')
select * from dual;

INSERT ALL
INTO Funding values('F1','PRG1','D1',5000,'True')
INTO Funding values('F2','PRG2','D1',7000,'True')
INTO Funding values('F3','PRG3','D1',9000,'True')
select * from dual;

14
INSERT ALL
INTO Registration values ('R1','S1','ACT1')
INTO Registration values ('R2','S2','ACT2')
INTO Registration values ('R3','S3','ACT3')
INTO Registration values ('R4','S4','ACT4')
INTO Registration values ('R5','S5','ACT5')
INTO Registration values ('R6','S1','ACT1')
select * from dual;

INSERT ALL
INTO Feedback values('FB1','PRG1','S1',5,'The workshop was very informative
and the facilitator was knowledgeable')
INTO Feedback values('FB2','PRG1','S2',4,'The support group was helpful,
but I wish it was held more frequently')
INTO Feedback values('F3','PRG2','S3',3,'The lecture was good, but I wish
there were more practical exercises')
INTO Feedback values('FB4','PRG2','S4',4,'The yoga session was relaxing,
but it was too crowded')
INTO Feedback values('FB5','PRG3','S5',4,'The legal clinic was very
helpful, but the wait time was long')
select * from dual;

15
3.1 SQL Queries

1) Show all the Kulliyyah, program details and the list of activities. Show ONLY the
Kulliyyah code, Kulliyyah name, program ID, program name, date of program, activity
ID, activity name, start time, end time.

SELECT Kulliyyah.kulliyyah_id, Kulliyyah.kulliyyah_name,


Program.program_id, Program.program_name, Activity.act_date,
Activity.activity_id, Activity.activity_name, Activity.start_time,
Activity.end_time FROM Kulliyyah
INNER JOIN Program ON Kulliyyah.kulliyyah_id = Program.kulliyyah_id
INNER JOIN Activity ON Program.program_id = Activity.program_id;

2) Find the number of programs and the total amount of funding granted by DSU in 2021.

SELECT Program.program_id, COUNT(Activity.activity_id) AS num_activities,


SUM(Funding.amount) AS total_funding
FROM Program
INNER JOIN Activity ON Program.program_id = Activity.program_id
INNER JOIN Funding ON Program.program_id = Funding.program_id
WHERE Activity.act_date BETWEEN '1-Jan-2021' AND '31-Dec-2021'
GROUP BY Program.program_id;

3) Find the names of all programs and the names of their respective in-charge persons

SELECT Program.program_name, Person_in_charge.pic_name


FROM Program
INNER JOIN Activity ON Program.program_id = Activity.program_id
INNER JOIN Person_in_charge ON Activity.pic_id =
Person_in_charge.pic_id;

16
4) For each Kulliyyah that had completed their program from 2019 to 2023, find the total
evaluation sum of scores in descending order.

SELECT Kulliyyah.kulliyyah_name, SUM(Feedback.score) AS total_score


FROM Kulliyyah
INNER JOIN Program ON Kulliyyah.kulliyyah_id = Program.kulliyyah_id
INNER JOIN Activity ON Program.program_id = Activity.program_id
INNER JOIN Feedback ON Program.program_id = Feedback.program_id
WHERE Activity.status = 'Completed' AND Activity.act_date BETWEEN
'1-Jan-2019' AND '31-Dec-2023'
GROUP BY Kulliyyah.kulliyyah_name
ORDER BY total_score DESC;

5) Determine the average score for each activity in each program.

SELECT Program.program_name, Activity.activity_name, AVG(Feedback.score)


AS avg_score FROM Program
INNER JOIN Activity ON Program.program_id = Activity.program_id
INNER JOIN Feedback ON Program.program_id = Feedback.program_id
GROUP BY Program.program_name, Activity.activity_name;

17

You might also like