You are on page 1of 97

Module Code & Module Title

CC5051NA Databases Systems


Assessment Weightage & Type
50%Individual Coursework

Year and Semester 2018-19


Autumn

Student Name: Mandip Kumar Mandal


London Met ID: 19033689
College ID: NP01CP4S200008
Assignment Due Date: 07/25/2021
Assignment Submission Date: 07/25/2021
Word Count (Where Required):

I confirm that I understand my coursework needs to be submitted online via Google Classroom under the
relevant module page before the deadline in order for my assignment to be accepted and marked. I am
fully aware that late submissions will be treated as non-submission and a marks of zero will be awarded.
Table of Contents
1. Introduction ............................................................................................................... 1
1.1 Introduction of the College ................................................................................. 1
1.2 Current Business Activities and Operations..................................................... 1
1.3 Business Rule ...................................................................................................... 2
1.4 Creation of Entities and Attributes .................................................................... 3
1.5 Initial ER Diagram ................................................................................................ 4
2. Part-1 Database Design ............................................................................................ 4
2.1 Assumptions ........................................................................................................ 4
2.2. Normalization ...................................................................................................... 5
2.1.1 Un-Normalized form ...................................................................................... 5
2.1.2 1NF ................................................................................................................. 6
2.1.3 2NF ................................................................................................................. 7
2.1.4 3NF ............................................................................................................... 10
2.3 Final ERD ........................................................................................................... 12
3. Part-2 Database Implementation............................................................................ 14
3.1 Table Generation ................................................................................................. 14
3.2 Populating Database ........................................................................................... 30
4. Part-3 Database Querying ...................................................................................... 70
4.1 Information Queries ............................................................................................. 70
4.2 Transaction Queries ............................................................................................ 80
4.3 Dropping Table Queries ...................................................................................... 86
5. Part-4 Dump File Creation ...................................................................................... 90
6. Part-5 Conclusion ................................................................................................... 92
Bibliography ................................................................................................................ 93
List of Figures

Figure 1 Initial ER Diagram ............................................................................................. 4


Figure 2 Final ERD ........................................................................................................ 13
Figure 3 CREATE TABLE Courses ............................................................................... 14
Figure 4 CREATE TABLE Specifications ...................................................................... 15
Figure 5 CREATE TABLE Modules ............................................................................... 16
Figure 6 CREATE TABLE Class ................................................................................... 16
Figure 7 CREATE TABLE GPA ..................................................................................... 17
Figure 8 CREATE TABLE Student ................................................................................ 18
Figure 9 CREATE TABLE Instructor ............................................................................. 19
Figure 10 CREATE TABLE Temporary_Std_Address .................................................. 20
Figure 11 CREATE TABLE Permanent_Std_Address .................................................. 21
Figure 12 CREATE TABLE Temporary_Inst_Address .................................................. 22
Figure 13 CREATE TABLE Permanent_Inst_Address .................................................. 23
Figure 14 CREATE TABLE Student_Courses ............................................................... 24
Figure 15 CREATE TABLE Student_Specifications ...................................................... 25
Figure 16 CREATE TABLE Instructor_Specifications ................................................... 26
Figure 17 CREATE TABLE Courses_Specifications ..................................................... 27
Figure 18 CREATE TABLE Instructor_Modules ............................................................ 28
Figure 19 CREATE TABLE Specifications_Modules ..................................................... 29
Figure 20 CREATE TABLE Class_Modules .................................................................. 30
Figure 21 INSERT INTO Courses ................................................................................. 31
Figure 22 INSERT INTO Specifications ........................................................................ 32
Figure 23 INSERT INTO Modules ................................................................................. 34
Figure 24 INSERT INTO Class ..................................................................................... 35
Figure 25 INSERT INTO Student .................................................................................. 39
Figure 26 INSERT INTO Temporary_Std_Address ....................................................... 42
Figure 27 INSERT INTO Permanent_Std_Address ...................................................... 45
Figure 28 INSERT INTO Temporary_Inst_Address ...................................................... 48
Figure 29 INSERT INTO Permanent_Inst_ ................................................................... 50
Figure 30 INSERT INTO Specifications_Modules ......................................................... 54
Figure 31 INSERT INTO Class_Modules ...................................................................... 57
Figure 32 INSERT INTO Student_Courses ................................................................... 60
Figure 33 INSERT INTO Student_Specifications .......................................................... 63
Figure 34 INSERT INTO Instructor_Specifications ....................................................... 66
Figure 35 INSERT INTO Instructor_Modules ................................................................ 70
Figure 36 Information Query No.1 ................................................................................. 72
Figure 37 Information Query No.2 ................................................................................. 73
Figure 38 Information Query No.3 ................................................................................. 74
Figure 39 Information Query No.4 ................................................................................. 75
Figure 40 Information Query No.5 ................................................................................. 76
Figure 41 Information Query No.6 ................................................................................ 77
Figure 42 Information Query No.7 ................................................................................. 78
Figure 43 Information Query No.8 ................................................................................. 79
Figure 44 Information Query No.9 ................................................................................. 80
Figure 45 Information Query No.10 ............................................................................... 81
Figure 46 Transaction Query No.1 ................................................................................ 82
Figure 47 Transaction Query No.2 ................................................................................ 83
Figure 48 Transaction Query No.3 ................................................................................ 84
Figure 49 Transaction Query No.4 ................................................................................ 85
Figure 50 Transaction Query No.4 ................................................................................ 86
Figure 51 Transaction Query No.4 ................................................................................ 87
Figure 52 Drop Table Query .......................................................................................... 90
Figure 53 Dump File Creation ....................................................................................... 92

List of Tables

Table 1 Creation of Entities and Attributes ...................................................................... 3


CC5051NA DATABASES SYSTEMS

1. Introduction
1.1 Introduction of the College
Islington College was founded in 1997 and is located in Kamalpokhari, Kathmandu. As a
result of its affiliation with London Metropolitan University, the college offers its students
an internationally recognized degree. Students can enroll in a variety of courses at
Islington College, including BIT, BBA, and MBA. The college provides a pleasant study
atmosphere with sufficient opportunity.

Each module has Lectures, Tutorials, and Lab classes, therefore the college has an
excellent teaching method. It allows students to engage in class discussions and to learn
as much as possible through hands-on activities. Islington College aspires to equip
students with a degree from London Metropolitan University in the Uk. The college's
mission is straightforward and straightforward. It focuses on the student's best interests.
The college intends to expand in the near future in order to accommodate more students
and provide them with the best possible learning quality.

Aside from academics, Islington College offers a variety of extracurricular activities to its
students. Every year, it organizes spring carnivals, other sporting events, and a variety of
other activities. The college also recognizes the value of sportsmanship and has
constructed facilities for basketball, football, and table tennis.

1.2 Current Business Activities and Operations


The college's current business activities and operations are as follows:

• The college uses a Database Management System to keep track of all of the information
on the people who work there.

• It accepts students for three primary courses each year: BBA, BIT, and MBA.

• BIT and MBA are three-year programs, whereas BBA is a four-year program.

1
19033689
CC5051NA DATABASES SYSTEMS

• The student's semester fees are determined by the program in which they enroll.

• The college is open six days a week, with each module including a lecture, tutorial, and
lab class.

