You are on page 1of 50

Database

CS5051NP
Coursework 1

Submitted BY Submitted To
Nikhil Thapa Mr. Pratibha Gurung
Group: C4 Module Leader
Date: 2020/12/18 Database
London Met. ID: 19031007
Table of Contents

1 Introduction ............................................................................................................................. 1
1.1 Introduction of the College .............................................................................................. 1
1.2 Current Business Activities and Operations .................................................................... 1
1.3 Current Business Rules .................................................................................................... 2
1.3.1 Identification of Entities and Attributes .................................................................... 3
1.3.2 Data dictionary before normalization ....................................................................... 3
2 Initial E-R Diagram ................................................................................................................. 6
3 Normalization .......................................................................................................................... 7
3.1 UNF .................................................................................................................................. 7
3.2 1NF ................................................................................................................................... 8
3.3 2NF ................................................................................................................................... 8
3.4 3NF ................................................................................................................................. 10
3.4.1 Data dictionary before normalization ..................................................................... 11
4 Final Entity Relation Diagram ............................................................................................... 15
5 Database Implementation ...................................................................................................... 16
5.1 Table Generation ............................................................................................................ 16
5.2 Populate DB tables ......................................................................................................... 23
5.3 Final Table...................................................................................................................... 27
6 Database Querying ................................................................................................................ 32
6.1 Information Query .......................................................................................................... 32
6.2 Transaction Query .......................................................................................................... 36
7 Screenshot of dump files ....................................................................................................... 40
8 Droping Tables ...................................................................................................................... 41
9 Conclusion ............................................................................................................................. 44
Table Of Figues

Figure 1: Initial Entity Relation Diagram ....................................................................................... 6


