0% found this document useful (0 votes)
25 views

Example Report 1 - Database Project

This document describes a school management system database with entities like departments, courses, staff, teachers, students and classrooms along with their attributes and relationships. The database tracks information like grades, attendance, emergency contacts and tracks the status of teachers and students in relation to classrooms.

Uploaded by

Sayam Abbasi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Example Report 1 - Database Project

This document describes a school management system database with entities like departments, courses, staff, teachers, students and classrooms along with their attributes and relationships. The database tracks information like grades, attendance, emergency contacts and tracks the status of teachers and students in relation to classrooms.

Uploaded by

Sayam Abbasi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

School Management

System
BIRMINGHAM CITY UNIVERSITYFACULTY OF COMPUTING ENGINEERING
AND THE BUILT ENVIRONMENT | Birmingham City University

Advanced Databases | Word Count: 1974

1|Page
Table of Contents
1. Domain Description: ................................................................................................................... 4
2. Database Analysis: ..................................................................................................................... 4
2.1. Business Situation:.............................................................................................................. 4
2.2. Business Rules: ................................................................................................................... 4
2.3. List of Entity/Attributes: ....................................................................................................... 5
2.4. Simple Relationships: ......................................................................................................... 5
2.5. Connectivities, Cardinalities and Participation: ............................................................... 5
2.6. ERD Mapping: ..................................................................................................................... 7
2.6.1. Mapping 1: 1 Relationships: ...................................................................................... 7
2.6.2. Mapping 1: M Relationships: ..................................................................................... 8
2.6.3. Mapping N: M Relationships: ................................................................................... 12
3. Database Design: ...................................................................................................................... 17
4. Database Normalisation: .......................................................................................................... 18
4.1. Department: ....................................................................................................................... 18
4.2. Courses: ............................................................................................................................. 18
4.3. Staff: .................................................................................................................................... 18
4.4. Teachers:............................................................................................................................ 18
4.5. Accountants: ...................................................................................................................... 19
4.6. Headmaster:....................................................................................................................... 19
4.7. Students: ............................................................................................................................ 20
4.8. Classrooms: ....................................................................................................................... 20
4.9. Composite entities:............................................................................................................ 20
5. Database Implementation: ....................................................................................................... 20
5.1. Accountant: ........................................................................................................................ 20
5.1.1. Assigned_Accountant: .............................................................................................. 21
5.2. HEADMASTER:................................................................................................................. 21
5.2.1. ASSIGNED_HEADMASTER: .................................................................................. 21
5.3. STAFF:................................................................................................................................ 22
5.3.1. ASSIGNED_STAFF: ................................................................................................. 22
5.4. TEACHER: ......................................................................................................................... 22
5.4.1. ASSIGNED_TEACHER:........................................................................................... 23
5.5. TECHNICIAN ..................................................................................................................... 23
5.5.1. ASSIGNED_TECHNICIAN: ..................................................................................... 24
5.6. ATTENDS:.......................................................................................................................... 24
5.7. CLASSROOM: ................................................................................................................... 24

2|Page
5.8. COURSES:......................................................................................................................... 24
5.9. COVERSIN: ....................................................................................................................... 25
5.10. DEPARTMENT: ............................................................................................................. 25
5.11. GRADES: ....................................................................................................................... 25
5.12. STUDENT: ..................................................................................................................... 26
5.13. TAKESPLACE ............................................................................................................... 26
6. Data Insertion: ....................................................................................................................... 27
7. SQL Queries: ............................................................................................................................. 42
8. Conclusions: .............................................................................................................................. 47
9. References: ................................................................................................................................ 47

3|Page
1. Domain Description:
The section following will provide a description of the school management system. Its goal is
to provide comprehensive understandings of how the school works, its entities and a plan of
attack of how the database will be created based of, of the plan.

2. Database Analysis:
There is a school that manages the lives of staff and academic students, which school is big
and has a database which manages the school day to day operations. In this school there are
different departments (DeptID, Name, Location, budget) provide courses (CID, Course Name,
Credit) each of these departments must have Staff (SID, Fname, Lname, Salary, Role, DOB,
Gender, ContactName, Address, Religion, Wk_Hrs) such as Teachers (PGCE, QTS)
Accountants (AAT, ACA), and the Technician (BSc (Hons), CCNA) and to teach the subjects
to the students (StudID, Fname, Lname, DOB, subject name, Gender, Religion, Support,
Address) whom may be taught by one teacher, which takes place in a classroom (CrID,
Location, Number, capacity) and at least one these teachers must be the head of the
department to report the progression to the headmaster and the technician works in the
department. Each student is required to attend all the subjects, but there are some optional
subjects, which students are not required to attend. The database must also track the Grades,
Emergency Numbers, Attendance, Contact Details, Status (on tract or not) of the students, as
well as the Location of the course and classrooms and the status, of the teachers and students
in relation to the classroom.

2.1. Business Situation:


There is a school that manages the lives of staff and academic students, which school is big
and has a database which manages the school day to day operations. In this school there are
different departments (DeptID, Name, Location, budget) provide courses (CID, Course
Name, Credit) each of these departments must have Staff (SID, Fname, Lname, Salary,
Role, DOB, Gender, ContactName, Address, Religion, Wk_Hrs) such as Teachers
(PGCE, QTS) Accountants (AAT, ACA), and the Technician (BSc (Hons), CCNA) and to
teach the subjects to the students (StudID, Fname, Lname, DOB, subject name, Gender,
Religion, Support, Address) whom may be taught by one teacher, which takes place in a
classroom (CrID, Location, Number, capacity) and at least one these teachers must be the
head of the department to report the progression to the headmaster and the technician works
in the department. Each student is required to attend all the subjects, but there are some
optional subjects, which students are not required to attend. The database must also track the
Grades, Emergency Numbers, Attendance, Contact Details, Status (on tract or not) of
the students, as well as the Location of the course and classrooms and the status, of the
teachers and students in relation to the classroom.

2.2. Business Rules:


• Department employees many Staff, but each Staff is employed by a single department.
• Department contains many courses, each course is in a single department.
• The teachers that are the head of the departments must report to the headmaster.
• The technicians maintain the operations of the department.
• A teacher teaches many courses and courses can be taught by many teachers.
• A course can be in many classrooms and each classroom can have many courses.
• A teacher can teach many students but students can be taught by one teacher.

4|Page
• Each student has many courses to attend and each course has many students
attending.
• There are some students whom are not required to attend some of the subjects.
• The database must also track the Grades, Emergency Numbers, Attendance,
Contact Details, Status (on tract or not) of the students, as well as the Location
of the course and classrooms and the status, of the teachers and students in
relation to the classroom.
2.3. List of Entity/Attributes:
• Entity: DEPARTMENT:
o Attributes: DeptID, Name, Location, and budget.
• Entity: Courses:
o Attributes: CID, Name, DeptID, Location
• Entity: SAFF:
o Attributes: SID, Fname, Lname, Salary, Title, and DOB
• Entity: TEACHERS:
o Attributes: SID, Fname, Lname, Salary, Title, and DOB
• Entity: ACCOUNTANT:
o Attributes: SID, Fname, Lname, Salary, Title, and DOB
• Entity: HEADMASTER:
o Attributes: SID, Fname, Lname, Salary, Title, and DOB
• Entity: STUDENT:
o StudID, Fname, Lname, DOB, subject name
• Entity: CLASSROOM:
o Attributes: CrID, Location, Number