• The college is open from 7:00 a.m. to 5:00 p.m. seven days a week. Because there are
often hours of gap between sessions, the class schedule has been designed so that
students can have their own time in the college for self-study, sporting activities, and other
activities.

• Instructors are always accessible to assist students.

1.3 Business Rule

Islington College adheres to the following business rules: • The college database must
contain all student and instructor data.

• It should be able to maintain track of all people's mailing addresses, both temporary and
permanent.

• The college provides a variety of courses, each with its own set of requirements.

• Each specification has a large number of modules.

• A module may be used in many specifications.

• A single instructor can teach several courses, whereas an instructor cannot teach
multiple courses.

• A module can be taught by a number of different instructors.

• Each instructor has the option of teaching one or more modules.

• Each course and module must have its own leader.

• An instructor can only lead one course or module at a time.

2
19033689
CC5051NA DATABASES SYSTEMS

• A student must choose one of the courses from the list.

• There is no limit to the number of students in a class.

• In a single class, a module is taught, whereas in a class, numerous modules are


taught.

1.4 Creation of Entities and Attributes

Entities Attributes

Student Student_ID(PK), Name, Age, Gender, Joining_Date,


Permanent_Std_Address_ID,
Temporary_Std_Address_ID, Country, Province, City,
Street, House_Number, Phone, Fax Course_Marks, GPA

Courses Course_ID(PK), Name, Completion_Time

Instructors Instructor_ID(PK), Name, Age, Gender,


Salary, Permanent_Inst_Address_ID,
Temporary_Inst_Address_ID, Country, Province, City,
Street, House_Number, Phone, Fax

Specifications Specification_ID(PK),Specification_Name, Semester_Fee

Modules Module_Code(PK), Module_Name, Class_ID,


Class_Name}

Table 1 Creation of Entities and Attributes

3
19033689
CC5051NA DATABASES SYSTEMS

1.5 Initial ER Diagram

Figure 1 Initial ER Diagram

2. Part-1 Database Design


2.1 Assumptions
There are several specifications in a course, but only one module in a specification.

4
19033689
CC5051NA DATABASES SYSTEMS

• A module may have a large number of specifications, and vice versa.

• A class can have many modules, and a module can be taught in multiple classes.

• There is a one-to-many relationship between instructors and modules.

• A specification can have several teachers, but an instructor can only teach one
specification at a time.

• Teachers who teach the same subject earn the same remuneration.

• Each course and module must have its own leader.

• An instructor can only lead one course or module at a time.

• A student must choose one of the courses from the list.

2.2. Normalization

Normalization is a database design approach that avoids undesired characteristics


including Insertion, Update, and Deletion Anomalies by reducing data redundancy.
Normalization rules break huge tables into smaller tables and use relationships to connect
them. The goal of SQL normalization is to minimize redundant (repetitive) data and ensure
logical data storage.

With the introduction of the First Normal Form, the architect of the relational model, Edgar
Codd, presented the idea of data normalization, which he continued to enhance with the
Second and Third Normal Forms. Later, he collaborated with Raymond F. Boyce to
establish the Boyce-Codd Normal Form theory. (Guru99, 2020)

2.1.1 Un-Normalized form


A connection that contains recurring values is known as an unnormalized relation. An
unnormalized relation can also have relations nested within other relations, as well as

5
19033689
CC5051NA DATABASES SYSTEMS

transitive dependencies of any kind. The symbol 0NF is sometimes used to represent
unnormalized relations, however this should not be mistaken with a denormalized
connection. Any relation in its raw state is an unnormalized relation, and they frequently
contain recurring values and other features that are not found in denormalized relations.
Denormalization is an intentional attempt to introduce controlled duplicate objects into a
previously normalized state. (Consulting, 2020)

Showing Repeating groups:

Courses (Course_ID, Name, Completion_Time {Student_ID, Name, Age, Gender,


Joining_Date, Course_Marks, GPA {Permanent_Std_Address_ID, Country, Province,
City, Street, House_Number, Phone, Fax} {Temporary_Std_Address_ID, Country,
Province, City, Street, House_Number, Phone, Fax }} {Instructor_ID, Name, Age, Gender,
Salary, Course_Leader, Module_Leader {Permanent_Inst_Address_ID, Country,
Province, City, Street, House_Number, Phone, Fax} { Temporary_Inst_Address_ID,
Country, Province, City, Street, House_Number, Phone, Fax}} {Specification_ID, Name,
Semester_Fee {Module_Code, Name {Class_ID, Class_Name}}})

2.1.2 1NF

First normal form (1NF) sets the fundamental rules for database normalization
and relates to a single table within a relational database system. (Techopedia, 2020) The
First normalized form is implemented as follow:
Courses-1 (Course_ID, Name, Completion_Time)

Student-1 (Student_ID, Course_ID*, Specification_ID*, Name, Age, Gender,


Joining_Date, Course_Marks, GPA)

6
19033689
CC5051NA DATABASES SYSTEMS