Figure 2: Final Entity Relation Diagram ...................................................................................... 15
Figure 3: Creation of User ............................................................................................................ 16
Figure 4: Grant Privileges to User ............................................................................................... 16
Figure 5: Creation of Country Table ............................................................................................ 16
Figure 6: Description of Country Table ........................................................................................ 17
Figure 7: Creation of Address Table ............................................................................................ 17
Figure 8: Description of Address Table ........................................................................................ 17
Figure 9: Creation of Person Table .............................................................................................. 17
Figure 10: Description of Person Table ........................................................................................ 18
Figure 11: Creation of Student Table........................................................................................... 18
Figure 12:Description of Student Table ........................................................................................ 18
Figure 13:Creation of Instructor Table ........................................................................................ 19
Figure 14: Description of Instructor Table ................................................................................... 19
Figure 15: Creation of Coure Table .............................................................................................. 19
Figure 16:Description of Coure Table .......................................................................................... 19
Figure 17: Creation of Specification Table ................................................................................... 19
Figure 18: Description of Specification Table .............................................................................. 20
Figure 19: Creation of Class Table ............................................................................................... 20
Figure 20: Description of Class Table .......................................................................................... 20
Figure 21: Creation of Module Table ........................................................................................... 20
Figure 22: Description of Module Table ...................................................................................... 21
Figure 23: Creation of Department Table ..................................................................................... 21
Figure 24: Description of Department Table ................................................................................ 21
Figure 25: Creation of CoueseInfo Table ..................................................................................... 22
Figure 26: Description of CoueseInfo Table ................................................................................ 22
Figure 27: CoueseDetails Table .................................................................................................... 22
Figure 28: Description of CoueseDetails Table ............................................................................ 22
Figure 29: Inserting values in Country Table ............................................................................... 23
Figure 30: Inserting values in Address Table ............................................................................... 23
Figure 31:Inserting values in Person Table .................................................................................. 24
Figure 32: Inserting values in Student Table ................................................................................ 24
Figure 33: Inserting values in Instructor Table ............................................................................. 25
Figure 34: Inserting values in Course Table ................................................................................. 25
Figure 35:Inserting values in Class Table ..................................................................................... 26
Figure 36: Inserting values in Module Table ................................................................................ 26
Figure 37: Inserting values in Department Table ......................................................................... 26
Figure 38: Inserting values in CourseInfo Table .......................................................................... 27
Figure 39: Inserting values in CourseDetails Table ...................................................................... 27
Figure 40: Displaying values of Country Table ........................................................................... 28
Figure 41: Displaying values of Address Table ........................................................................... 28
Figure 42: Displaying values of Address Table ........................................................................... 29
Figure 43: Displaying values of Student Table............................................................................ 29
Figure 44: Displaying values of Instructor Table ........................................................................ 30
Figure 45: Displaying values of Coure Table ............................................................................... 30
Figure 46: Displaying values of Specification Table .................................................................... 30
Figure 47: Displaying values of Class Table ................................................................................ 31
Figure 48: Displaying values of Module Table ............................................................................ 31
Figure 49: Displaying values of Department Table ...................................................................... 31
Figure 50: Displaying values of CoueseInfo Table ...................................................................... 32
Figure 51: Displaying values of CoueseDetails Table .................................................................. 32
Figure 52: Information Query No 1 .............................................................................................. 33
Figure 53: Information Query No 2 .............................................................................................. 33
Figure 54: Information Query No 3 .............................................................................................. 34
Figure 55: Information Query No 4 .............................................................................................. 34
Figure 56: Information Query No 5 .............................................................................................. 34
Figure 57: Information Query No 6 .............................................................................................. 35
Figure 58: Information Query No 7 .............................................................................................. 35
Figure 59: Information Query No 8 .............................................................................................. 36
Figure 60: Information Query No 9 .............................................................................................. 36
Figure 61: Information Query No 10 ............................................................................................ 36
Figure 62: Transaction Query No 1 .............................................................................................. 37
Figure 63: Transaction Query No 2 .............................................................................................. 37
Figure 64: Transaction Query No 3 .............................................................................................. 38
Figure 65: Transaction Query No 4 .............................................................................................. 38
Figure 66: Transaction Query No 5 .............................................................................................. 39
Figure 67: Transaction Query No 6 .............................................................................................. 39
Figure 68: Creating dump file 1 .................................................................................................... 40
Figure 69: Creating dump file 2 .................................................................................................... 40
Figure 70: Droping Table Country ............................................................................................... 41
Figure 71: Droping Table Address ............................................................................................... 41
Figure 72: Droping Table Person .................................................................................................. 41
Figure 73: Droping Table Student ................................................................................................ 41
Figure 74: Droping Table Instructor ............................................................................................. 42
Figure 75: Droping Table Course ................................................................................................. 42
Figure 76: Droping Table Specification ....................................................................................... 42
Figure 77: Droping Table Class .................................................................................................... 42
Figure 78: Droping Table Module ................................................................................................ 43
Figure 79: Droping Table Department .......................................................................................... 43
Figure 80: Droping Table CourseInfo........................................................................................... 43
Figure 81: Droping Table CourseDetails ...................................................................................... 43
Table Of Tables
Table 1: Data dictionary of Person before normalization ............................................................... 3
Table 2: Data dictionary of Student before normalization.............................................................. 3
Table 3: Data dictionary of Intructor before normalization ............................................................ 4
Table 4: Data dictionary of Course before normalization .............................................................. 4
Table 5: Data dictionary of Specification before normalization ..................................................... 4
Table 6: Data dictionary of Module before normalization ............................................................. 5
Table 7: Data dictionary of Class before normalization ................................................................. 5
Table 8: Data dictionary of Department before normalization ....................................................... 5
Table 9: Data dictionary of Country after normalization.............................................................. 11
Table 10: Data dictionary of Address after normalization............................................................ 11
Table 11: Data dictionary of Person after normalization .............................................................. 12
Table 12: Data dictionary of Student after normalization ............................................................ 12
Table 13: Data dictionary of Instructor after normalization ......................................................... 12
Table 14: Data dictionary of Course after normalization ............................................................. 13
Table 15: Data dictionary of Specification Module after normalization ...................................... 13
Table 16: Data dictionary of Class after normalization ................................................................ 13
Table 17: Data dictionary of Module after normalization ............................................................ 13
Table 18: Data dictionary of Department after normalization ...................................................... 14
Table 19: Data dictionary of CourseInfo after normalization ....................................................... 14
Table 20: Data dictionary of CourseDetails after normalization .................................................. 14
CS5051NP Database