o Attributes: Grades, Emergency Numbers, Attendance, Contact Details, Status


(on tract or not), Location, Status.

2.4. Simple Relationships:


[DEPARTMENT] 1 <employees> M [STAFF]
[DEPARTMENT] 1 <contains> M [COURSES]
[TEACHER] 1 <manages> 1 [DEPARTMENT]
[TECHNICIAN] M <reports> 1 [DEPARTMENT]
[TEACHER] M <teach> M [COURSES]
[CLASSROOMS] M < contains> M [COURSES]
[TEACHER] 1 <teaches> M [STUDENTS]
[STUDENTS] M <addend> M [COURSES]

2.5. Connectivities, Cardinalities and Participation:


A DEPARTMENT employs a minimum of __1__ STAFF
A DEPARTMENT employs a maximum of __M__ STAFFs
Reverse:
A STAFF is employed by a minimum of __1__ DEPARTMENT

5|Page
A STAFF is employed by a maximum of __1__ DEPARTMENT

A TEACHER will manage a minimum of __1__ DEPARTMENT


A TEACHER will manage a maximum of __1__ DEPARTMENT
Reverse:
A DEPARTMENT will be managed by a minimum of __1__ TEACHER
A DEPARTMENT will be managed by a maximum of __1__ TEACHER

A DEPARTMENT will report to a minimum of __1__ HEADMASTER


A DEPARTMENT will report to a maximum of __1__ HEADMASTER
Reverse:
A HEADMASTER will be reported by a minimum of __1__ DEPARTMENT
A HEADMASTER will be reported by a maximum of __M__ DEPARTMENTs

An ACCOUNTANT will report to a minimum of __1__ HEADMASTER


An ACCOUNTANT will report to a maximum of __1__ HEADMASTERs
Reverse:
A HEADMASTER will be reported by a minimum of __1__ ACCOUNTANT
A HEADMASTER will be reported by a maximum of __M__ ACCOUNTANTs

A TECHNICIAN will report to a minimum of __1__ DEPARTMENT


A TECHNICIAN will report to a maximum of __1__ DEPARTMENT
Reverse:
A DEPARTMENT will be reported by a minimum of __1__ TECHNICIAN
A DEPARTMENT will be reported by a maximum of __M__ TECHNICIAN

A TEACHER will teach a minimum of __1__ STUDENTS


A TEACHER will teach a maximum of __M__ STUDENTS
Reverse:
A STUDENTS will be taught by a minimum of __1__ TEACHER
A STUDENTS will be taught by a maximum of __1__ TEACHER

A STUDENTS will attend a minimum of __1__ COURSE


A STUDENTS will attend a maximum of __M__ COURSE
Reverse:
A COURSE will be attended by a minimum of __1__ STUDENTS
A COURSE will be attended by a maximum of __M__ STUDENTS

A TEACHER will provide a minimum of __1__ COURSE

6|Page
A TEACHER will provide a maximum of __M__ COURSE
Reverse:
A COURSE will be provided by a minimum of __1__ TEACHER
A COURSE will be provided by a maximum of __M__ TEACHER

A CLASSROOM will hold a minimum of __1__ COURSE


A CLASSROOM will hold a maximum of __M__ COURSE
Reverse:
A COURSE will be held in a minimum of __1__ CLASSROOM
A COURSE will be held in a maximum of __M__ CLASSROOM

A DEPARTMENT will hold a minimum of __1__ COURSE


A DEPARTMENT will hold a maximum of __M__ COURSE
Reverse:
A COURSE will be held in a minimum of __1__ DEPARTMENT
A COURSE will be held in a maximum of __1__ DEPARTMENT

2.6. ERD Mapping:

2.6.1. Mapping 1: 1 Relationships:

DEPARTMENT 1
Managed
1
TEACHERS

Department
DepID SID Name Location Budget
(£)
1 5 Maths North 142365
2 2 Science South 154326
3 3 English East 193524

Teachers

SID Fname Lname Role PGCS QTS ContactNum Gender WK_Hrs Religion DOB Salary
(£)
1 Mike Tom Maths Yes Yes 01234567891 Male 30 Muslim 12/05/85 35000
teacher

7|Page
2 Harry Dave Science Yes Yes 12345678912 Male 40 Jewish 22/09/70 40000
teacher
3 Larry High English Yes Yes 23456789123 Male 40 Jewish 06/12/90 31425
teacher
4 Dike Hike Science Yes Yes 34567891234 Male 30 Christian 31/03/81 51431
teacher
5 Sam Bob Maths Yes Yes 45678912345 Female 40 Sikh 15/01/79 25431
teacher

2.6.2. Mapping 1: M Relationships:

DEPARTMENT 1 Contains M COURSES

Department Courses

DepID Name Location Budget CID DeptID Name Credit


(£) 1 2 Chemistry 30
1 Maths North 142365 2 3 Writing 30
2 Science South 154326 3 2 Biology 30
3 English East 193524 4 1 Advance 30
Maths
5 3 Literature 30
6 1 Maths 30
7 1 Ratio and 30
Proportion

DEPARTMENT 1 Employees M STAFF

Department

DepID Name Location Budget


(£)
1 Maths North 142365 STAFF
2 Science South 154326
3 English East 193524

8|Page
SID DepID Fname Lname Role ContanctNum Gender WK_HRs Religion DOB Salary
(£)
1 1 Mike Tom Maths 01234567890 Male 30 Muslim 12/05/85 35000
teacher
2 2 Harry Dave Science 12345678901 Male 40 Jewish 22/09/70 40000
teacher
3 3 Larry High English 23456789012 Male 40 Jewish 06/12/90 31425
teacher
4 2 Dike Hike Science 34567890123 Male 30 Christian 31/03/81 51431
teacher
5 1 Sam Bob Maths 45678901234 Female 40 Sikh 15/01/79 25431
teacher
6 2 Tyler Smith Chef 56789012345 Female 30 Hindu 26/02/68 13000
7 1 Rose Hai Cleaner 67890123456 Female 30 Hindu 14/02/75 13500
8 3 Patrick Lake Guard 78901234567 Male 30 Muslim 24/07/88 17000
9 1 Acer Len Chef 89012345678 Female 30 Muslim 31/03/86 13000
10 3 Gerry White Guard 90123456789 Male 30 Christian 12/03/88 17000
11 1 Jack Mann Guard 98765432109 Male 30 Jewish 19/01/91 16500
12 2 Barry Edge Guard 87654321098 Male 30 Jewish 29/08/82 18000
13 3 Harper Blade Cleaner 76543210987 Female 30 Christian 16/06/73 13500
14 1 Cain Wright Headmaster 65432109876 Male 40 Muslim 17/10/80 156051
15 3 Lauren Ralph Technician 54321098765 Female 30 Sikh 09/11/84 60000
16 1 Sean Mendez Technician 43210987654 Male 30 Sikh 14/02/89 58000
17 1 Haley Mark Accountant 48632285214 Female 30 Buddhist 14/02/89 60000
18 1 Dave Rock Accountant 97346182453 Male 30 Buddhist 14/02/89 59000