Permanent_Std_Address-1 (Permanent_Std_Address_ID, Student_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

Temporary_Std_Address-1 (Temporary_Std_Address_ID, Student_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

Instructor-1 (Instructor_ID, Course_ID*, Module_ID*, Specification_ID*, Name, Age,


Gender, Salary, Course_Leader, Module_Leader)

Permanent_Inst_Addres-1 (Permanent_Inst_Address_ID, Instructor_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

Temporary_Inst_Addres-1 (Temporary_Inst_Address_ID, Instructor_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

Specifications-1 (Specification_ID, Course_ID*, Name, Semester_Fee)

Module-1 (Module_Code, Course_ID*, Specification_ID*, Module_Name)

Class-1 (Class_ID, Module_Code*, Class_Name)

2.1.3 2NF
A relation is in second normal form if it is in 1NF and every non key attribute is
fully functionally dependent on the primary key. (Gitta, 2020)

The second normalized form is implemented as follow:

For Student:

Student_id, Course_id  Course_Marks, GPA

Specification -id, Student_id

Student_id  Student_Name, Age, Gender, Joining Date

For Permanent_Std_Address:

7
19033689
CC5051NA DATABASES SYSTEMS

Permanent_Std_Address_ID, Student_ID Country, Province, City, Street,


House_Number, Phone, Fax

Permanent _Std_Address_ID 

For Temporary_Std_Address:

Temporary _Std_Address_ID, Student_ID Country, Province, City, Street,


House_Number, Phone, Fax

Temporary_ Std_Address_ID 

For Instructor:

Instructor_id, Course_id 

Instructor_id, Module_id 

Instructor_id, Specification_id  Salary

Instructor_ID Name, Age, Gender, House_Number, Phone, Fax Course_Leader,


Module_Leader

For Permanent_Inst_Address:
Permanent _Address_ID, Instructor_ID Country, Province, City, Street,
House_Number, Phone, Fax

Permanent _Address_ID 

For Temporary_Inst_Address:

Temporary _Address_ID, Instructor_ID Country, Province, City, Street,


House_Number, Phone, Fax

8
19033689
CC5051NA DATABASES SYSTEMS

Temporary _Address_ID 

For Specifications:

Specification_ID, Course_ID

Specification_ID Name, Semester_Fee

For Modules:

Module_ID, Course_ID

Module_ID, Specification_ID

Module_ID Name

For Class:

Class_ID, Module_Code

Class_ID Class_Name

Entities after 2NF :

Courses-2 (Course_ID, Name, Completion_Time)

Student-2 (Student_ID, Name, Age, Gender, Joining_Date)

Student_Course-2 (Student_ID*, Course_ID*, Course_Marks, GPA)

Permanent_Std_Address-2 (Permanent_Std_Address_ID, Student_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

Temporary_Std_Address-2 (Temporary_Std_Address_ID, Student_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

9
19033689
CC5051NA DATABASES SYSTEMS

Instructor-2 (Instructor_ID, Name, Age, Gender, Course_Leader, Module_Leader)

Specification-2 (Specification_ID, Specification_Name, Semester_Fee)

Instructor_Specification-2 (Instructor_id*, Specification_id*, Salary)

Instructor_Module-2 (Instructor_ID*, Module_ID*)

Permanent_Inst_Address-2 (Permanent_Inst_Address_ID, Instructor_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

Temporary_Inst_Address-2 (Temporary_Inst_Address_ID, Instructor_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

Module-2 (Module_ID, Name)

Class-2 (Class_ID, Name)

Class_Module -2 (Module_ID*, Class_ID*)

Student_Specifications-2 (Student_ID*, Specification_ID*)

Instructor_Course-2 (Instructor_ID*, Specification_ID*)

Course_Specifications-2 (Course_ID*, Specifications_ID*)

2.1.4 3NF
A relation is in third normal form if there is no transitive dependency for nonprime
attributes (and is also in the second form). (Techopedia, 2020)

The second normalized form is implemented as follow:

In Student_Course:

Student_id, Course_id  Course_Marks  GPA

Final Entities After 3NF:

Courses-3 (Course_ID, Name, Completion_Time)

10
19033689
CC5051NA DATABASES SYSTEMS

Student-3 (Student_ID, Name, Age, Gender, Joining_Date)

Student_Course-3 (Student_ID*, Course_ID*, Course_Marks)

GPA-3 (Course_Marks*, GPA)

Permanent_Std_Address-3 (Permanent_Std_Address_ID, Student_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

Temporary_Std_Address-3 (Temporary_Std_Address_ID, Student_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)

Instructor-3 (Instructor_ID, Name, Age, Gender, Course_Leader, Module_Leader)

Specification-3 (Specification_ID, Specification_Name, Semester_Fee)

Instructor_Specification-3 (Instructor_id*, Specification_id*, Salary)

Instructor_Module-3 (Instructor_ID*, Module_ID*)

Permanent_Inst_Address-3 (Permanent_Inst_Address_ID, Instructor_ID*, Country,


Province, City, Street, House_Number, Phone, Fax)
Temporary_Inst_Address-3 (Temporary_Inst_Address_ID, Instructor_ID*, Country,
Province, City, Street, House_Number, Phone, Fax)

Module-3 (Module_ID, Name)

Class-3 (Class_ID, Name)

Class_Module -3 (Module_ID*, Class_ID*)

Student_Specifications-3 (Student_ID*, Specification_ID*)

Instructor_Course-3 (Instructor_ID*, Specification_ID*)

Course_Specifications-3 (Course_ID*, Specifications_ID*)

11
19033689
CC5051NA DATABASES SYSTEMS

2.3 Final ERD

12
19033689
CC5051NA DATABASES SYSTEMS

Figure 2 Final ERD

13
19033689
CC5051NA DATABASES SYSTEMS

3. Part-2 Database Implementation

3.1 Table Generation


Creation of tables using SQL Command line is shown below along with the
screenshots:

For Courses

CREATE TABLE Courses(

Course_ID number(10) NOT NULL,

Course_Name varchar(32) NOT NULL,

Completion_Time varchar(32) NOT NULL,

CONSTRAINT PK_Course PRIMARY KEY (Course_ID));

Figure 3 CREATE TABLE Courses

14
19033689
CC5051NA DATABASES SYSTEMS

For Specifications

CREATE TABLE Specifications(

Specification_ID number(10) NOT NULL,

Specification_Name varchar(32) NOT NULL,

Semester_Fee number(10) NOT NULL,

CONSTRAINT PK_Specifications PRIMARY KEY (Specification_ID));

Figure 4 CREATE TABLE Specifications

For Modules

CREATE TABLE Modules(

Module_Code varchar(32) NOT NULL,

Module_Name varchar(32) NOT NULL,

CONSTRAINT PK_Modules PRIMARY KEY (Module_Code));

15
19033689
CC5051NA DATABASES SYSTEMS

Figure 5 CREATE TABLE Modules

For Class

CREATE TABLE Class(

Class_ID number(10) NOT NULL,

Class_Name varchar(32) NOT NULL,

CONSTRAINT PK_Class PRIMARY KEY (Class_ID));

Figure 6 CREATE TABLE Class

16
19033689
CC5051NA DATABASES SYSTEMS

For GPA

CREATE TABLE GPA(

Course_Marks number(10) NOT NULL,

GPA varchar(32) NOT NULL,

CONSTRAINT PK_gpa PRIMARY KEY (Course_Marks));

Figure 7 CREATE TABLE GPA

For Student

CREATE TABLE Student(

Student_ID number(10) NOT NULL,

Std_Name varchar(32) NOT NULL,

Age number(10) NOT NULL,

Gender varchar(32) NOT NULL,

Joining_Date DATE NOT NULL,

CONSTRAINT PK_Student PRIMARY KEY (Student_ID));

17
19033689
CC5051NA DATABASES SYSTEMS

Figure 8 CREATE TABLE Student

For Instructor

CREATE TABLE Instructor(

Instructor_ID number(10) NOT NULL,

Inst_Name varchar(32) NOT NULL,

Age number(10) NOT NULL,

Gender varchar(32) NOT NULL,

Course_Leader varchar(32) DEFAULT 'No',

Module_Leader varchar(32) DEFAULT 'No',

CONSTRAINT PK_Instructor PRIMARY KEY (Instructor_ID));

18
19033689
CC5051NA DATABASES SYSTEMS

Figure 9 CREATE TABLE Instructor

For Temporary_Std_Address

CREATE TABLE Temporary_Std_Address(

Temporary_Std_Address_ID number(10) NOT NULL,

Student_ID number(10),

Country varchar(32) NOT NULL,

Province varchar(32) NOT NULL,

City varchar(32) NOT NULL,

Street varchar(32) NOT NULL,

House varchar(32) NOT NULL,

Phone varchar(32) DEFAULT '1234567890',

Fax varchar(32) NOT NULL,

CONSTRAINT PK_TSA PRIMARY KEY (Temporary_Std_Address_ID),

CONSTRAINT FK_TSA FOREIGN KEY (Student_ID)

REFERENCES Student(Student_ID));

19
19033689
CC5051NA DATABASES SYSTEMS

Figure 10 CREATE TABLE Temporary_Std_Address

For Permanent_Std_Address

CREATE TABLE Permanent_Std_Address(

Permanent_Std_Address_ID number(10) NOT NULL,

Student_ID number(10),

Country varchar(32) NOT NULL,

Province varchar(32) NOT NULL,

City varchar(32) NOT NULL,

Street varchar(32) NOT NULL,

House varchar(32) NOT NULL,

Phone varchar(32) DEFAULT '1234567890',

Fax varchar(32) NOT NULL,


CONSTRAINT PK_PSA PRIMARY KEY (Permanent_Std_Address_ID),

20
19033689
CC5051NA DATABASES SYSTEMS

CONSTRAINT FK_PSA FOREIGN KEY (Student_ID)

REFERENCES Student(Student_ID));

Figure 11 CREATE TABLE Permanent_Std_Address

For Temporary_Inst_Address

CREATE TABLE Temporary_Inst_Address(

Temporary_Inst_Address_ID number(10) NOT NULL,

Instructor_ID number(10),

Country varchar(32) NOT NULL,

Province varchar(32) NOT NULL,

City varchar(32) NOT NULL,

Street varchar(32) NOT NULL,


House varchar(32) NOT NULL,

21
19033689
CC5051NA DATABASES SYSTEMS

Phone varchar(32) DEFAULT '1234567890',

Fax varchar(32) NOT NULL,

CONSTRAINT PK_TIA PRIMARY KEY (Temporary_Inst_Address_ID),

CONSTRAINT FK_TIA FOREIGN KEY (Instructor_ID)

REFERENCES Instructor(Instructor_ID));

Figure 12 CREATE TABLE Temporary_Inst_Address

For Permanent_Inst_Address

CREATE TABLE Permanent_Inst_Address(

Permanent_Inst_Address_ID number(10) NOT NULL,

Instructor_ID number(10),

Country varchar(32) NOT NULL,


Province varchar(32) NOT NULL,

City varchar(32) NOT NULL,

22
19033689
CC5051NA DATABASES SYSTEMS

Street varchar(32) NOT NULL,

House varchar(32) NOT NULL,

Phone varchar(32) DEFAULT '1234567890',

Fax varchar(32) NOT NULL,

CONSTRAINT PK_PIA PRIMARY KEY (Permanent_Inst_Address_ID),

CONSTRAINT FK_PIA FOREIGN KEY (Instructor_ID)

REFERENCES Instructor(Instructor_ID));

Figure 13 CREATE TABLE Permanent_Inst_Address

For Student_Courses

CREATE TABLE Student_Courses(


Student_ID number(10),

Course_ID number(10),

23
19033689
CC5051NA DATABASES SYSTEMS

Course_Marks number(10),

CONSTRAINT FK_SCS FOREIGN KEY (Student_ID)

REFERENCES Student(Student_ID),

CONSTRAINT FK_SCC FOREIGN KEY (Course_ID)

REFERENCES Courses(Course_ID),

CONSTRAINT FK_SCCM FOREIGN KEY (Course_Marks)

REFERENCES GPA(Course_Marks));

Figure 14 CREATE TABLE Student_Courses

For Student_Specifications

CREATE TABLE Student_Specifications(

Student_ID number(10),
Specification_ID number(10),

CONSTRAINT FK_SSS FOREIGN KEY (Student_ID)

24
19033689
CC5051NA DATABASES SYSTEMS

REFERENCES Student(Student_ID),

CONSTRAINT FK_SSS1 FOREIGN KEY (Specification_ID)

REFERENCES Specifications(Specification_ID));

Figure 15 CREATE TABLE Student_Specifications

For Instructor_Specifications

CREATE TABLE Instructor_Specifications(

Instructor_ID number(10),

Specification_ID number(10),

Salary number(10) NOT NULL,

CONSTRAINT FK_ISI FOREIGN KEY (Instructor_ID)

REFERENCES Instructor(Instructor_ID),
CONSTRAINT FK_ISS FOREIGN KEY (Specification_ID)

REFERENCES Specifications(Specification_ID));

25
19033689
CC5051NA DATABASES SYSTEMS

Figure 16 CREATE TABLE Instructor_Specifications

For Courses_ Specifications

CREATE TABLE Courses_Specifications(

Course_ID number(10),

Specification_ID number(10),

CONSTRAINT FK_CSC FOREIGN KEY (Course_ID)

REFERENCES Courses(Course_ID),

CONSTRAINT FK_CSS FOREIGN KEY (Specification_ID)

REFERENCES Specifications(Specification_ID));

26
19033689
CC5051NA DATABASES SYSTEMS

Figure 17 CREATE TABLE Courses_Specifications

For Instructor_modules

CREATE TABLE Instructor_Modules(

Instructor_ID number(10) NOT NULL,

Module_Code varchar(32) NOT NULL,

CONSTRAINT PK_IM PRIMARY KEY (Instructor_ID,Module_Code),

CONSTRAINT FK_IMI FOREIGN KEY (Instructor_ID)

REFERENCES Instructor(Instructor_ID),

CONSTRAINT FK_IMMC FOREIGN KEY (Module_Code)

REFERENCES Modules(Module_Code));

27
19033689
CC5051NA DATABASES SYSTEMS

Figure 18 CREATE TABLE Instructor_Modules

For Specifications_Modules

CREATE TABLE Specifications_Modules(

Specification_ID number(10) NOT NULL,

Module_Code varchar(32) NOT NULL,

CONSTRAINT PK_SMSID PRIMARY KEY (Specification_ID,Module_Code),

CONSTRAINT FK_SMSID FOREIGN KEY (Specification_ID)

REFERENCES Specifications(Specification_ID),

CONSTRAINT FK_SMMC FOREIGN KEY (Module_Code)

REFERENCES Modules(Module_Code));

28
19033689
CC5051NA DATABASES SYSTEMS

Figure 19 CREATE TABLE Specifications_Modules

For Class_Modules

CREATE TABLE Class_Modules(

Class_ID number(10) NOT NULL,

Module_Code varchar(32) NOT NULL,

CONSTRAINT PK_CMCID PRIMARY KEY (Class_ID,Module_Code),

CONSTRAINT FK_CMCID1 FOREIGN KEY (Class_ID)

REFERENCES Class(Class_ID),

CONSTRAINT FK_CMMC1 FOREIGN KEY (Module_Code)

REFERENCES Modules(Module_Code));

29
19033689
CC5051NA DATABASES SYSTEMS

Figure 20 CREATE TABLE Class_Modules

3.2 Populating Database

The following data were inserted in the tables created above:

For Courses
INSERT INTO Courses (Course_ID, Course_Name, Completion_Time)
VALUES (1, 'BIT', '3 Years');
INSERT INTO Courses (Course_ID, Course_Name, Completion_Time)
VALUES (2, 'BBA', '4 Years');
INSERT INTO Courses (Course_ID, Course_Name, Completion_Time)
VALUES (3, 'MBA', '3 Years');

30
19033689
CC5051NA DATABASES SYSTEMS

Figure 21 INSERT INTO Courses

For Specifications
INSERT INTO Specifications (Specification_ID, Specification_Name, Semester_Fee)
VALUES (1, 'Computing', 100000);
INSERT INTO Specifications (Specification_ID, Specification_Name, Semester_Fee)
VALUES (2, 'Networking', 90000);
INSERT INTO Specifications (Specification_ID, Specification_Name, Semester_Fee)
VALUES (3, 'Business and Marketing', 115000);
INSERT INTO Specifications (Specification_ID, Specification_Name, Semester_Fee)
VALUES (4, 'Banking and Insurance', 105000);
INSERT INTO Specifications (Specification_ID, Specification_Name, Semester_Fee)
VALUES (5, 'Finance', 123000);
INSERT INTO Specifications (Specification_ID, Specification_Name, Semester_Fee)
VALUES (6, 'Entrepreneurship', 118000);

31
19033689
CC5051NA DATABASES SYSTEMS

Figure 22 INSERT INTO Specifications

For Modules
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('C1', 'Programming');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('C2', 'Database');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('C3', 'Logic and Problem Sloving');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('N1', 'Programming');
INSERT INTO Modules (Module_Code, Module_Name)

32
19033689
CC5051NA DATABASES SYSTEMS

VALUES ('N2', 'Networking and Operating System');


INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('BM1', 'Business Rules');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('BM2', 'Marketing');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('BI1', 'Accounting');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('BI2', 'Economics');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('BI3', 'Mathematics');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('F1', 'Economics');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('F2', 'Accounting');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('F3', 'Banking Rules');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('E1', 'Leadership');
INSERT INTO Modules (Module_Code, Module_Name)
VALUES ('E2', 'Economics');

33
19033689
CC5051NA DATABASES SYSTEMS

Figure 23 INSERT INTO Modules

34
19033689
CC5051NA DATABASES SYSTEMS

For Class
INSERT INTO Class (Class_ID, Class_Name)
VALUES (1, 'Annapurna');
INSERT INTO Class (Class_ID, Class_Name)
VALUES (2, 'Kantipur');
INSERT INTO Class (Class_ID, Class_Name)
VALUES (3, 'Everest');
INSERT INTO Class (Class_ID, Class_Name)
VALUES (4, 'London');
INSERT INTO Class (Class_ID, Class_Name)
VALUES (5, 'Birmingham');

Figure 24 INSERT INTO Class

35
19033689
CC5051NA DATABASES SYSTEMS

For GPA
INSERT INTO GPA (Course_marks, GPA)
VALUES (44, '1.76');
INSERT INTO GPA (Course_marks, GPA)
VALUES (49, '1.96');
INSERT INTO GPA (Course_marks, GPA)
VALUES (56, '2.24');
INSERT INTO GPA (Course_marks, GPA)
VALUES (59, '2.36');
INSERT INTO GPA (Course_marks, GPA)
VALUES (65, '2.6');
INSERT INTO GPA (Course_marks, GPA)
VALUES (66, '2.64');
INSERT INTO GPA (Course_marks, GPA)
VALUES (72, '2.88');
INSERT INTO GPA (Course_marks, GPA)
VALUES (76, '3.04');
INSERT INTO GPA (Course_marks, GPA)
VALUES (77, '3.08');
INSERT INTO GPA (Course_marks, GPA)
VALUES (88, '3.52');
INSERT INTO GPA (Course_marks, GPA)
VALUES (95, '3.8');
INSERT INTO GPA (Course_marks, GPA)
VALUES (97, '3.88');

For Student
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (1, 'Abhishek Khadka', 20, 'Male', '07-Sep-2018');

36
19033689
CC5051NA DATABASES SYSTEMS

INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date) VALUES (2,
'Ariana Acharya', 21, 'Female', '15-May-2017');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (3, 'Binesh Dangol', 19, 'Male', '11-Sep-2018');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (4, 'Catie Lahm', 23, 'Female', '07-May-2020');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (5, 'Dilip Bhusal', 22, 'Male', '23-May-2019');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (6, 'Diana Thapa', 20, 'Female', '17-Sep-2018');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (7, 'Hari Shrestha', 24, 'Male', '26-May-2019');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (8, 'Heena Malla', 18, 'Female', '07-Sep-2020');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (9, 'Ishwor Bohara', 21, 'Male', '27-Sep-2019');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (10, 'Jenisha Chhetri', 20, 'Female', '26-May-2018');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (11, 'Kushal Khadka', 20, 'Male', '17-May-2019');
INSERT INTO Student (Student_ID, Std_Name, Age, Gender, Joining_Date)
VALUES (12, 'Sam Smith', 19, 'Male', '07-May-2020');

37
19033689
CC5051NA DATABASES SYSTEMS

38
19033689
CC5051NA DATABASES SYSTEMS

Figure 25 INSERT INTO Student

For Instructor
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (1, 'Avinash karki', 29, 'Male', 'No', 'No');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (2, 'Bishant KC', 44, 'Male', 'No', 'Yes');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (3, 'Binita Bhandari', 34, 'Female', 'Yes', 'No');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (4, 'Deepa Bista', 29, 'Female', 'No', 'No');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)

39
19033689
CC5051NA DATABASES SYSTEMS

VALUES (5, 'Ganesh Rai', 48, 'Male', 'No', 'Yes');


INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (6, 'Hari Bhatta', 29, 'Male', 'No', 'No');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (7, 'Isha Begam', 33, 'Female', 'Yes', 'No');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (8, 'Jenish Thapaliya', 39, 'Male', 'No', 'Yes');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (9, 'Kishor Chaudhary', 49, 'Male', 'Yes', 'No');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (10, 'Krisha Bhatta', 29, 'Female', 'No', 'No');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (11, 'Nisha Thapa', 36, 'Female', 'No', 'Yes');
INSERT INTO Instructor (Instructor_ID, Inst_Name, Age, Gender, Course_Leader,
Module_Leader)
VALUES (12, 'Sandesh karki', 26, 'Male', 'No', 'No');

For Temporary_Std_Address
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (1, 1, 'Nepal', 'Bagmati', 'Kathmandu', 'Bhainsepati', '56', '01-2255447',
'2258741256');
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Fax)

40
19033689
CC5051NA DATABASES SYSTEMS

VALUES (2, 2, 'Nepal', 'Bagmati', 'Lalitpur', 'Dholahity', '07', '4582154695');


INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (3, 3, 'Nepal', 'Bagmati', 'Lalitpur', 'Dhol', '11', '01-5594586', '4587125478');
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (4, 4, 'Nepal', 'Bagmati', 'Kathmandu', 'Balku', '69', '01-2145447',
'2257841256');
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Fax)
VALUES (5, 5, 'Nepal', 'Bagmati', 'Lalitpur', 'Khokana', '77', '4587854695');
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (6, 6, 'Nepal', 'Bagmati', 'Lalitpur', 'Jarkate', '011', '01-1145874', '7854125656');
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (7, 7, 'Nepal', 'Bagmati', 'Kathmandu', 'Magarchok', '45', '01-7785417',
'5584741256');
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Fax)
VALUES (8, 8, 'Nepal', 'Bagmati', 'Lalitpur', 'Bungmati', '58', '7854269695');
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (9, 9, 'Nepal', 'Bagmati', 'Bhaktapur', 'Bholechok', '21', '01-5841286',
'2785216956');
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (10, 10, 'Nepal', 'Bagmati', 'Kathmandu', 'Newroad', '86', '01-8954217',
'8854471256');
INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Fax)

41
19033689
CC5051NA DATABASES SYSTEMS

VALUES (11, 11, 'Nepal', 'Bagmati', 'Lalitpur', 'Dhobighat', '47', '4558412595');


INSERT INTO Temporary_Std_Address (Temporary_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (12, 12, 'Nepal', 'Bagmati', 'Lalitpur', 'Gairibato', '05', '01-5555556',
'1111111116');

Figure 26 INSERT INTO Temporary_Std_Address

42
19033689
CC5051NA DATABASES SYSTEMS

For Permanent_Std_Address
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (1, 1, 'Nepal', 'Bagmati', 'Kathmandu', 'Bhainsepati', '56', '01-2255447',
'2258741256');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Fax)
VALUES (2, 2, 'Nepal', 'Gandaki', 'Dharan', 'Pipalbot', '87', '1452145895');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (3, 3, 'Nepal', 'Bagmati', 'Lalitpur', 'Dhol', '11', '01-5594586', '4587125478');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (4, 4, 'Nepal', 'Karnali', 'Khempu', 'Bhiralobato', '99', '01-4545447',
'2257041256');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Fax)
VALUES (5, 5, 'Nepal', 'Bagmati', 'Lalitpur', 'Khokana', '77', '4587854695');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (6, 6, 'Nepal', 'Lumbini', 'Butwal', 'Chaumode', '51', '01-1145874',
'7854125756');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (7, 7, 'Nepal', 'Bagmati', 'Kathmandu', 'Magarchok', '45', '01-7785417',
'5584741256');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Fax)
VALUES (8, 8, 'Nepal', 'Bagmati', 'Lalitpur', 'Bungmati', '58', '7854269695');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)