1 Introduction
1.1 Introduction of the College
Education is the most valuable tool to achieve success in one’s ife. Education is a life
long process. Education of a person begins from home. But a person can not learn
everything inside home. That is where school, collages, and universities comes. School
teaches basic things about a lot of things. College teaches about those things in more
detail. And finally university teachers us how are those things performed. In today’s date
if a person does not have a university certificate then he/she is restricted in a lot of line of
work. There are many colleges in any particular city. In my city Pokhara, Informatics
College Pokhara(ICP) is without any doubt one of best college to provide quality
education.
ICP, established in 2011 is an associate college of ING Group. As a franchisee of
Informatics Education Limited, Singapore, ICP began its academic journey. Informatics
College Pokhara has been directly collaborating with London Metropolitan University,
UK, since 2017 to provide students in Pokhara with enviable higher education in IT and
Business at an affordable price.
ICP provide two courses to choose for students:
1. BBA

 Marketing
 Business

2. BIT with following specifications:

 Computing
 Networking
 Multimedia

1.2 Current Business Activities and Operations

Various activites and operations is performed in ICP college. They are as follow:
 Library provides various learning materials and books.
 Encouring students to take part in various programs.
 Providing fresh environment for students.
 Students are provided with classes with electricity and wifi acces.

Page | 1
19031007
CS5051NP Database

1.3 Current Business Rules


Every Institute/Organization need to have certain rules. Without rules nothing can be
carried out properly.
Informatics College Pokhara also have some rules like:
For Students:
 Students needs to attent college with 80% attendance.
 Students are not allowed to drink/smoke in college premises.
 Students have to obey all college rules.
 Students have to submit their assignments and courseworks under given deadline.
 A student can only choose one course.

For Instructors:
 A instructor can only be course leader of only one course.
 Instructors should teach modules in a particular class.
 Single instructor can teach multiple modules.
 Instructors should attend college in proper uniform.

Page | 2
19031007
CS5051NP Database

1.3.1 Identification of Entities and Attributes


There are a lot of entites in college. In the case of my college ICP there are entites
like Person, Student, Instructor, Address, Country, Course, Specification, Modules,
Class, CourseInfo, CourseDetails.

1.3.2 Data dictionary before normalization


 Data Dictionary of Person
Entities Attributes Constraints Data Type
P_ID Primary Key VARCHAR(40)
P_FNAME Not Null VARCHAR(40)
P_LNAME Not Null VARCHAR(40)
P_Age Not Null INT
P_Gender Not Null VARCHAR(40)
P_Contact Not Null INT
Person P_Email Not Null VARCHAR(40)
P_HouseID Not Null INT
P_Street Not Null VARCHAR(40)
P_City Not Null VARCHAR(40)
P_Province Not Null VARCHAR(40)
P_CountryName Not Null VARCHAR(40)
P_fax Not Null VARCHAR(40)

Table 1: Data dictionary of Person before normalization

 Data Dictionary of Student

Entities Attributes Constraints Data Types


Student P_ID Foreign Key VARCHAR(40)
S_ID Primary Key VARCHAR(40)
S_DOJ Not Null date
S_Marks Not Null INT

Table 2: Data dictionary of Student before normalization

Page | 3
19031007
CS5051NP Database

 Data Dictionary of Intructor

Entities Attributes Constraints Data Types


Instructor P_ID Foreign Key VARCHAR(40)
I_ID Primary Key VARCHAR(40)
I_Salary Not Null VARCHAR(40)

Table 3: Data dictionary of Intructor before normalization

 Data Dictionary of Course

Entities Attributes Constraints Data Types


Course C_ID Not Null VARCHAR(40)
C_Name Not Null VARCHAR(40)
C_Cost Not Null INT
C_Leader Not Null VARCHAR(40)
C_Duration Not Null INT
C_Credit Not Null INT