TEACHERS1 Teaches M STUDENTS

Teacher

SID Fname Lname Role PGCS QTS ContactNum Gender WK_Hrs Religion DOB Salary
(£)
1 Mike Tom Maths Yes Yes 01234567891 Male 30 Muslim 12/05/85 35000
teacher
2 Harry Dave Science Yes Yes 12345678912 Male 40 Jewish 22/09/70 40000
teacher
3 Larry High English Yes Yes 23456789123 Male 40 Jewish 06/12/90 31425
teacher
4 Dike Hike Science Yes Yes 34567891234 Male 30 Christian 31/03/81 51431
teacher
5 Sam Bob Maths Yes Yes 45678912345 Female 40 Sikh 15/01/79 25431
teacher

9|Page
Student

StudID SID Fname Lname Subject ContactNum Gender Religion Support DOB
Name
1 2 Mike Tom Chemistry 09358764893 Male Muslim Yes 12/05/97
2 5 Harry Dave Advance 76851934036 Male Sikh No 22/09/98
Maths
3 4 Larry High Biology 07938431286 Male Muslim Yes 06/12/97
4 1 Dike Hike Maths 16735498230 Male Sikh No 31/03/97
5 3 Sam Bob Writing 09873657814 Female Muslim Yes 15/01/98
6 1 Daile Mike Ratio and 84769531025 Male Sikh No 26/02/98
Proportion
7 3 Rob Parkins Writing 04576314926 Male Christian Yes 14/02/97
8 3 Freddie Kroger Literature 65184135489 Male Hindu No 24/07/98
9 4 Sam Ham Chemistry 65741656541 Female Christian Yes 31/03/97
10 2 Lake Wake Chemistry 61324152665 Female Hindu No 12/03/98

DEPARTMENT 1 Reported
M
TECHNICIAN

Department

DepID Name Location Budget


(£)
1 Maths North 142365
2 Science South 154326
3 English East 193524

10 | P a g e
Technician

SI De Fna Lna Role BSc CC Contact Gen WK_ Relig DOB Sal
D pID me me (Ho NA Num der Hrs ion ary
ns) (£)

1 1 Mik Tom Math Yes Yes 012345 Fem 30 Sikh 09/1 600
5 e s 67891 ale 1/84 00
teac
her

1 2 Harr Dav Scie Yes Yes 123456 Fem 30 Sikh 14/0 580
6 y e nce 78912 ale 2/89 00
teac
her

HEADMASTER 1 Reported
M
DEPARTMENT

Headmaster
SID Fname Lname Role ContactNum Gender WK_Hrs Religion DOB Salary
(£)
14 Cain Wright Headmaster 65432109876 Male 40 Muslim 17/10/80 156051

DEPARTMENT

DepID SID Name Location Budget (£)


1 14 Maths North 142365
2 14 Science South 154326
3 14 English East 193524

HEADMASTER 1 Reported
M
Accountant

11 | P a g e
Headmaster
SID Fname Lname Role ContactNum Gender WK_Hrs Religion DOB Salary
(£)
14 Cain Wright Headmaster 65432109876 Male 40 Muslim 17/10/80 156051

ACCOUNTANT

SID SID Fname Lname Role AAT ACA ContactNum Gender WK_Hrs Religion DOB Sal
ary
(£)

17 14 Haley Mark Accoun Yes Yes 48632285214 Female 30 Buddhist 14/02/89 600
tant 00

18 14 Dave Rock Accoun Yes Yes 97346182453 Male 30 Buddhist 14/02/89 590
tant 00

2.6.3. Mapping N: M Relationships:

STUDENT
M M
Takes COURSES

1 M M
STUDENT Grades 1 COURSES

Student

StudID Fname Lname Subject ContactNum Gender Religion Support DOB


Name
1 Mike Tom Chemistry 09358764893 Male Muslim Yes 12/05/97
2 Harry Dave Advance 76851934036 Male Sikh No 22/09/98
Maths
3 Larry High Biology 07938431286 Male Muslim Yes 06/12/97
4 Dike Hike Maths 16735498230 Male Sikh No 31/03/97

12 | P a g e
5 Sam Bob Writing 09873657814 Female Muslim Yes 15/01/98
6 Daile Mike Ratio and 84769531025 Male Sikh No 26/02/98
Proportion
7 Rob Parkins Writing 04576314926 Male Christian Yes 14/02/97
8 Freddie Kroger Literature 65184135489 Male Hindu No 24/07/98
9 Sam Ham Chemistry 65741656541 Female Christian Yes 31/03/97
10 Lake Wake Chemistry 61324152665 Female Hindu No 12/03/98

Courses

CID Name Location


1 Chemistry South
2 Writing East
3 Biology South
4 Advance North
Maths
5 Literature East
6 Maths North
7 Ratio and North
Proportion
Grades

StudID CID Grades EmergNum Attendance Contact Status


1 1 B 28167348138 Present 09358764893 On Track
2 4 A 10468359720 Present 76851934036 On Track
3 3 B 16734981240 Present 07938431286 On Track
4 6 B 34679581230 Present 16735498230 On Track
5 2 C 38946713203 Late 09873657814 Intervention
6 7 A 37648519370 Present 84769531025 On Track
7 2 A 01231672464 Present 04576314926 On Track
8 5 C 65126165656 Late 65184135489 Intervention
9 1 C 25620191998 Late 65741656541 Intervention
10 1 A 50855085055 Present 61324152665 On Track

COURSES
M M
TakesPlace CLASSROOMS

1
COURSES M
TakesPlace M1
CLASSROOMS

13 | P a g e
Classrooms Courses

CrID Name Location CID Name Location


1 CL1 South 1 Chemistry South
2 Writing East
2 CL2 North 3 Biology South
3 CL3 South 4 Advance North
4 CL4 North Maths
5 Literature East
5 CL5 East 6 Maths North
6 CL6 North 7 Ratio and North
7 CL7 East Proportion

8 CL8 North TakesPlace


9 CL9 South
10 CL10 North CrID CID Location
1 1 South
2 4 North
3 3 South
4 6 North
5 2 East
6 7 North
7 2 East
8 6 North
9 1 South
10 7 North

STUDENT
M M
Addends CLASSROOMS

1 M M 1
STUDENT Addends CLASSROOMS

Student

StudID Fname Lname Subject ContactNum Gender Religion Support DOB


Name
1 Mike Tom Chemistry 09358764893 Male Muslim Yes 12/05/97
2 Harry Dave Advance 76851934036 Male Sikh No 22/09/98
Maths
3 Larry High Biology 07938431286 Male Muslim Yes 06/12/97