43
19033689
CC5051NA DATABASES SYSTEMS

VALUES (9, 9, 'Nepal', 'Gandaki', 'Gorkha', 'Tarajubato', '89', '01-4541286',


'2788816956');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (10, 10, 'Nepal', 'Bagmati', 'Kathmandu', 'Newroad', '86', '01-8954217',
'8854471256');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Fax)
VALUES (11, 11, 'Nepal', 'Bagmati', 'Lalitpur', 'Dhobighat', '47', '4558412595');
INSERT INTO Permanent_Std_Address (Permanent_Std_Address_ID, Student_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (12, 12, 'Nepal', 'Karnali', 'Jharana', 'Jharibato', '15', '01-4444556', '1112222116');

44
19033689
CC5051NA DATABASES SYSTEMS

Figure 27 INSERT INTO Permanent_Std_Address

For Temporary_Inst_Address
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (1, 1, 'Nepal', 'Bagmati', 'Kathmandu', 'Bhainsepati', '89', '01-
2255447/9845125478', '2258748886');

45
19033689
CC5051NA DATABASES SYSTEMS

INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,


Country, Province, City, Street, House, Fax)
VALUES (2, 2, 'Nepal', 'Bagmati', 'Lalitpur', 'Dholahity', '147', '4582151695');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (3, 3, 'Nepal', 'Bagmati', 'Lalitpur', 'Dhol', '111', '01-5584786/9854741254',
'4580125478');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (4, 4, 'Nepal', 'Bagmati', 'Kathmandu', 'Balku', '679', '01-2145847',
'2257845256');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Fax)
VALUES (5, 5, 'Nepal', 'Bagmati', 'Lalitpur', 'Khokana', '717', '4587857695');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (6, 6, 'Nepal', 'Bagmati', 'Lalitpur', 'Jarkate', '70', '01-1145884', '7854125606');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (7, 7, 'Nepal', 'Bagmati', 'Kathmandu', 'Magarchok', '450', '01-
7785407/9874584521', '5555741256');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Fax)
VALUES (8, 8, 'Nepal', 'Bagmati', 'Lalitpur', 'Bungmati', '518', '7854256465');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (9, 9, 'Nepal', 'Bagmati', 'Bhaktapur', 'Bholechok', '201', '01-5841287',
'2785416956');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (10, 10, 'Nepal', 'Bagmati', 'Kathmandu', 'Newroad', '806', '01-8954017',

46
19033689
CC5051NA DATABASES SYSTEMS

'8854471756');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Fax)
VALUES (11, 11, 'Nepal', 'Bagmati', 'Lalitpur', 'Dhobighat', '410', '4558412795');
INSERT INTO Temporary_Inst_Address (Temporary_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (12, 12, 'Nepal', 'Bagmati', 'Lalitpur', 'Gairibato', '051', '01-
5555556/9854125478', '1114511116');

47
19033689
CC5051NA DATABASES SYSTEMS

Figure 28 INSERT INTO Temporary_Inst_Address

For Permanent_Inst_Address
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (1, 1, 'Nepal', 'Bagmati', 'Kathmandu', 'Bhainsepati', '89', '01-
2255447/9845125478', '2258748886');
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Fax)
48
19033689
CC5051NA DATABASES SYSTEMS

VALUES (2, 2, 'Nepal', 'Bagmati', 'Lalitpur', 'Dholahity', '147', '4582151695');


INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (3, 3, 'Nepal', 'Bagmati', 'Lalitpur', 'Dhol', '111', '01-5584786/9854741254',
'4580125478');
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (4, 4, 'Nepal', 'Bagmati', 'Kathmandu', 'Balku', '679', '01-2145847',
'2257845256');
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Fax)
VALUES (5, 5, 'Nepal', 'Bagmati', 'Lalitpur', 'Khokana', '717', '4587857695');
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (6, 6, 'Nepal', 'Bagmati', 'Lalitpur', 'Jarkate', '70', '01-1145884', '7854125606');
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (7, 7, 'Nepal', 'Gandaki', 'Pokhara', 'lakeside', '540', '01-7854127/9874584521',
'5555881256');
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Fax)
VALUES (8, 8, 'Nepal', 'Karnali', 'Palpa', 'Peterstreet', '718', '7857888547');
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (9, 9, 'Nepal', 'Gandaki', 'Kuri', 'Ratomato', '91', '01-5888287', '2785418756');
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
Country, Province, City, Street, House, Phone, Fax)
VALUES (10, 10, 'Nepal', 'Karnali', 'Paatmandu', 'Nayabato', '06', '01-8957017',
'8882471756');
INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,
VALUES (11, 11, 'Nepal', 'Lumbini', 'Butwal', 'Aryaghat', '40', '4558812795');