Table 4: Data dictionary of Course before normalization

 Data Dictionary of Specification

Entities Attributes Constraints Data Types


Specification C_ID Foreign Key VARCHAR(40)
SP_ID Primary Key VARCHAR(40)
SP_Name Not Null VARCHAR(40)

Table 5: Data dictionary of Specification before normalization

Page | 4
19031007
CS5051NP Database

 Data Dictionary of Module

Entities Attributes Constraints Data Types


Module SP_ID Foreign Key VARCHAR(40)
M_ID Primary Key VARCHAR(40)
M_Name Not Null VARCHAR(40)
M_Leader Not Null VARCHAR(40)
M_Level Not Null INT
M_Duration Not Null INT
M_Credit Not Null INT

Table 6: Data dictionary of Module before normalization

 Data Dictionary of Class

Entities Attributes Constraints Data Types


Class CL_ID Primary Key VARCHAR(40)
CL_Name Not Null VARCHAR(40)

Table 7: Data dictionary of Class before normalization

 Data Dictionary of Department

Entities Attributes Constraints Data Types


Department D_ID Primary Key VARCHAR(40)
D_NAME Not Null VARCHAR(40)
D_TYPE Not Null VARCHAR(40)

Table 8: Data dictionary of Department before normalization

Page | 5
19031007
CS5051NP Database

2 Initial E-R Diagram

Figure 1: Initial Entity Relation Diagram

Page | 6
19031007
CS5051NP Database

3 Normalization

Normalization a database design technique. Normalize organizes data in database.


It helps minimize data redundancy. The purpose of normalization in database is to eliminate
repitative data.
There are various forms of normalization. Some of them are:
 UNF
 1NF
 2NF
 3NF
Following assumptions were taken into consideration before normalizing:
 A college contains many courses.
 One student can enroll in only one course.
 One course can have any number of students.
 One course contains many specifications.
 One specification contains many modules.
 One module can fall under different specifications.
 One instructor can be associated only in one course.
 One instructor can be be leader of only one course.
 One instructor can teach many modules.
 One module can be taught by many instructors.
 For each course, there is a course leader.
 For each module there is a particular class.
 One class can be suitable for many modules.
 Department is assumed to manage college activities.

3.1 UNF
UNF stand for unnormalized form. In this form repeating and non repeating groups are
seperated. Repeating groups are separated by keeping them inside curly brackets {}.

Page | 7
19031007
CS5051NP Database

The UNF table of ICP college is as follows:


Person (P_ID, P_FNAME, P_ FNAME, P_Age, P_Gender, P_Contact, P_Email,
P_HouseID, P_Street, P_City, P_Province, P_CountryName, P_fax, S_ID, S_DOJ,
S_Marks, I_ID, I_Salary, D_ID, D_Name, D_Type{C_ID, C_Name, C_Cost, C_Leader,
C_Duration, C_Credit, SP_ID, SP_Name, M_ID, M_Name, M_Leader, M_Level,
M_Duration, M_Credit, CL_ID, CL_Name})

3.2 1NF
1NF stands for First Normal Form. The rules of 1NF is to separate repeating groups by
keeping them in a different list as shown below.
The 1NF table of ICP college is as follows:
Person (P_ID, P_FNAME, P_ FNAME, P_Age, P_Gender, P_Contact, P_Email,
P_HouseID, P_Street, P_City, P_Province, P_CountryName, P_fax, S_ID, S_DOJ,
S_Marks, I_ID, I_Salary, D_ID, D_Name, D_Type)

Course (C_ID, C_Name, C_Cost, C_Leader, C_Duration, C_Credit, SP_ID, SP_Name,


M_ID, M_Name, M_Leader, M_Level, M_Duration, M_Credit, CL_ID, CL_Name)

3.3 2NF
2NF stands for Second Normal Form. They key rule of 2NF is to remove partial
dependencies. Similarly it should also be in 1nf.
Person
 Identifying PD:
P_ID -> P_ID P_FNAME, P_ FNAME, P_Age, P_Gender, P_Contact, P_Email,
P_HouseID, P_Street, P_City, P_Province, P_CountryName, P_fax
P_ID -> D_ID, D_Name, D_Type

 Identifying FFD:
S_ID ->
I_ID ->
P_ID, S_ID -> S_DOJ, S_Marks
P_ID, I_ID -> I_Salary

Course
Page | 8
19031007
CS5051NP Database

 Identifying PD:
C_ID -> C_Name, C_Cost, C_Leader, C_Duration, C_Credit
SP_ID -> SP_Name,
M_ID -> M_Name, M_Leader, M_Level, M_Duration, M_Credit, CL_ID,
CL_Name

 Identifying FFD:
P_ID, C_ID, SP_ID, M_ID ->
C_ID, SP_ID, M_ID ->

Creating Tables :
Person (P_ID -> P_ID P_FNAME, P_ FNAME, P_Age, P_Gender, P_Contact, P_Email,
P_HouseID, P_Street, P_City, P_Province, P_CountryName, P_fax )
Departmet(P_ID, D_ID, D_Name, D_Type)
Student (P_ID, S_ID -> S_DOJ, S_Marks )
Instructor (P_ID, I_ID -> I_Salary )
Course (C_ID, C_Name, C_Cost, C_Leader, C_Duration, C_Credit)
Specification (SP_ID, SP_NAME)
Module (M_ID, M_Name, M_Leader, M_Level, M_Duration, M_Credit, CL_ID,
CL_Name)
CoueseInfo (P_ID, C_ID, SP_ID, M_ID)
CourseDetails (C_ID, SP_ID, M_ID)

Page | 9
19031007
CS5051NP Database

3.4 3NF
3NF stands for Third Normal Form. A table is said to be in 3NF if it is in 2NF and it
doesn’t have Transitive Dependencies.

Person

 Identifying TD:
P_ID - > P_ID, P_ID P_FNAME, P_ FNAME, P_Age, P_Gender, P_Contact,
P_Email, P_ AddressID
P_AddressID -> P_HouseID, P_Street, P_City, P_Province, P_CountryID, P_fax
P_CountryID -> P_CountryName
P_ID -> AddressID-> CountryID

Module

 Identifying TD:
M_ID -> CL_ID -> CL_Name
M_ID -> M_Name, M_Credit, CL_ID
CL_ID -> Cl_Name

Created Tables:

Country (P_CountryID, P_CountryName )


Address (P_AddressID, P_HouseID, P_Street, P_City, P_Province, P_CountryID, P_fax)
Person (P_ID, P_FNAME, P_ FNAME, P_Age, P_Gender, P_Contact, P_Email, P_
AddressID)
Page | 10
19031007
CS5051NP Database

Student (P_ID, S_ID, S_DOJ, S_Marks)


Instructor (P_ID, I_ID, I_Salary)
Course (C_ID, C_Name, C_Cost, C_Leader, C_Duration, C_Credit)
Specification (SP_ID, SP_Name)
Class (CL_ID, CL_Name)
Module (M_ID, M_Name, M_Leader, M_Credit, Cl_ID)
Departmet(P_ID, D_ID, D_Name, D_Type)
CoueseInfo(P_ID, C_ID, SP_ID, M_ID)
CoueseDetails (C_ID, SP_ID, M_ID)

3.4.1 Data dictionary before normalization

 Data Dictionary of Country


Entities Attributes Constraints Data Type
Country P_CountryID Primary Key VARCHAR(40)
P_CountryName Not Null VARCHAR(40)

Table 9: Data dictionary of Country after normalization

 Data Dictionary of Address


Entities Attributes Constraints Data Type
P_AddressID Primary Key VARCHAR(40)
P_HouseID Not Null INT
Address P_Street Not Null VARCHAR(40)
P_City Not Null VARCHAR(40)
P_Province Not Null VARCHAR(40)
P_CountryID Foreign Key VARCHAR(40)
P_fax UNIQUE KEY VARCHAR(40)

Table 10: Data dictionary of Address after normalization

Page | 11
19031007
CS5051NP Database

 Data Dictionary of Person