14 | P a g e
4 Dike Hike Maths 16735498230 Male Sikh No 31/03/97
5 Sam Bob Writing 09873657814 Female Muslim Yes 15/01/98
6 Daile Mike Ratio and 84769531025 Male Sikh No 26/02/98
Proportion
7 Rob Parkins Writing 04576314926 Male Christian Yes 14/02/97
8 Freddie Kroger Literature 65184135489 Male Hindu No 24/07/98
9 Sam Ham Chemistry 65741656541 Female Christian Yes 31/03/97
10 Lake Wake Chemistry 61324152665 Female Hindu No 12/03/98

Classroom

CrID Name Location


1 CL1 South
2 CL2 North
3 CL3 South
4 CL4 North
5 CL5 East
6 CL6 North
7 CL7 East
8 CL8 North
9 CL9 South
10 CL10 North

Attends

StudID CrID Status


1 1 Available
2 4 Available
3 3 Available
4 6 Available
5 2 Available
6 7 Available
7 2 Available
8 5 Available
9 4 Available
10 1 Available

15 | P a g e
TEACHER
M M
Covers CLASSROOMS

1 M M1
TEACHER CoversIn CLASSROOMS

Teacher Classroom
SID Fname Lname Title DOB Salary
CrID Name Location
(£)
1 Mike Tom Maths 12/05/85 35000 1 CL1 South
teacher 2 CL2 North
2 Harry Dave Science 22/09/70 40000
teacher 3 CL3 South
3 Larry High English 06/12/90 31425 4 CL4 North
teacher
5 CL5 East
4 Dike Hike Science 31/03/81 51431
teacher 6 CL6 North
5 Sam Bob Maths 15/01/79 25431 7 CL7 East
teacher
8 CL8 North
9 CL9 South
10 CL10 North

CoversIn
SID CrID Status
1 1 Available
2 4 Available
3 3 Available
4 6 Available
5 2 Available
4 7 Available
3 2 Available
1 5 Available
2 4 Available
5 1 Available

16 | P a g e
3. Database Design:

17 | P a g e
4. Database Normalisation:
As for normalisation the maximum requirement for tables is to be in 3rd normal form (NF). This
is primarily due to if the team normalise the tables into 4th NF then we’ll have too many tables.
So for this project we were advised to break tables down to 3rd NF. Additionally, each sub-
heading will have a justification of way the tables are in the 3rd NF.

4.1. Department:
DepID SID Name Location Budget

This table is already in 3rd NF, this is because there is no repeating groups, which can be
viewed in ERD Mapping. As well has having the primary key (PK) identified and all non-key
attributes are fully functionally dependant on the PK. Furthermore, there are no partial or
transitive dependencies.

4.2. Courses:
CID DepID Name Credit
This table is already in 3rd NF, this is because there is no repeating groups, which can be
viewed in ERD Mapping. As well has having the primary key (PK) identified and all non-key
attributes are fully dependant on the PK. Furthermore, there are no partial or transitive
dependencies.

4.3. Staff:
This table is already in 2nd NF, this is because there is no repeating groups, which can be
viewed in ERD Mapping. As well has having the primary key (PK) identified and all non-key
attributes are fully dependant on the PK. Furthermore, there are no partial but there is a
transitive dependency. With Role and WK_Hrs. This is because if you know the job role then
you know their working hours without the PK.

SID DepID Fname Lname Role ContactNum Gender WK_Hrs Religion DOB Sa
(£)

To mitigate this Role and WK_Hrs will be taken out.


This is the new Staff table.

SID DepID Fname Lname ContactNum Gender Religion DOB Salary


(£)

Now SID and Role will be PK with SID being foreign key (FK).
This is assignment table.
SID Role WK_Hrs

4.4. Teachers:
This table is as same as the table above. It is transitive because of Role and WK_Hrs. This is
because if you know the job role then you know their working hours without the PK.

18 | P a g e
SID Fname Lname Role PGCS QTS ContactNum Gender WK_Hrs Religion DOB Salary
(£)
To mitigate this Role and WK_Hrs will be taken out.
This is the new Teacher table.
SID Fname Lname PGCS QTS ContactNum Gender Religion DOB Salary
(£)
Now SID and Role will be PK with SID being foreign key (FK).
This is the new Assigned_Teacher Table.
SID Role WK_Hrs

4.5. Accountants:
This table is as same as the table above. It is transitive because of Role and WK_Hrs. This is
because if you know the job role then you know their working hours without the PK.

SID Fname Lname Role AAT ACA ContactNum Gender WK_Hrs Religion DOB Salary
(£)
To mitigate this Role and WK_Hrs will be taken out.
This is the new Accountant table.

SID Fname Lname AAT ACA ContactNum Gender Religion DOB Salary
(£)
Now SID and Role will be PK with SID being foreign key (FK).
This is the new Assigned_ Accountant Table.
SID Role WK_Hrs

4.6. Headmaster:
This table is as same as the table above. It is transitive because of Role and WK_Hrs. This is
because if you know the job role then you know their working hours without the PK.

SID Fname Lname Role ContactNum Gender WK_Hrs Religion DOB Salary
(£)
To mitigate this Role and WK_Hrs will be taken out.
This is the new Headmaster table.

SID Fname Lname AAT ACA ContactNum Gender Religion DOB Salary
(£)
Now SID and Role will be PK with SID being foreign key (FK).
This is the new Assigned_ Headmaster Table.
SID Role WK_Hrs

19 | P a g e
4.7. Students:
This table is already in 3rd NF, this is because there is no repeating groups, which can be
viewed in ERD Mapping. As well has having the primary key (PK) identified and all non-key
attributes are fully functionally dependant on the PK. Furthermore, there are no partial or
transitive dependencies.

StudID Fname Lname Subject ContactNum Gender Religion Support DOB


Name

4.8. Classrooms:
This table is already in 3rd NF, this is because there is no repeating groups, which can be
viewed in ERD Mapping. As well has having the primary key (PK) identified and all non-key
attributes are fully functionally dependant on the PK. Furthermore, there are no partial or
transitive dependencies.

CrID Name Location

4.9. Composite entities:


Grades.

StudID CID Grades EmergNum Attendance Contact Status


Takesplace.
CrID CID Location

Attends

StudID CrID Status


CoversIn

SID CrID Status

5. Database Implementation:
The following code was copied from SQL developer, this was after the team have created their
tables. The team came to a collective decision to us the code from SQL developer.

5.1. Accountant:
(Basheer)
CREATE TABLE"ACCOUNTANT"
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"FIRSTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"LASTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"AAT" CHAR(100 BYTE),
"ACA" CHAR(100 BYTE),

20 | P a g e
"CONTACTNUM" NUMBER(*,0) NOT NULL ENABLE,
"GENDER" CHAR(10 BYTE) NOT NULL ENABLE,
"RELIGION" CHAR(10 BYTE) NOT NULL ENABLE,
"DOB" DATE NOT NULL ENABLE,
"SALARY" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "ACCOUNTANTPK" PRIMARY KEY ("SID");