49
19033689
CC5051NA DATABASES SYSTEMS

INSERT INTO Permanent_Inst_Address (Permanent_Inst_Address_ID, Instructor_ID,


Country, Province, City, Street, House, Phone, Fax)
VALUES (12, 12, 'Nepal', 'Lumbini', 'Chitwan', 'Sukedhara', '05', '01-
5554556/9854125478', '1114544116');

Figure 29 INSERT INTO Permanent_Inst_

For Courses_Specifications
INSERT INTO Courses_Specifications (Course_ID, Specification_ID)

50
19033689
CC5051NA DATABASES SYSTEMS

VALUES (1, 1);


INSERT INTO Courses_Specifications (Course_ID, Specification_ID)
VALUES (1, 2);
INSERT INTO Courses_Specifications (Course_ID, Specification_ID)
VALUES (2, 3);
INSERT INTO Courses_Specifications (Course_ID, Specification_ID)
VALUES (2, 4);
INSERT INTO Courses_Specifications (Course_ID, Specification_ID)
VALUES (3, 5);
INSERT INTO Courses_Specifications (Course_ID, Specification_ID)
VALUES (3, 6);

For Specifications_Modules
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (1, 'C1');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (1, 'C2');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (1, 'C3');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (2, 'N1');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (2, 'N2');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (3, 'BM1');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (3, 'BM2');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code) VALUES (4,
'BI1');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)