Entities Attributes Constraints Data Type
P_ID Primary Key VARCHAR(40)
P_FName Not Null VARCHAR(40)
P_LName Not Null VARCHAR(40)
P_Age Not Null INT
Person P_Gender Not Null INT
P_Contact Not Null INT
P_Email UNIQUE KEY VARCHAR(40)
P_AddressID Foreign Key VARCHAR(40)

Table 11: Data dictionary of Person after normalization

 Data Dictionary of Student


Entities Attributes Constraints Data Type
P_ID Foreign Key VARCHAR(40)
S_ID Primary Key VARCHAR(40)
Student S_DOJ Not Null Date
S_Marks Not Null INT

Table 12: Data dictionary of Student after normalization

 Data Dictionary of Instructor


Entities Attributes Constraints Data Type
P_ID Foreign Key VARCHAR(40)
I_ID Primary Key VARCHAR(40)
Instructor I_Salary Not Null INT

Table 13: Data dictionary of Instructor after normalization

Page | 12
19031007
CS5051NP Database

 Data Dictionary of Course


Entities Attributes Constraints Data Type
C_ID Primary Key VARCHAR(40)
C_Name Not Null VARCHAR(40)
Course C_Cost Not Null INT
C_Leader Not Null VARCHAR(40)
C_Duration Not Null INT
C_Credit Not Null INT

Table 14: Data dictionary of Course after normalization

 Data Dictionary of Specification


Entities Attributes Constraints Data Type
Specification SP_ID Primay Key VARCHAR(40)
SP_Name Not Null VARCHAR(40)

Table 15: Data dictionary of Specification Module after normalization

 Data Dictionary of Class


Entities Attributes Constraints Data Type
Class Cl_ID Primary Key VARCHAR(40)
Cl_Name Not Null VARCHAR(40)

Table 16: Data dictionary of Class after normalization

 Data Dictionary of Module


Entities Attributes Constraints Data Type
M_ID Primary Key VARCHAR(40)
M_Name Not Null VARCHAR(40)
Module M_Leader Not Null VARCHAR(40)
M_Credit Not Null INT
Cl_ID Foreign Key VARCHAR(40)

Table 17: Data dictionary of Module after normalization

Page | 13
19031007
CS5051NP Database

 Data Dictionary of Department


Entities Attributes Constraints Data Type
P_ID Foreign Key VARCHAR(40)
D_ID Primary Key VARCHAR(40)
Department D_Name Not Null VARCHAR(40)
D_Type Not Null VARCHAR(40)

Table 18: Data dictionary of Department after normalization

 Data Dictionary of CoueseInfo


Entities Attributes Constraints Data Type
P_ID Foreign Key VARCHAR(40)
C_ID Foreign Key VARCHAR(40)
PersonEnroll SP_ID Foreign Key VARCHAR(40)
M_ID Foreign Key VARCHAR(40)

Table 19: Data dictionary of CourseInfo after normalization

 Data Dictionary of CoueseDetails

Entities Attributes Constraints Data Type


C_ID Foreign Key VARCHAR(40)
CourseSpecificationModule SP_ID Foreign Key VARCHAR(40)
M_ID Foreign Key VARCHAR(40)

Table 20: Data dictionary of CourseDetails after normalization

Page | 14
19031007
CS5051NP Database

4 Final Entity Relation Diagram

Figure 2: Final Entity Relation Diagram

Page | 15
19031007
CS5051NP Database

5 Database Implementation

5.1 Table Generation

 Creation of User

Figure 3: Creation of User

 Grant Privileges to User

Figure 4: Grant Privileges to User

 Creation of Country Table

Figure 5: Creation of Country Table

Page | 16
19031007
CS5051NP Database

 Description of Country Table

Figure 6: Description of Country Table

 Creation of Address Table

Figure 7: Creation of Address Table

 Description of Address Table

Figure 8: Description of Address Table

 Creation of Person Table

Figure 9: Creation of Person Table

Page | 17
19031007
CS5051NP Database

 Description of Person Table