5.1.1. Assigned_Accountant:
(Basheer)
CREATE TABLE ASSIGNED_ACCOUNTANT
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"ROLE" CHAR(25 BYTE) NOT NULL ENABLE,
"WK_HRS" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "ASSIGNED_ACCOUNTANT_PK" PRIMARY KEY ("SID", "ROLE")
CONSTRAINT "ASSIGNED_ACCOUNTANT_FK" FOREIGN KEY ("SID")
REFERENCES ."ACCOUNTANT" ("SID") ON DELETE CASCADE
);

5.2. HEADMASTER:
(Basheer)
CREATE TABLE HEADMASTER
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"FIRSTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"LASTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"CONTACTNUM" NUMBER(*,0) NOT NULL ENABLE,
"GENDER" CHAR(10 BYTE) NOT NULL ENABLE,
"RELIGION" CHAR(10 BYTE) NOT NULL ENABLE,
"DOB" DATE NOT NULL ENABLE,
"SALARY" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "HEADMASTERPK" PRIMARY KEY ("SID");

5.2.1. ASSIGNED_HEADMASTER:
(Basheer)
CREATE TABLE " ASSIGNED_HEADMASTER"
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"ROLE" CHAR(25 BYTE) NOT NULL ENABLE,

21 | P a g e
"WK_HRS" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "ASSIGNED_HEADMASTER_PK" PRIMARY KEY ("SID", "ROLE")
CONSTRAINT "ASSIGNED_HEADMASTER_FK" FOREIGN KEY ("SID")
REFERENCES "HEADMASTER" ("SID") ON DELETE CASCADE);

5.3. STAFF:
(Shakar)
CREATE TABLE STAFF"
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"DEPID" NUMBER(*,0) NOT NULL ENABLE,
"FIRSTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"LASTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"CONTACTNUM" NUMBER(*,0) NOT NULL ENABLE,
"GENDER" CHAR(10 BYTE) NOT NULL ENABLE,
"RELIGION" CHAR(10 BYTE) NOT NULL ENABLE,
"DOB" DATE NOT NULL ENABLE,
"SALARY" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "STAFFPK" PRIMARY KEY ("SID")
CONSTRAINT "STAFFFK" FOREIGN KEY ("DEPID")
REFERENCES "DEPARTMENT" ("DEPID") ENABLE
)

5.3.1. ASSIGNED_STAFF:
(Shakar)
CREATE TABLE "ASSIGNED_STAFF"
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"ROLE" CHAR(25 BYTE) NOT NULL ENABLE,
"WK_HRS" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "ASSIGNED_STAFF_PK" PRIMARY KEY ("SID", "ROLE")
CONSTRAINT "ASSIGNED_STAFF_FK" FOREIGN KEY ("SID")
REFERENCES "STAFF" ("SID") ON DELETE CASCADE
);

5.4. TEACHER:
(Shakar)
CREATE TABLE " TEACHER"

22 | P a g e
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"FIRSTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"LASTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"PGCE" CHAR(100 BYTE),
"QTS" CHAR(100 BYTE),
"CONTACTNUM" NUMBER(*,0) NOT NULL ENABLE,
"GENDER" CHAR(10 BYTE) NOT NULL ENABLE,
"RELIGION" CHAR(10 BYTE) NOT NULL ENABLE,
"DOB" DATE NOT NULL ENABLE,
"SALARY" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "TEACHERPK" PRIMARY KEY ("SID");

5.4.1. ASSIGNED_TEACHER:
(Shakar)
CREATE TABLE "ASSIGNED_TEACHER"
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"ROLE" CHAR(25 BYTE) NOT NULL ENABLE,
"WK_HRS" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "ASSIGNED_TEACHER_PK" PRIMARY KEY ("SID", "ROLE")
CONSTRAINT "ASSIGNED_TEACHER_FK" FOREIGN KEY ("SID")
REFERENCES "TEACHER" ("SID") ON DELETE CASCADE ENABLE
);

5.5. TECHNICIAN
(Basheer)
CREATE TABLE "TECHNICIAN"
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"FIRSTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"LASTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"BSC" CHAR(100 BYTE),
"CCNA" CHAR(100 BYTE),
"CONTACTNUM" NUMBER(*,0) NOT NULL ENABLE,
"GENDER" CHAR(10 BYTE) NOT NULL ENABLE,
"RELIGION" CHAR(10 BYTE) NOT NULL ENABLE,
"DOB" DATE NOT NULL ENABLE,

23 | P a g e
"SALARY" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "TECHNICIANPK" PRIMARY KEY ("SID")

5.5.1. ASSIGNED_TECHNICIAN:
(Basheer)
CREATE TABLE "ASSIGNED_TECHNICIAN"
( "SID" NUMBER(*,0) NOT NULL ENABLE,
"ROLE" CHAR(25 BYTE) NOT NULL ENABLE,
"WK_HRS" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "ASSIGNED_TECHNICIAN_PK" PRIMARY KEY ("SID", "ROLE")
CONSTRAINT "ASSIGNED_TECHNICIANFK" FOREIGN KEY ("SID")
REFERENCES "TECHNICIAN" ("SID") ON DELETE CASCADE ENABLE
);

5.6. ATTENDS:
(Syed)
CREATE TABLE "ATTENDS"
( "CRID" NUMBER(*,0) NOT NULL ENABLE,
"STUDID" NUMBER(*,0) NOT NULL ENABLE,
"STATUS" CHAR(100 BYTE) NOT NULL ENABLE,
CONSTRAINT "ATTENDSPK" PRIMARY KEY ("STUDID", "CRID")
CONSTRAINT "ATTENDSFK" FOREIGN KEY ("CRID")
REFERENCES "CLASSROOM" ("CRID") ENABLE,
CONSTRAINT "ATTENDS_FK" FOREIGN KEY ("STUDID")
REFERENCES "STUDENT" ("STUDID") ENABLE
);