51
19033689
CC5051NA DATABASES SYSTEMS

VALUES (4, 'BI2');


INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (4, 'BI3');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (5, 'F1');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (5, 'F2');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (5, 'F3');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (6, 'E1');
INSERT INTO Specifications_Modules (Specification_ID, Module_Code)
VALUES (6, 'E2');

52
19033689
CC5051NA DATABASES SYSTEMS

53
19033689
CC5051NA DATABASES SYSTEMS

Figure 30 INSERT INTO Specifications_Modules

For Class_Modules
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (1, 'C1');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (3, 'C2');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (4, 'C3');

54
19033689
CC5051NA DATABASES SYSTEMS

INSERT INTO Class_Modules (Class_ID, Module_Code)


VALUES (2, 'N1');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (5, 'N2');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (4, 'BM1');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (2, 'BM2');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (3, 'BI1');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (5, 'BI2');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (1, 'BI3');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (4, 'F1');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (2, 'F2');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (5, 'F3');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (1, 'E1');
INSERT INTO Class_Modules (Class_ID, Module_Code)
VALUES (3, 'E2');

55
19033689
CC5051NA DATABASES SYSTEMS

56
19033689
CC5051NA DATABASES SYSTEMS

Figure 31 INSERT INTO Class_Modules

For Student_Courses
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (1, 1, 65);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (2, 1, 88);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (3, 1, 59);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks) VALUES (4, 1,
77);