Figure 10: Description of Person Table

 Creation of Student Table

Figure 11: Creation of Student Table

 Description of Student Table

Figure 12:Description of Student Table

 Creation of Instructor Table

Page | 18
19031007
CS5051NP Database

Figure 13:Creation of Instructor Table

 Description of Instructor Table

Figure 14: Description of Instructor Table

 Creation of Coure Table

Figure 15: Creation of Coure Table

 Description of Coure Table

Figure 16:Description of Coure Table

 Creation of Specification Table

Figure 17: Creation of Specification Table

Page | 19
19031007
CS5051NP Database

 Description of Specification Table

Figure 18: Description of Specification Table

 Creation of Class Table

Figure 19: Creation of Class Table

 Description of Class Table

Figure 20: Description of Class Table

 Creation of Module Table

Figure 21: Creation of Module Table

Page | 20
19031007
CS5051NP Database

 Description of Module Table

Figure 22: Description of Module Table

 Creation of Department Table

Figure 23: Creation of Department Table

 Description of Department Table

Figure 24: Description of Department Table

 Creation of CoueseInfo Table

Page | 21
19031007
CS5051NP Database

Figure 25: Creation of CoueseInfo Table

 Description of CoueseInfo Table

Figure 26: Description of CoueseInfo Table

 Creation of CoueseDetails Table

Figure 27: CoueseDetails Table

 Description of CoueseDetails Table

Figure 28: Description of CoueseDetails Table

Page | 22
19031007
CS5051NP Database

5.2 Populate DB tables

 Inserting values in Country Table

Figure 29: Inserting values in Country Table

 Inserting values in Address Table

Figure 30: Inserting values in Address Table

Page | 23
19031007
CS5051NP Database

 Inserting values in Person Table

Figure 31:Inserting values in Person Table

 Inserting values in Student Table

Figure 32: Inserting values in Student Table

 Inserting values in Instructor Table

Page | 24
19031007
CS5051NP Database

Figure 33: Inserting values in Instructor Table

 Inserting values in Course Table

Figure 34: Inserting values in Course Table

 Inserting values in Specification Table

 Inserting values in Class Table

Page | 25
19031007
CS5051NP Database

Figure 35:Inserting values in Class Table

 Inserting values in Module Table

Figure 36: Inserting values in Module Table

 Inserting values in Department Table

Figure 37: Inserting values in Department Table

 Inserting values in CourseInfo Table

Page | 26
19031007
CS5051NP Database

Figure 38: Inserting values in CourseInfo Table

 Inserting values in CourseDetails Table

Figure 39: Inserting values in CourseDetails Table

5.3 Final Table

 Displaying values of Country Table

Page | 27
19031007
CS5051NP Database

Figure 40: Displaying values of Country Table

 Displaying values of Address Table

Figure 41: Displaying values of Address Table

 Displaying values of Person Table

Page | 28
19031007
CS5051NP Database

Figure 42: Displaying values of Address Table

 Displaying values of Student Table

Figure 43: Displaying values of Student Table

 Displaying values of Instructor Table

Page | 29
19031007
CS5051NP Database

Figure 44: Displaying values of Instructor Table

 Displaying values of Coure Table

Figure 45: Displaying values of Coure Table

 Displaying values of Specification Table

Figure 46: Displaying values of Specification Table

 Displaying values of Class Table

Page | 30
19031007
CS5051NP Database

Figure 47: Displaying values of Class Table

 Displaying values of Module Table

Figure 48: Displaying values of Module Table

 Displaying values of Department Table

Figure 49: Displaying values of Department Table

 Displaying values of CoueseInfo Table

Page | 31
19031007
CS5051NP Database

Figure 50: Displaying values of CoueseInfo Table

 Displaying values of CoueseDetails Table

Figure 51: Displaying values of CoueseDetails Table

6 Database Querying
6.1 Information Query

1. List all the students with all their addresses with their phone numbers.

Page | 32
19031007
CS5051NP Database

Figure 52: Information Query No 1

2. List all the modules which are taught by more than one instructor.

Figure 53: Information Query No 2

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