5.7. CLASSROOM:
(Syed)
CREATE TABLE "CLASSROOM"
( "CRID" NUMBER(*,0) NOT NULL ENABLE,
"NAME" CHAR(25 BYTE) NOT NULL ENABLE,
"LOCATION" CHAR(50 BYTE) NOT NULL ENABLE,
CONSTRAINT "CLASSROOM" PRIMARY KEY ("CRID");

5.8. COURSES:
(Shakar)

24 | P a g e
CREATE TABLE "COURSES"
( "CID" NUMBER(*,0) NOT NULL ENABLE,
"DEPID" NUMBER(*,0) NOT NULL ENABLE,
"NAME" CHAR(25 BYTE) NOT NULL ENABLE,
"CREDIT" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "CIDPK" PRIMARY KEY ("CID")
CONSTRAINT "COURSESFK" FOREIGN KEY ("DEPID")
REFERENCES "DEPARTMENT" ("DEPID") ENABLE
);

5.9. COVERSIN:
(Syed)
CREATE TABLE "COVERSIN"
( "CRID" NUMBER(*,0) NOT NULL ENABLE,
"SID" NUMBER(*,0) NOT NULL ENABLE,
"STATUS" CHAR(100 BYTE) NOT NULL ENABLE,
CONSTRAINT "COVERSINPK" PRIMARY KEY ("SID", "CRID")
CONSTRAINT "COVERSINFK" FOREIGN KEY ("CRID")
REFERENCES "CLASSROOM" ("CRID") ENABLE,
CONSTRAINT "COVERSIN_FK" FOREIGN KEY ("SID")
REFERENCES "TEACHER" ("SID") ENABLE
);

5.10. DEPARTMENT:
(Shakar)
CREATE TABLE "DEPARTMENT"
( "DEPID" NUMBER(*,0) NOT NULL ENABLE,
"SID" NUMBER(*,0) NOT NULL ENABLE,
"NAME" CHAR(25 BYTE) NOT NULL ENABLE,
"LOCATION" CHAR(25 BYTE) NOT NULL ENABLE,
"BUDGET" NUMBER(*,0) NOT NULL ENABLE,
CONSTRAINT "DEPIDPK" PRIMARY KEY ("DEPID")

5.11. GRADES:
(Syed)
CREATE TABLE "GRADES"

25 | P a g e
( "STUDID" NUMBER(*,0) NOT NULL ENABLE,
"CID" NUMBER(*,0) NOT NULL ENABLE,
"GRADES" CHAR(25 BYTE) NOT NULL ENABLE,
"EMERGNUM" CHAR(100 BYTE),
"ATTENDANCE" CHAR(100 BYTE),
"CONTACT" NUMBER(*,0) NOT NULL ENABLE,
"STATUS" CHAR(100 BYTE) NOT NULL ENABLE,
CONSTRAINT "GRADESPK" PRIMARY KEY ("STUDID", "CID")
CONSTRAINT "GRADESFK" FOREIGN KEY ("STUDID")
REFERENCES "STUDENT" ("STUDID") ENABLE,
CONSTRAINT "GRADES_FK" FOREIGN KEY ("CID")
REFERENCES "COURSES" ("CID") ENABLE
);

5.12. STUDENT:
(Basheer)
CREATE TABLE “STUDENT"
( "STUDID" NUMBER(*,0) NOT NULL ENABLE,
"SID" NUMBER(*,0) NOT NULL ENABLE,
"FIRSTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"LASTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"SUBJECTNAME" CHAR(25 BYTE) NOT NULL ENABLE,
"CONTACTNUM" NUMBER(*,0) NOT NULL ENABLE,
"GENDER" CHAR(10 BYTE) NOT NULL ENABLE,
"RELIGION" CHAR(10 BYTE) NOT NULL ENABLE,
"SUPPORT" CHAR(100 BYTE),
"DOB" DATE NOT NULL ENABLE,
CONSTRAINT "STUDIDPK" PRIMARY KEY ("STUDID")
CONSTRAINT "STUDIDFK" FOREIGN KEY ("SID")
REFERENCES "TEACHER" ("SID") ENABLE
);

5.13. TAKESPLACE
(Syed)
CREATE TABLE "TAKESPLACE"

26 | P a g e
( "CRID" NUMBER(*,0) NOT NULL ENABLE,
"CID" NUMBER(*,0) NOT NULL ENABLE,
"LOCATION" CHAR(25 BYTE) NOT NULL ENABLE,
CONSTRAINT "TAKESPLACEPK" PRIMARY KEY ("CID", "CRID")
CONSTRAINT "TAKESPLACEFK" FOREIGN KEY ("CRID")
REFERENCES "CLASSROOM" ("CRID") ENABLE,
CONSTRAINT "TAKESPLACE_FK" FOREIGN KEY ("CID")
REFERENCES "COURSES" ("CID") ENABLE
)

6. Data Insertion:

This is the end result of our tables being created, as well as this we have also populated the
tables too using the insert command.

27 | P a g e
/* Shakar */
INSERT INTO Courses VALUES (
1, 2,'Chemistry', 30);
INSERT INTO Courses VALUES (
2, 3,'Writing', 30);
INSERT INTO Courses VALUES (
3, 2,'Biology', 30);
INSERT INTO Courses VALUES (
4, 1,'Advance Maths', 30);

28 | P a g e
INSERT INTO Courses VALUES (
5, 3,'Literature', 30);
INSERT INTO Courses VALUES (
6, 1,'Maths', 30);
INSERT INTO Courses VALUES (
7, 1,'Ratio and Proportion', 30);

INSERT INTO TEACHER VALUES (


1, 'Mike', 'Tom’, ‘Yes', 'Yes', 01234567891, 'Male', 'Muslim', TO_DATE('12/05/85',
'DD/MM/YY'),
35000);
INSERT INTO TEACHER VALUES (
2, 'Harry', 'Dave’, ‘Yes', 'Yes', 12345678912, 'Male', 'Jewish', TO_DATE('22/09/70',
'DD/MM/YY'),
40000);
INSERT INTO TEACHER VALUES (
3, 'Larry', 'High’, ‘Yes', 'Yes', 23456789123, 'Male', 'Jewish', TO_DATE('06/12/90',
'DD/MM/YY'),
31425);
INSERT INTO TEACHER VALUES (
4, 'Dike', 'Hike’, ‘Yes', 'Yes', 34567891234, 'Male', 'Christian', TO_DATE('31/03/81',
'DD/MM/YY'),
51431);
INSERT INTO TEACHER VALUES (
5, 'Sam', 'Bob', 'Yes', 'Yes', 45678912345, 'Female', 'Sikh', TO_DATE('15/01/79',
'DD/MM/YY'),
25431);
INSERT INTO Assigned_Teacher VALUES (
1, 'Maths teacher', 30
);
INSERT INTO Assigned_Teacher VALUES (
2, 'Science teacher', 40
);
INSERT INTO Assigned_Teacher VALUES (

29 | P a g e
3, 'English teacher', 40
);
INSERT INTO Assigned_Teacher VALUES (
4, 'Science teacher', 30
);
INSERT INTO Assigned_Teacher VALUES (
5, 'Maths teacher', 40
);
INSERT INTO DEPARTMENT VALUES (
1, 5, 'Maths', 'North', 142365
);
INSERT INTO DEPARTMENT VALUES (
2, 2, 'Science', 'South', 154326
);
INSERT INTO DEPARTMENT VALUES (
3, 3, 'English', 'East', 193524
);
INSERT INTO STAFF VALUES (
1, 1, 'Mike', 'Tom', 01234567890, 'Male', 'Muslim', TO_DATE('12/05/85', 'DD/MM/YY'),
35000
);
INSERT INTO STAFF VALUES (
2, 2, 'Harry', 'Dave', 12345678912, 'Male', 'Jewish', TO_DATE('22/09/70',
'DD/MM/YY'),
40000
);
INSERT INTO STAFF VALUES (
3, 3, 'Larry', 'High', 23456789123, 'Male', 'Jewish', TO_DATE('06/12/90', 'DD/MM/YY'),
31425
);
INSERT INTO STAFF VALUES (
4, 2, 'Dike', 'Hike', 34567891234, 'Male', 'Christian', TO_DATE('31/03/81',
'DD/MM/YY'),

30 | P a g e
51431
);
INSERT INTO STAFF VALUES (
5, 1, 'Sam', 'Bob', 45678912345, 'Female', 'Sikh', TO_DATE('15/01/79', 'DD/MM/YY'),
25431
);
INSERT INTO STAFF VALUES (
6, 2, 'Tyler', 'Smith', 56789012345, 'Female', 'Hindu', TO_DATE('26/02/68',
'DD/MM/YY'), 13000
);
INSERT INTO STAFF VALUES (
7, 1, 'Rose', 'Hai', 67890123456, 'Female', 'Hindu', TO_DATE('14/02/75', 'DD/MM/YY'),
13500
);
INSERT INTO STAFF VALUES (
8, 3, 'Patrick', 'Lake', 78901234567, 'Male', 'Muslim', TO_DATE ('24/07/88',
'DD/MM/YY'), 17000
);
INSERT INTO STAFF VALUES (
9, 1, 'Acer', 'Len', 89012345678, 'Female', 'Muslim', TO_DATE('31/03/86',
'DD/MM/YY'), 13000
);
INSERT INTO STAFF VALUES (
10, 3, 'Gerry', 'White', 90123456789, 'Male', 'Christian', TO_DATE('12/03/88',
'DD/MM/YY'), 17000
);
INSERT INTO STAFF VALUES (
11, 1, 'Jack', 'Mann', 98765432109, 'Male', 'Jewish', TO_DATE('19/01/91',
'DD/MM/YY'), 16500
);
INSERT INTO STAFF VALUES (
12, 2, 'Barry', 'Edge', 87654321098, 'Male', 'Jewish', TO_DATE ('29/08/82',
'DD/MM/YY'), 18000
);
INSERT INTO STAFF VALUES (

31 | P a g e
13, 3, 'Harper', 'Blade', 76543210987, 'Female', 'Christian', TO_DATE('16/06/73',
'DD/MM/YY'), 13500
);
INSERT INTO STAFF VALUES (
14, 1, 'Cain', 'Wright', 65432109876, 'Male', 'Muslim', TO_DATE('17/10/80',
'DD/MM/YY'), 156051
);
INSERT INTO STAFF VALUES (
15, 3, 'Lauren', 'Ralph', 54321098765, 'Female', 'Sikh', TO_DATE('09/11/84',
'DD/MM/YY'), 60000
);
INSERT INTO STAFF VALUES (
16, 1, 'Sean', 'Mendez', 43210987654, 'Male', 'Sikh', TO_DATE('14/02/89',
'DD/MM/YY'), 58000
);
INSERT INTO STAFF VALUES (
17, 1, 'Haley', 'Mark', 48632285214, 'Female', 'Buddhist', TO_DATE('14/02/89',
'DD/MM/YY'), 60000
);
INSERT INTO STAFF VALUES (
18, 1, 'Dave', 'Rock', 97346182453, 'Male', 'Buddhist', TO_DATE('14/02/89',
'DD/MM/YY'), 59000
);

INSERT INTO Assigned_Staff VALUES (


1, 'Maths teacher', 30
);
INSERT INTO Assigned_Staff VALUES (
2, 'Science teacher', 40
);
INSERT INTO Assigned_Staff VALUES (
3, 'English teacher', 40
);
INSERT INTO Assigned_Staff VALUES (

32 | P a g e
4, 'Science teacher', 30
);
INSERT INTO Assigned_Staff VALUES (
5, 'Maths teacher', 40
);
INSERT INTO Assigned_Staff VALUES (
6, 'Chef', 30
);
INSERT INTO Assigned_Staff VALUES (
7, 'Cleaner', 30
);
INSERT INTO Assigned_Staff VALUES (
8, 'Guard', 30
);
INSERT INTO Assigned_Staff VALUES (
9, 'Chef', 30
);
INSERT INTO Assigned_Staff VALUES (
10, 'Guard', 30
);
INSERT INTO Assigned_Staff VALUES (
11, 'Guard', 30
);
INSERT INTO Assigned_Staff VALUES (
12, 'Guard', 30
);
INSERT INTO Assigned_Staff VALUES (
13, 'Cleaner', 30
);
INSERT INTO Assigned_Staff VALUES (
14, 'Headmaster', 30
);

33 | P a g e
INSERT INTO Assigned_Staff VALUES (
15, 'Technician', 30
);
INSERT INTO Assigned_Staff VALUES (
16, 'Technician', 30
);
INSERT INTO Assigned_Staff VALUES (
17, 'Accountant', 30
);
INSERT INTO Assigned_Staff VALUES (
18, 'Accountant', 30
);

/* Basheer */
INSERT INTO Headmaster VALUES (
14, 1, 'Cain', 'Wright', 65432109876, 'Male', 'Muslim', TO_DATE('17/10/80',
'DD/MM/YY'), 156051
);

INSERT INTO Assigned_Headmaster VALUES (


14, 'Headmaster', 30
);

INSERT INTO TECHNICIAN VALUES (


15, 3, 'Lauren', 'Ralph', 54321098765, 'Female', 'Sikh', TO_DATE('09/11/84',
'DD/MM/YY'), 60000
);
INSERT INTO TECHNICIAN VALUES (
16, 1, 'Sean', 'Mendez', 43210987654, 'Male', 'Sikh', TO_DATE('14/02/89',
'DD/MM/YY'), 58000
);
INSERT INTO Assigned_Teachnician VALUES (
15, 'Technician', 30

34 | P a g e
);
INSERT INTO Assigned_ Technician VALUES (
16, 'Technician', 30
);

INSERT INTO Accountant VALUES (


17, 1, 'Haley', 'Mark', 48632285214, 'Female', 'Buddhist', TO_DATE('14/02/89',
'DD/MM/YY'), 60000
);
INSERT INTO Accountant VALUES (
18, 1, 'Dave', 'Rock', 97346182453, 'Male', 'Buddhist', TO_DATE('14/02/89',
'DD/MM/YY'), 59000
);

INSERT INTO Assigned_Accountant VALUES (


17, 'Accountant', 30
);
INSERT INTO Assigned_Accountant VALUES (
18, 'Accountant', 30
);

INSERT INTO STUDENT VALUES (


1, 2, 'Mike', 'Tom', 'Chemistry',09358764893, 'Male', 'Christian', 'Yes',
TO_DATE('12/05/97','DD/MM/YY')
);

INSERT INTO STUDENT VALUES (


2, 5, 'Harry', 'Dave', 'Advance Maths',76851934036, 'Male', 'Christian', 'No',
TO_DATE('22/09/98','DD/MM/YY')
);

INSERT INTO STUDENT VALUES (


3, 4, 'Khalid', 'Abdul', 'Biology',07938431286, 'Male', 'Muslim', 'Yes',
TO_DATE('06/12/97','DD/MM/YY')

35 | P a g e
);

INSERT INTO STUDENT VALUES (


4, 1, 'Dike', 'Hike', 'Maths',16735498230, 'Male', 'Christian', 'No',
TO_DATE('31/03/97','DD/MM/YY')
);

INSERT INTO STUDENT VALUES (


5, 3, 'Marry', 'Leena', 'Writing',09873657814, 'Female', 'Christian', 'Yes',
TO_DATE('15/01/98','DD/MM/YY')
);

INSERT INTO STUDENT VALUES (


6, 1, 'Jaspreet ', 'Singh', 'Ratio and Proportion', 84769531025, 'Male', 'Sikhs', 'No',
TO_DATE('26/02/98','DD/MM/YY')
);

INSERT INTO STUDENT VALUES (


7, 3, 'Rob ', 'Parkins', 'Writing',04576314926, 'Male', 'Christian', 'Yes',
TO_DATE('14/02/97','DD/MM/YY')
);
INSERT INTO STUDENT VALUES (
8, 3, 'Freddie ', 'Kroger', 'Literature', 65184135489, 'Male', 'Christian', 'No',
TO_DATE('24/07/98','DD/MM/YY')
);
INSERT INTO STUDENT VALUES (
9, 4, 'Leanne', 'Buckman', 'Chemistry',65741656541, 'Female', 'Christian', 'Yes',
TO_DATE('31/03/97','DD/MM/YY')
);
INSERT INTO STUDENT VALUES (
10, 2, 'Tina', 'Wake', 'Chemistry',61324152665, 'Female', 'Christian', 'No',
TO_DATE('12/03/98','DD/MM/YY')
);

36 | P a g e
/* Syed */
INSERT INTO ATTENDS VALUES (
1, 1,’Available’
);
INSERT INTO ATTENDS VALUES (
2, 4,’Available’
);
INSERT INTO ATTENDS VALUES (
3, 3,’Available’
);
INSERT INTO ATTENDS VALUES (
4, 6,’Available’
);
INSERT INTO ATTENDS VALUES (
5, 2,’Available’
);
INSERT INTO ATTENDS VALUES (
6, 7,’Available’
);
INSERT INTO ATTENDS VALUES (
7, 2,’Available’
);
INSERT INTO ATTENDS VALUES (
8, 5,’Available’
);
INSERT INTO ATTENDS VALUES (
9, 4,’Available’
);
INSERT INTO ATTENDS VALUES (
10, 1,’Available’
);

37 | P a g e
INSERT INTO Classroom VALUES (
1, CL1,’South’
);
INSERT INTO Classroom VALUES (

2, CL2,’ North’

);
INSERT INTO Classroom VALUES (
3, CL3,’South’
);
INSERT INTO Classroom VALUES (

4, CL4,’ North’

);
INSERT INTO Classroom VALUES (
5, CL5,’East’
);
INSERT INTO Classroom VALUES (

6, CL6,’ North’

);
INSERT INTO Classroom VALUES (
7, CL7, ’East’
);
INSERT INTO Classroom VALUES (

8, CL8, North’

);
INSERT INTO Classroom VALUES (
9, CL9,’South’
);
INSERT INTO Classroom VALUES (

10, CL10, ‘North’

);

38 | P a g e
INSERT INTO Coversin VALUES (
1, 1,’Available’
);
INSERT INTO Coversin VALUES (
2, 4,’Available’
);
INSERT INTO Coversin VALUES (
3, 3,’Available’
);
INSERT INTO Coversin VALUES (
4, 6,’Available’
);
INSERT INTO Coversin VALUES (
5, 2,’Available’
);
INSERT INTO Coversin VALUES (
4, 7,’Available’
);
INSERT INTO Coversin VALUES (
3, 2,’Available’
);
INSERT INTO Coversin VALUES (
1, 5,’Available’
);
INSERT INTO Coversin VALUES (
2, 4,’Available’
);
INSERT INTO Coversin VALUES (
5, 1,’Available’
);

39 | P a g e
INSERT INTO Grades VALUES (
1, 1,’B’, 28167348138, ‘Present’, 09358764893, ‘On track’
);
INSERT INTO Grades VALUES (
2, 4,’A’, 10468359720, ‘Present’, 76851934036, ‘On track’
);
INSERT INTO Grades VALUES (
3, 3,’B’, 16734981240, ‘Present’, 07938431286, ‘On track’
);
INSERT INTO Grades VALUES (
4, 6,’B’, 34679581230, ‘Present’, 16735498230, ‘On track’
);
INSERT INTO Grades VALUES (
5, 2,’C’, 38946713203, ‘Late’, 09873657814, ‘Intervention’
);
INSERT INTO Grades VALUES (
6, 7,’A’, 37648519370, ‘Present’, 84769531025, ‘On track’
);
INSERT INTO Grades VALUES (
7, 2,’A’, 01231672464, ‘Present’, 04576314926, ‘On track’
);
INSERT INTO Grades VALUES (
8, 5,’C’, 65126165656, ‘Late’, 65184135489, ‘Intervention’
);
INSERT INTO Grades VALUES (
9, 1,’C’, 25620191998, ‘Late’, 65741656541, ‘Intervention’
);
INSERT INTO Grades VALUES (
10, 1,’A’, 50855085055, ‘Present’, 61324152665, ‘On track’
);

40 | P a g e
INSERT INTO TakesPlace VALUES (
1, 1,’South’
);
INSERT INTO TakesPlace VALUES (
2, 4, ‘North’

);
INSERT INTO TakesPlace VALUES (
3, 3,’South’
);
INSERT INTO TakesPlace VALUES (
4, 6, North’
);
INSERT INTO TakesPlace VALUES (
5, 2,’East’
);
INSERT INTO TakesPlace VALUES (
6, 7, ‘North’
);
INSERT INTO TakesPlace VALUES (
7, 2,’East’
);
INSERT INTO TakesPlace VALUES (
8, 6,’ North’
);
INSERT INTO TakesPlace VALUES (
9, 1,’South’
);
INSERT INTO TakesPlace VALUES (
10, 7, ‘North’
);

41 | P a g e
7. SQL Queries:
This section is dedicated to the testing of and querying of our DB.
Query optimisation:
For our project we have decided to use indexing. This is because, indexing allows for a faster
efficient way of for example searching for student or staff. An index is a copy of data from a
table, which speeds up the retrieval of rows from that table/view.
Shakar:

Creating index:

Result of the optimisation:

42 | P a g e
Inner join:

43 | P a g e
Basheer:

Indexing:

44 | P a g e
Order By:

Syed:
Index on classroom:

45 | P a g e
Order by:

46 | P a g e
8. Conclusions:
In conclusion, this project entailed, a lot of work in order to obtain a well design database. Of
the challenges the team faced, we overcame them. The main challenges being the ERD and
normalisation. This is because, before creating the DB the ERD must be done in order to have
a visual understanding of our DB. Additionally, normalisation also had to be carried out in order
to make sure that the tables where in the maximum 3rd NF. In the end. We kept-up and believe
to of delivered a well design DB.

9. References:

How to create and optimize SQL Server indexes for better performance. Solution center.
https://solutioncenter.apexsql.com/how-to-create-and-optimize-sql-server-indexes-for-better-
performance/ [24/12/19]

47 | P a g e

You might also like