57
19033689
CC5051NA DATABASES SYSTEMS

INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)


VALUES (5, 2, 66);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (6, 2, 49);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (7, 2, 56);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (8, 2, 95);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (9, 3, 97);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (10, 3, 72);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (11, 3, 76);
INSERT INTO Student_Courses (Student_ID, Course_ID, Course_Marks)
VALUES (12, 3, 44);

58
19033689
CC5051NA DATABASES SYSTEMS

59
19033689
CC5051NA DATABASES SYSTEMS

Figure 32 INSERT INTO Student_Courses

For Student_Specifications
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (1, 1);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (2, 1);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (3, 2);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (4, 2);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (5, 3);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (6, 3);

60
19033689
CC5051NA DATABASES SYSTEMS

INSERT INTO Student_Specifications (Student_ID, Specification_ID)


VALUES (7, 4);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (8, 4);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (9, 5);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (10, 5);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (11, 6);
INSERT INTO Student_Specifications (Student_ID, Specification_ID)
VALUES (12, 6);

61
19033689
CC5051NA DATABASES SYSTEMS

62
19033689
CC5051NA DATABASES SYSTEMS

Figure 33 INSERT INTO Student_Specifications

For Instructor_Specifications
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (1, 1, 50000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (2, 1, 50000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (3, 2, 48000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (4, 2, 48000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (5, 3, 57000);

63
19033689
CC5051NA DATABASES SYSTEMS

INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)


VALUES (6, 3, 57000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (7, 4, 25000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (8, 4, 25000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (9, 5, 78000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (10, 5, 78000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (11, 6, 60000);
INSERT INTO Instructor_Specifications (Instructor_ID, Specification_ID, Salary)
VALUES (12, 6, 60000);

64
19033689
CC5051NA DATABASES SYSTEMS

65
19033689
CC5051NA DATABASES SYSTEMS

Figure 34 INSERT INTO Instructor_Specifications

For Instructor_Modules
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (1, 'C1');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (2, 'C2');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (2, 'C3');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (3, 'N1');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (4, 'N2');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (5, 'BM1');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (6, 'BM2');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)

66
19033689
CC5051NA DATABASES SYSTEMS

VALUES (6, 'BM2');


INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (8, 'BI2');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (7, 'BI3');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (9, 'F1');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (9, 'F2');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (10, 'F3');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (11, 'E1');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (12, 'E2');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (1, 'C2');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (1, 'C3');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (3, 'N2');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (12, 'E1');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (6, 'BM1');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (7, 'BM2');
INSERT INTO Instructor_Modules (Instructor_ID, Module_Code)
VALUES (7, 'BM1');

67
19033689
CC5051NA DATABASES SYSTEMS

68
19033689
CC5051NA DATABASES SYSTEMS

Figure 35 INSERT INTO Instructor_Modules

69
19033689
CC5051NA DATABASES SYSTEMS

4. Part-3 Database Querying

4.1 Information Queries

IO1. List all the students with all their addresses with their phone numbers.
SELECT
B.Std_Name,
A.Permanent_Std_Address_ID,
A.Phone,
C.Temporary_Std_Address_ID,
C.Phone
FROM
Permanent_Std_Address A,
Student B,
Temporary_Std_Address C
WHERE
A.Student_ID=B.Student_ID
AND
C.Student_ID=B.Student_ID;

70
19033689
CC5051NA DATABASES SYSTEMS

Figure 36 Information Query No.1

IQ2. List all the modules which are taught by more than one instructor.
SELECT
Modules.Module_Name,
Modules.Module_Code,
COUNT(Instructor_Modules.Instructor_ID) As No_of_Instructors
FROM Modules
JOIN Instructor_Modules
ON Modules.Module_Code=Instructor_Modules.Module_Code
GROUP BY Modules.Module_Name,Modules.Module_Code
HAVING Count(Instructor_Modules.Instructor_ID) > 1;

71
19033689
CC5051NA DATABASES SYSTEMS

Figure 37 Information Query No.2

IQ3. List the name of all the instructors whose name contains ‘s’ and salary is
above 50,000.

72
19033689
CC5051NA DATABASES SYSTEMS

SELECT
Instructor.Inst_Name
FROM
Instructor
JOIN
Instructor_Specifications ON
Instructor.Instructor_ID=Instructor_Specifications.Instructor_ID
WHERE
Instructor.Inst_Name LIKE '%s%'
AND
Instructor_Specifications.Salary > 50000;

Figure 38 Information Query No.3

IQ4. List the modules comes under the ‘Multimedia’ specification.


For this query, I have shown the modules that comes under Computing since I have not
included Multimedia while inserting the data.

73
19033689
CC5051NA DATABASES SYSTEMS

Select Modules.Module_Name
FROM
Modules
JOIN
Specifications_Modules
ON Modules.Module_Code=Specifications_Modules.Module_Code
WHERE Specifications_Modules.Specification_ID=1;

Figure 39 Information Query No.4

IQ5. List the name of the head of modules with the list of his phone number.
Select Instructor.Inst_Name,
Temporary_Inst_Address.Phone
FROM
Instructor,

74
19033689
CC5051NA DATABASES SYSTEMS

Temporary_Inst_Address
WHERE
Instructor.Instructor_ID=Temporary_Inst_Address.Instructor_ID
AND Instructor.Module_Leader='Yes';

Figure 40 Information Query No.5

IQ6. List all Students who have enrolled in ‘networking’ specifications.


Select Student.Std_Name
FROM
Student
JOIN
Student_Specifications
ON Student.Student_ID=Student_Specifications.Student_ID
75
19033689
CC5051NA DATABASES SYSTEMS

WHERE Student_Specifications.Specification_ID=2;

Figure 41 Information Query No.6

IQ7. List the fax number of the instructor who teaches the ‘database’ module.
Select Instructor.Inst_Name,
Instructor_Modules.Instructor_ID,
Temporary_Inst_Address.Fax
FROM
Instructor,
Instructor_Modules,
Temporary_Inst_Address
WHERE
76
19033689
CC5051NA DATABASES SYSTEMS

Instructor.Instructor_ID=Instructor_Modules.Instructor_ID
AND
Instructor.Instructor_ID=Temporary_Inst_Address.Instructor_ID
AND
Instructor_Modules.Module_Code='C2';

Figure 42 Information Query No.7

IQ8. List the specification falls under the BIT course. Select
specifications.specification_name, courses.course_name,
Courses_Specifications.Course_ID,
Courses_Specifications.Specification_ID
FROM
specifications, courses,
Courses_Specifications
WHERE
Courses_Specifications.Specification_ID=specifications.Specification_ID
AND

77
19033689
CC5051NA DATABASES SYSTEMS

Courses_Specifications.course_ID=courses.course_ID
AND Courses_Specifications.course_ID=1;

Figure 43 Information Query No.8

IQ9. List all the modules taught in any one particular class.
SELECT Modules.Module_Name,
Class.Class_Name,
Class_Modules.Class_ID,
Class_Modules.Module_Code
FROM
Modules,
Class,
Class_Modules
WHERE
Class_Modules.Class_ID=Class.Class_ID
AND
Class_Modules.Module_Code=Modules.Module_Code;

78
19033689
CC5051NA DATABASES SYSTEMS

Figure 44 Information Query No.9

IQ10. List all the teachers with all their addresses who have ‘a’ at the end of their
first names.
SELECT
B.Inst_Name,
A.Permanent_Inst_Address_ID,
A.Phone,
C.Temporary_Inst_Address_ID,
C.Phone
FROM
Permanent_Inst_Address A,
Instructor B,
Temporary_Inst_Address C
WHERE
A.Instructor_ID=B.Instructor_ID

79
19033689
CC5051NA DATABASES SYSTEMS

AND
C.Instructor_ID=B.Instructor_ID
AND
B.Inst_Name LIKE '%a';

Figure 45 Information Query No.10

4.2 Transaction Queries

TQ1. Show the students, course they enroll in and their fees. Reduce 10% of the
fees if they are enrolled in a computing course.
SELECT Student.Student_id,Student.Std_Name,
Specifications.Specification_name,Specifications.Semester_fee,
DECODE(Specifications.Specification_name,'Computing',Semester_fee-
(Semester_fee*(10/100)),Specifications.Semester_fee) As NEW_Specification_fee
FROM Student
JOIN Student_specifications
ON Student.Student_id=Student_specifications.Student_id
JOIN Specifications
ON Specifications.Specification_ID=Student_specifications.specification_ID;

80
19033689
CC5051NA DATABASES SYSTEMS

Figure 46 Transaction Query No.1

TQ2. Place the default Number 1234567890 if the list of phone numbers to the
location of the address is empty and give the column name as ‘Contact details.
SELECT Country,province,city,Street,House,
COALESCE(Temporary_Std_Address.Phone, '1234567890') AS Contact_detail
FROM Temporary_Std_Address;

OR,
SELECT Country,province,city,Street,House,
COALESCE(Permanent_Std_Address.Phone, '1234567890') AS Contact_detail FROM
Permanent_Std_Address;

81
19033689
CC5051NA DATABASES SYSTEMS

Figure 47 Transaction Query No.2

TQ3. Show the name of all the students with the number of weeks since they have
enrolled in the course.
SELECT Std_name,
(SYSDATE-joining_date )/7 AS "No of Enrolled week"
FROM Student;

82
19033689
CC5051NA DATABASES SYSTEMS

Figure 48 Transaction Query No.3

TQ4. Show the name of the instructors who got equal salary and work in the same
specification.
SELECT a.Inst_Name, b.Salary,
c.Specification_Name
FROM
Instructor a,

83
19033689
CC5051NA DATABASES SYSTEMS

Instructor_Specifications b,
Specifications c
WHERE
b.Instructor_ID=a.Instructor_ID
AND
b.Specification_ID=c.Specification_ID;

Figure 49 Transaction Query No.4

TQ5. List all the courses with the total number of students enrolled course name
and the highest marks obtained. Select * from student_courses
ORDER BY Course_Marks DESC;

84
19033689
CC5051NA DATABASES SYSTEMS

Figure 50 Transaction Query No.4

TQ6. List all the instructors who are also a course leader.
Select Inst_Name, Module_Leader
FROM
Instructor
WHERE
Instructor.Module_Leader='Yes';

85
19033689
CC5051NA DATABASES SYSTEMS

Figure 51 Transaction Query No.4

4.3 Dropping Table Queries

The queries used to drop the tables at last were.

DROP TABLE Temporary_Std_Address;


DROP TABLE Permanent_Std_Address;
DROP TABLE Temporary_Inst_Address;
DROP TABLE Permanent_Inst_Address;

86
19033689
CC5051NA DATABASES SYSTEMS

DROP TABLE Student_Courses;


DROP TABLE Student_Specifications;
DROP TABLE Instructor_Specifications;
DROP TABLE Courses_Specifications; DROP
TABLE Instructor_Modules;
DROP TABLE Specifications_Modules;
DROP TABLE Class_Modules;
DROP TABLE Courses;
DROP TABLE Specifications;
DROP TABLE Modules;
DROP TABLE Class;
DROP TABLE GPA;
DROP TABLE Student;
DROP TABLE Instructor;

87
19033689
CC5051NA DATABASES SYSTEMS

88
19033689
CC5051NA DATABASES SYSTEMS

Figure 52 Drop Table Query

89
19033689
CC5051NA DATABASES SYSTEMS

5. Part-4 Dump File Creation

The dump file for the database can be created by using the command prompt.
The code that I used was “exp cw/cw file=course.dmp” as shown in the figure below:

90
19033689
CC5051NA DATABASES SYSTEMS

Figure 53 Dump File Creation

91
19033689
CC5051NA DATABASES SYSTEMS

6. Part-5 Conclusion

This course material was assigned to us in week 7, when I had never heard of the phrase
"Normalization." I had trouble comprehending the question because the notion of
normalization was new to me. I watched a lot of online lessons and read the reading
materials that were uploaded to Google Classroom. That greatly aided my comprehension
of the notion of normalization.

The task at hand was to create a database for a college management system. Because I
choose our own college, drafting the skeleton was not tough at start. However, after I
began the normalization process, I had numerous challenges, which I eventually
overcame with the assistance of our professors and friends.

To summarize, I am grateful to all of the teachers who have assisted us through emails
and tutorial sessions, especially at this difficult period when we are unable to attend actual
courses.

92
19033689
CC5051NA DATABASES SYSTEMS

Bibliography
Consulting, B., 2020. tp_Oracle_physical_design_unnormalized. [Online]
Available at: http://www.remote-dba.net/tp_Oracle_physical_design_unnormalized.htm
[Accessed 2020].
Gitta, 2020. DataConsiten_Norm2NF. [Online]
Available at: http://www.gitta.info/LogicModelin/en/html/DataConsiten_Norm2NF.html
[Accessed 2020].
Guru99, 2020. database-normalization. [Online]
Available at: https://www.guru99.com/database-normalization.html [Accessed
2020].
Techopedia, 2020. first-normal-form-1nf. [Online]
Available at: https://www.techopedia.com/definition/25955/first-normal-form-1nf
[Accessed 2020].
Techopedia, 2020. third-normal-form-3nf. [Online]
Available at: https://www.techopedia.com/definition/22561/third-normal-form-3nf
[Accessed 2020].

93
19033689

You might also like