Page | 33
19031007
CS5051NP Database

Figure 54: Information Query No 3

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

Figure 55: Information Query No 4

5. List the name of the head of modules with the list of his phone number.

Figure 56: Information Query No 5

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

Page | 34
19031007
CS5051NP Database

Figure 57: Information Query No 6

7. List the fax number of the instructor who teaches the ‘database’ module.

Figure 58: Information Query No 7

8. List the specification falls under the BIT course.

Page | 35
19031007
CS5051NP Database

Figure 59: Information Query No 8

9. List all the modules taught in any one particular class.

Figure 60: Information Query No 9

10. List all the Instructors with all their addresses who have ‘a’ at the end of their first names.

Figure 61: Information Query No 10

6.2 Transaction Query

Page | 36
19031007
CS5051NP Database

1. Show the students, course they enroll in and their fees. Reduce 10% of the fees if they
are enrolled in a computing course.

Figure 62: Transaction Query No 1

2. 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.

Figure 63: Transaction Query No 2

Page | 37
19031007
CS5051NP Database

3. Show the name of all the students with the number of weeks since they have enrolled in
the course.

Figure 64: Transaction Query No 3

4. Show the name of the instructors who got equal salary and work in the same
specification.

Figure 65: Transaction Query No 4

Page | 38
19031007
CS5051NP Database

5. List all the courses with the total number of students enrolled course name and the
highest marks obtained.

Figure 66: Transaction Query No 5

6. List all the instructors who are also a course leader.

Figure 67: Transaction Query No 6

Page | 39
19031007
CS5051NP Database

7 Screenshot of dump files

Figure 68: Creating dump file 1

Figure 69: Creating dump file 2

Page | 40
19031007
CS5051NP Database

8 Droping Tables

I. Droping Table Country

Figure 70: Droping Table Country

II. Droping Table Address

Figure 71: Droping Table Address

III. Droping Table Person

Figure 72: Droping Table Person

IV. Droping Table Student

Figure 73: Droping Table Student

Page | 41
19031007
CS5051NP Database

V. Droping Table Instructor

Figure 74: Droping Table Instructor

VI. Droping Table Course

Figure 75: Droping Table Course

VII. Droping Table Specification

Figure 76: Droping Table Specification

VIII. Droping Table Class

Figure 77: Droping Table Class

Page | 42
19031007
CS5051NP Database

IX. Droping Table Module

Figure 78: Droping Table Module

X. Droping Table Department

Figure 79: Droping Table Department

XI. Droping Table CourseInfo

Figure 80: Droping Table CourseInfo

XII. Droping Table CourseDetails

Figure 81: Droping Table CourseDetails

Page | 43
19031007
CS5051NP Database

9 Conclusion

This coursework was provied to us on week 7 . The aim of the coursework was to create a
database system for a college. After creating a database system we were also asked to retrieve
data as requested in the coursework. We were asked to show various information and transaction
queries. I choosed to maked a database system of my own college (ICP). Since I knew a lot of
things about ICP, the corusework didn’t became that hard to do.

This coursework was completely new from all the coursework I’ve done before. But it was also a
lot more practical among them all. I had some problem with running quries during this
coursework. I also had a lot of errors when creating and inserting values in SQL plus. Some of
those errors were due to spelling errors or missing characters. I was able to fix such kind of
problems because SQL plus was very handy to use. It shows error and the line number of error.
For running verious queries I had to go through my lecture and tutorial slides multiple times. I
also had to watch various tutorials in youtube when I was confused on how to write queries. I
would like to thank my module leader and college for providing us with such quality learning
materials and reading environment even at such period of lockdown.

During this coursework I learned a lot of knowledge about keeping and maintaing a database
system of a organization. I learned to use a lot of queries to retrieve data from a database. I also
learned to make relatonal diagram, normalize the tables and insert the values in a database. This
felt so much practical to me. This coursework played a huge role on giving us all students
pratical knowledge of real world scenario. After finishing the coursework I learned a lot of new
things which I didn’t knew before starting it.

Page | 44
19031007

You might also like