0% found this document useful (0 votes)
116 views39 pages

A19 CC5051NP CW1

This document describes the design and implementation of a database for a college. It includes identifying entities and attributes, creating an initial ER diagram, normalizing the database, creating tables, populating the tables with data, and writing queries. The database stores information about countries, addresses, people, students, instructors, courses, classes, and student/course details. The document provides the SQL code to generate the tables, insert sample data, and write queries to retrieve information from the tables.

Uploaded by

SorrY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views39 pages

A19 CC5051NP CW1

This document describes the design and implementation of a database for a college. It includes identifying entities and attributes, creating an initial ER diagram, normalizing the database, creating tables, populating the tables with data, and writing queries. The database stores information about countries, addresses, people, students, instructors, courses, classes, and student/course details. The document provides the SQL code to generate the tables, insert sample data, and write queries to retrieve information from the tables.

Uploaded by

SorrY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Database

CS5051NP
Coursework 1

Submitted By Submitted To
Name: RajThapa Mr. Pratibha Gurung
Group: C4 Module Leader
Date: July 18, 2021 Database
London Met. ID: 19031078
Table of Contents

1 Introduction ................................................................................................................................ 6
1.1 Introduction of the College ................................................................................................. 6
1.2 Current Business Activities and Operations ....................................................................... 7
1.3 Current Business Rules ....................................................................................................... 8
1.4 Identification of Entities and Attributes .............................................................................. 9
2 Initial E-R Diagram .................................................................................................................. 11
3 Normalization ........................................................................................................................... 12
3.1 Unnormalized Normal Form (UNF) ................................................................................. 13
3.2 First Normal Form (1NF) .................................................................................................. 13
3.3 Second Normal Form (2NF) ............................................................................................. 14
3.4 Third Normal Form (3NF) ................................................................................................ 16
4 Data dictionary After normalization......................................................................................... 17
5 Final Entity Relation Diagram.................................................................................................. 20
6 Database Implementation ......................................................................................................... 21
6.1 Table Generation ............................................................................................................... 21
6.2 Populate DB tables ............................................................................................................ 24
6.3 Final Table......................................................................................................................... 27
7 Database Querying ................................................................................................................... 31
7.1 Information Query ............................................................................................................. 31
7.2 Transaction Query ............................................................................................................. 34
8 Screenshot of dump file ............................................................................................................ 37
9 Droping All Tables ................................................................................................................... 38
10 Conclusion ............................................................................................................................ 39
Table Of Figures
Figure 1: Initial Entity Relation Diagram ........................................................................................ 11
Figure 2: Final Entity Relation Diagram.......................................................................................... 20
Figure 3:Creating User and Granting Privileges to User ................................................................. 21
Figure 4:Creation and description of Country Table ....................................................................... 21
Figure 5:Creation and description of Address Table ....................................................................... 21
Figure 6:Creation and description of Person Table ......................................................................... 22
Figure 7:Creation and description of Student Table ........................................................................ 22
Figure 8:Creation and description of Instructor Table ..................................................................... 22
Figure 9:Creation of Course Table ................................................................................................... 22
Figure 10:Description of Course Table ............................................................................................ 23
Figure 11:Creation and description of Specification Table ............................................................. 23
Figure 12:Creation and description of Class Table .......................................................................... 23
Figure 13:Creation and description of Module Table ...................................................................... 23
Figure 14:Creation and description of StudentDetails Table ........................................................... 24
Figure 15:Creation and description of CourseDetails Table ............................................................ 24
Figure 16:Inserting values in Country Table ................................................................................... 24
Figure 17: Inserting values in Address Table .................................................................................. 25
Figure 18: Inserting values in Person Table..................................................................................... 25
Figure 19: Inserting values in Student Table ................................................................................... 25
Figure 20: Inserting values in Instructor Table ................................................................................ 25
Figure 21: Inserting values in Course Table .................................................................................... 26
Figure 22: Inserting values in Specification Table .......................................................................... 26
Figure 23: Inserting values in Class Table ....................................................................................... 26
Figure 24: Inserting values in Module Table ................................................................................... 26
Figure 25: Inserting values in StudentDetails Table ........................................................................ 27
Figure 26: Inserting values in CourseDetails Table ......................................................................... 27
Figure 27: Displaying values of Country Table ............................................................................... 27
Figure 28: Displaying values of Address Table ............................................................................... 28
Figure 29: Displaying values of Person Table ................................................................................. 28
Figure 30: Displaying values of Student Table ................................................................................ 29
Figure 31: Displaying values of Instructor Table ............................................................................ 29
Figure 32: Displaying values of Course Table ................................................................................. 29
Figure 33: Displaying values of Specification Table ....................................................................... 30
Figure 34: Displaying values of Class Table ................................................................................... 30
Figure 35: Displaying values of Module Table ............................................................................... 30
Figure 36: Displaying values of StudentDetails Table .................................................................... 31
Figure 37: Displaying values of CourseDetails Table ..................................................................... 31
Figure 38: Information Query No 1 ................................................................................................. 32
Figure 39: Information Query No 2 ................................................................................................. 32
Figure 40: Information Query No 3 ................................................................................................. 32
Figure 41: Information Query No 4 ................................................................................................. 33
Figure 42: Information Query No 6 ................................................................................................. 33
Figure 43: Information Query No 7 ................................................................................................. 33
Figure 44: Information Query No 8 ................................................................................................. 33
Figure 45: Information Query No 9 ................................................................................................. 34
Figure 46: Information Query No 10 ............................................................................................... 34
Figure 47: Transaction Query No 1 ................................................................................................. 34
Figure 48: Transaction Query No 2 ................................................................................................. 35
Figure 49: Transaction Query No 3 ................................................................................................. 35
Figure 50: Transaction Query No 4 ................................................................................................. 35
Figure 51: Transaction Query No 5 ................................................................................................. 36
Figure 52: Transaction Query No 6 ................................................................................................. 36
Figure 53: Creating dump file .......................................................................................................... 37
Figure 54: Dropping Tables ............................................................................................................. 38
Table Of Tables
Table 1: Un-normalized Person Table ............................................................................................... 9
Table 2: Un-normalized Student Table ............................................................................................ 10
Table 3: Un-Normalized Instructor Table ........................................................................................ 10
Table 4: Un-normalized Course Table ............................................................................................. 10
Table 5: Un-normalized Specification Table ................................................................................... 11
Table 6: Un-normalized Module Table ............................................................................................ 11
Table 7: Normalized Country Table ................................................................................................ 17
Table 8: Normalized Address Table ................................................................................................ 17
Table 9: Normalized Person Table................................................................................................... 17
Table 10: Normalized Student Table ............................................................................................... 18
Table 11: Normalized Instructor Table ............................................................................................ 18
Table 12: Normalized Course Table ................................................................................................ 18
Table 13: Normalized Specification Table ...................................................................................... 18
Table 14: Normalized Class Table ................................................................................................... 19
Table 15: Normalized Module Table ............................................................................................... 19
Table 16: Normalized StudentDetailsTable ..................................................................................... 19
Table 17: Normalized CourseDetailsTable ...................................................................................... 19
CS5051NP Database

1 Introduction
1.1 Introduction of the College
The ING Group's affiliate college, Informatics College Pokhara, was founded in 2011. It
began its academic career as a franchisee of Singapore-based Informatics Education
Limited. Since 2017, Informatics College Pokhara has worked directly with London
Metropolitan University in the United Kingdom to give students in Pokhara with an
exceptional higher education in IT and Business at a reasonable price.
The Ministry of Education in Nepal has certified all of the courses offered by
Informatics College Pokhara as equal to Tribhuvan University in Nepal. As a result,
graduates will be able to work for both public and private organizations across the
world. Furthermore, they have the option of applying for higher education at any
university in the globe. ICP is proud of its exceptional academics, cutting-edge facilities,
and resources that help their students throughout their academic careers. ICP also
aspires to produce graduates who will be sought after by businesses both domestically
and internationally. Furthermore, ICP guarantees that the support you receive from its
staff will be unrivaled and will assist you in achieving your objectives. Informatics
College Pokhara offers direct degrees in Information Technology and Business. The
courses are entirely designed and approved by the London Metropolitan University.
Informatics College Pokhara adopts the internationally practiced lecture-tutorial-
workshop methodology of teaching from the UK education system. This means that the
course delivery is more skill-driven and knowledge-oriented that primarily focuses on
self-learning and research. Students from Informatics College Pokhara get to travel to
Thailand in an all-expense-paid trip to participate in the 15-Day Summer Camp program
at the University of Thai Chamber of Commerce. Informatics College Pokhara offers
state-of-the-art academic and social facilities, to ensure that the students get the best
possible education and have an enjoyable time learning.
Academic Programs:
1. Bachelor’s Degree in Information Technology
BSc (Hons) Computing
2. Bachelors in Business Administration
BBA (International Business)

Page | 6
19031007
CS5051NP Database

BBA (Marketing) with International Business


BBA (Accounting & Finance) with International Business

1.2 Current Business Activities and Operations


Students at Informatics College Pokhara have access to a variety of services and
amenities. Its impact in improving the talents of pupils is beyond praiseworthy due to its
status and administrations. It also emphasizes the significance of collaborating with
students and involve them as active partners in shaping their learning and futures in
order to provide good education.
Undergraduates at Informatics College can take a variety of courses in computing,
marketing, finance, and accounting. Students who want to specialize in the development
and maintenance of current computer-based systems should take the computing course.
The course is divided into four distinct sections. Software development, information
systems, networking and operating systems, and Internet computing systems are the four
categories. The college management follows the norms and regulations of Informatics
College Pokhara in its everyday operations and activities. These guidelines are designed
to guarantee that the institution can best teach its students by maximizing the use of its
limited resources (infrastructure and people).
Each year, the institution enrolls around 150 students; in order to assure excellent
education, students are separated into several groups prior to admission. Each student's
needed information is gathered, recorded into the College Database under Students, and
various courses and facilities are provided for them. Pokhara's Informatics College
includes around 12 courses and 30 faculty members. To help students in many aspects
of their examinations, these infrastructure are separated into three departments: RTE,
Student Services, and Finance.

19031078 Page | 7
CS5051NP Database

1.3 Current Business Rules


For agents and clients, Informatics College Pokhara has a few standards and business
techniques. Organizational authorities, strategy designers, and a few public authority
principles all contribute to these standards. All academics associated with this
organization should carefully follow these standards. The following is a list of business
rules for each:
For Students:

• To participate in the program, students must enroll in one of the required courses.
• Students are required to be familiar with and follow the University's rules and
regulations.
• Students should come to class prepared and on time, engage actively, and respect the
rights of other students to study.
• All students are expected to understand the objectives and purpose of the coursework
and exams and plan their respective studies accordingly.
• Students must submit their work on time, participate in feedback, and use that
information into their following exams.
• All students must provide their current and accurate contact and personal
information.

For Instructors:

• All teachers must dress appropriately for the occasion, as dictated by the institution; if
someone fails to do so, he or she will not be permitted to teach that day.
• All teachers should be available during their scheduled hours; in the event of an
emergency, an obligatory consent letter informing the cause three days in advance is
necessary.
• All employees should bring their identification, which they will provide to authorities
if an incident of interest occurs.
• All instructors must provide their current and accurate contact and personal
information.

19031078 Page | 8
CS5051NP Database

1.4 Identification of Entities and Attributes


The backbone of an ER diagram is an entity, which is made up of any item, idea,
event, place, or other data recorded in the database. It might also be an actual object
that appears in our database. It should, in theory, be uniquely identifiable in the
database based on its features (also known as attributes) and a unique key. Attributes
are used to investigate an entity by specifying all of its qualities. Typically, it is a
single attribute that investigates an object and informs us about the type of data it
contains.
The major objective of this project is to create a normalized database for an
Informatics Collage in Pokhara, which requires the identification of numerous entities
and characteristics. As a result of the aforementioned report's many components, such
as introduction, business activities, business operation, and business rules, multiple
entities and qualities have been recognized. Initially, seven entities were discovered
and formed, each with its own set of properties. Person, Student, Instructor, Course,
Specification, Module, and Class are the terms used.
Entities and attributes used in coursework to draw a database system of Informatics
Collage Pokhara are given below:
• Person
Person is the main entity of this coursework which has a relation with multiple entities.
Attributes of person entity are PersonID,
PersonName, Age, PhoneNo, Gender, HouseNo, Street, City, Province, Country and
FaxNumber. Here, PersonID acts as a primary key.

Table 1: Un-normalized Person Table


Entities Attributes Constraints Data Type
PersonID Primary Key VARCHAR(10)
PersonName Not Null VARCHAR(30)

Age Not Null INT

PhoneNo Not Null VARCHAR(20)


Person
Gender Not Null VARCHAR(20)

19031078 Page | 9
CS5051NP Database

City Not Null VARCHAR(20)

Street Not Null VARCHAR(20)

HouseNo Not Null INT

Province Not Null INT

Country Not Null VARCHAR(20)

FaxNumber Not Null VARCHAR(20)

• Student
Student entity is the list of details of student admitted students in the collage. The
attributes of students are StudentID (PK), EnrollDate and Marks.

Table 2: Un-normalized Student Table


Entities Attributes Constraints Data Types
Student StudentID Primary Key VARCHAR(10)
EnrollDate Date Date
Marks Not Null INT

PersonID Foreign Key VARCHAR(10)

Table 3: Un-Normalized Instructor Table


Entities Attributes Constraints Data Types
Instructor InstructorID Primary Key VARCHAR(10)
PersonID Foreign Key VARCHAR(10)
Salary Not Null INT

Table 4: Un-normalized Course Table


Entities Attributes Constraints Data Types
Course CourseID Primary Key VARCHAR(10)
CourseTitle Not Null VARCHAR(40)
CourseLeader Not Null VARCHAR(20)
Fees Not Null INT

CourseCredit Not Null INT

19031078 Page | 10
CS5051NP Database

Table 5: Un-normalized Specification Table

Entities Attributes Constraints Data Type


Specification SpecID Primary_Key Number (10)
SpecName Not Null Varchar (25)

Table 6: Un-normalized Module Table


Entities Attributes Constraints Data Types
Module ModuleID Primary Key VARCHAR(10)
ClassID Foreign Key VARCHAR(10)
ModuleName Not Null VARCHAR(20)

ModuleLeader Not Null VARCHAR(20)

CreditHours Not Null INT

2 Initial E-R Diagram

Figure 1: Initial Entity Relation Diagram

19031078 Page | 11
CS5051NP Database

3 Normalization
The practice of arranging the fields and tables of a relational database to reduce
redundancy and dependence is known as database normalization. Normalization is
breaking down huge tables into smaller (and less redundant) tables and establishing links
between them. The goal is to isolate data such that field additions, removals, and updates
may be done in a single table and then propagated across the database using established
relationships.
Table data can be normalized to remove redundancies and inconsistencies. It's the process
of condensing tables into a collection of columns in which all non-key columns are
dependent on the primary key column. If this is not the case, data changes may result in
inconsistencies.
Normalization rules are divided into following normal forms:
• Unnormalized Normal Form (UNF)
• First Normal Form (1NF)
• Second Normal Form (2NF)
• Third Normal Form (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.

19031078 Page | 12
CS5051NP Database

• Department is assumed to manage college activities.

3.1 Unnormalized Normal Form (UNF)


To eliminate redundancies and inconsistencies, table data can be standardized. It is the
process of condensing tables into a set of columns in which all non-key columns rely
on the primary key column. If this is not the case, discrepancies may arise as a result
of data changes.
Figure 1 shows the data from the database, which shows that it consists of 10 entities
and their characteristics, as well as recurring data and groups. As a result, the repeated
data and repeating groups must be recognized and separated, which may be done in an
unnormalized database using curly brackets. The data in the UNF is unnormalized, and
there may be data redundancy or anomalies on the table. To decrease data redundancy
and anomalies, after segregating the repeating groups for provided repeating data, it
must be transmitted to 1NF.

The unnormalized normal form of Informatics College Pokhara is given below:


Person (PersonID, PersonName, Age, PhoneNo, Email, Gender, HouseNo, Street,
City, Province, Fax_Number, Country, StudentID, InstructorID, Salary, { CourseID ,
CourseTitle, CreditHours, CourseLeader, Fees, SpecID, SpecName, ModuleID,
ModuleName, CreditHours, ModuleLeader, })

3.2 First Normal Form (1NF)


There are no repeated groups in the first normal form since only single values are
allowed at the intersection of each row and column. Remove the repeating group and
establish two new relations to normalize a connection with a repeating group.
For unique identification, the new relation's Primary Key is a combination of the old
connection's Primary Key and an attribute from the newly formed relation. A table of
first normal form should include only single(atomic) valued attributes/columns, values
recorded in each column should be of the same domain, and each column should have
a unique name.

19031078 Page | 13
CS5051NP Database

Person entity serves as repeating data for Course entity, and Course entity serves as a
repeating group of Person table in this collage. As a result, a new table titled Course1
was created. One new table was created from the Person table in the first normal form,
resulting in two tables in the 1NF. The following are the 1NF's final tables:
Person1 (PersonID, PersonName, Age, PhoneNo, Gender, HouseNo, Street, City,
Province, Country, FaxNumber, StudentID, InstructorID, Salary, ClassID, ClassName)

Course1 (PersonID, CourseID , CourseTitle, CourseLeader, CreditHours,


Fees, SpecID, SpecName, ModuleID, ModuleName, CreditHours, ModuleLeader,
ClassID, ClassName)

3.3 Second Normal Form (2NF)


The relation must first be in 1NF for the second normal form. If and only if, the PK
contains a single attribute, the relation is automatically in 2NF. If the relation contains
a composite PK, each non-key property must be entirely reliant on the entire PK, not
just a subset of it (i.e., no partial reliance or augmentation).

Checking for partial dependency

For Person1 (PersonID, PersonName, Age, Gender, PhoneNo, HouseNo, Street, City,
Province, Country, FaxNumber, StudentID, InstructorID, Salary)

PersonID ---- > PersonName, Gender, Age, PhoneNumber,


Email_Address, HouseNumber, Street, City, Province, Country, FaxNumber
StudentID ---->
InstructorID ---->
PersonID, StudentID ----> EnrollDate, Marks
PersonID, InstructorID ----> Salary

For Course1 (PersonID, CourseID , CourseTitle, CreditHours, CourseLeader, Fees,


Specification_id, SpecName, ModuleID, ModuleName, CreditHours, ModuleLeader,
ClassID, ClassName)

19031078 Page | 14
CS5051NP Database

CourseID ----> CourseTitle, CreditHours, CourseLeader, Fees


SpecID ----> SpecName
ModuleID ----> ModuleName, CreditHours, ModuleLeader, ClassID, ClassName
PersonID, CourseID, SpecID, ModuleID ---->
CourseID, SpecID, ModuleID ---->

Because such tables had partial dependencies, they were further split into new tables
based on the relationship between the composite key, main key, and non-keys. The
newly created tables are listed below, along with their associated characteristics.
Person-2 (PersonID, PersonName, Gender, Age, PhoneNumber, HouseNo, Street,
City, Province, Country, FaxNumber)

Student-2 (PersonID, StudentID, EnrollDate, Marks)

Instructor-2 (PersonID, InstructorID, Salary)

Course-2 (CourseID, CourseTitle, CreditHours, CourseLeader, Fees)

Specification-2 (SpecID, SpecName)

Module-2 (ModuleID, ModuleName, CreditHours, ModuleLeader, ClassID,


ClassName)

Student_Details-2 (PersonID, CourseID, SpecificationID, ModuleID)

Course_Details-2 (CourseID, SpecificationID, ModuleID)

19031078 Page | 15
CS5051NP Database

3.4 Third Normal Form (3NF)


The table holding the transitive dependency is identified and deleted in the third
normal form, and a new entity is constructed to remove the transitive dependency
while maintaining complete functional reliance between the keys.
Removing Transitive dependency

For Person2 (PersonID, PersonName, Gender, Age, PhoneNumber, , HouseNumber,


Street, City, Province, Country, FaxNumber)
PersonID ---- > PersonName, Gender, Age, PhoneNumber, , AddressID
AddressID ----> House_Id, Street, City, Province, CountryID, FaxNumber
CountryID ----> CountryName
PersonID ----> AddressID ----> CountryID

For Module2 (ModuleID, ModuleName, CreditHours, ModuleLeader, ClassID,


ClassName)
ModuleID ----> ModuleName, CreditHours, ClassID
ClassID ----> ClassName

Hence, a different table are formed after reducing the transitive dependency from 2NF.
List of the table formed is given below:

Person-3 (PersonID, PersonName, Gender, Age, PhoneNo, AddressID)


Address-3 (AddressID, HouseNo, Street, City, Province, CountryID, FaxNumber)
Country-3 (CountryID, CountryName)
Student-3 (PersonID, StudentID, EnrollDate, Marks)
Instructor-3 (PersonID, InstructorID, Salary)
Course-3 (CourseID, CourseTitle, CreditHours, CourseLeader, Fees)
Specification-3 (SpecID, SpecName)
Module-3 (ModuleID, ModuleName, CreditHours, ModuleLeader, ClassID)
Class-3 (ClassID, ClassName)

19031078 Page | 16
CS5051NP Database

Student_Details-3 (PersonID, CourseID, SpecID, ModuleID) CourseDetails-3


(CourseID, SpecID, ModuleID)

4 Data dictionary After normalization


Table 7: Normalized Country Table

Entities Attributes Constraints Data Type


Country CountryID Primary Key VARCHAR(10)
CountryName Not Null VARCHAR(20)

Table 8: Normalized Address Table


Entities Attributes Constraints Data Type
AddressID Primary Key VARCHAR(10)
City Not Null VARCHAR(20)
Address Street Not Null VARCHAR(20)
HouseNo Not Null INT
Province Not Null INT
FaxNumber Not Null VARCHAR(20)
CountryID Foreign Key VARCHAR(10)

Table 9: Normalized Person Table


Entities Attributes Constraints Data Type

PersonID Primary Key VARCHAR(10)

PersonName Not Null VARCHAR(30)

Person
Age Not Null INT

Gender Not Null VARCHAR(20)

PhoneNo Not Null VARCHAR(20)

AddressID Foreign Key VARCHAR(10)

19031078 Page | 17
CS5051NP Database

Table 10: Normalized Student Table


Entities Attributes Constraints Data Types
Student StudentID Primary Key VARCHAR(10)
EnrollDate Date Date
Marks Not Null INT

PersonID Foreign Key VARCHAR(10)

Table 11: Normalized Instructor Table


Entities Attributes Constraints Data Type
PersonID Foreign Key VARCHAR(10)
InstructorID Primary Key VARCHAR(10)
Instructor
Salary Not Null INT

Table 12: Normalized Course Table


Entities Attributes Constraints Data Type
CourseID Primary Key VARCHAR(10)
CourseTitle Not Null VARCHAR(40)
Course
CourseLeader Not Null VARCHAR(20)

Fees Not Null INT

CourseCredit Not Null INT

Table 13: Normalized Specification Table


Entities Attributes Constraints Data Type
Specification SpecID Primay Key VARCHAR(10)
SpecName Not Null VARCHAR(40)

19031078 Page | 18
CS5051NP Database

Table 14: Normalized Class Table


Entities Attributes Constraints Data Type
Class ClassID Primary Key VARCHAR(10)
ClassName Not Null VARCHAR(40)

Table 15: Normalized Module Table


Entities Attributes Constraints Data Type
ModuleID Primary Key VARCHAR(10)
ModuleName Not Null VARCHAR(20)
Module ModuleLeader Not Null VARCHAR(20)
CreditHours Not Null INT
ClassID Foreign Key VARCHAR(10)

Table 16: Normalized StudentDetailsTable


Entities Attributes Constraints Data Type
PersonID Foreign Key VARCHAR(10)
CourseID Foreign Key VARCHAR(10)
StudentDetails SpecID Foreign Key VARCHAR(10)
ModuleID Foreign Key VARCHAR(10)

Table 17: Normalized CourseDetailsTable


Entities Attributes Constraints Data Type
CourseID Foreign Key VARCHAR(10)
CourseDetails SpecID Foreign Key VARCHAR(10)
ModuleID Foreign Key VARCHAR(10)

19031078 Page | 19
CS5051NP Database

5 Final Entity Relation Diagram

Figure 2: Final Entity Relation Diagram

19031078 Page | 20
CS5051NP Database

6 Database Implementation
6.1 Table Generation
• Creation of User and Grant Privileges to User

Figure 3:Creating User and Granting Privileges to User

• Creation and description of Country Table

Figure 4:Creation and description of Country Table

• Creation and description of Address Table

Figure 5:Creation and description of Address Table

19031078 Page | 21
CS5051NP Database

• Creation and description of Person Table

Figure 6:Creation and description of Person Table

• Creation and description of Student Table

Figure 7:Creation and description of Student Table

• Creation and description of Instructor Table

Figure 8:Creation and description of Instructor Table

• Creation of Course Table

Figure 9:Creation of Course Table

19031078 Page | 22
CS5051NP Database

• Description of Course Table

Figure 10:Description of Course Table

• Creation and description of Specification Table

Figure 11:Creation and description of Specification Table

• Creation and description of Class Table

Figure 12:Creation and description of Class Table

• Creation and description of Module Table

Figure 13:Creation and description of Module Table

19031078 Page | 23
CS5051NP Database

• Creation and description of StudentDetails Table

Figure 14:Creation and description of StudentDetails Table

• Creation and description of CourseDetails Table

Figure 15:Creation and description of CourseDetails Table

6.2 Populate DB tables


• Insert values into Country Table

Figure 16:Inserting values in Country Table

19031078 Page | 24
CS5051NP Database

• Inserting values in Address Table

Figure 17: Inserting values in Address Table

• Inserting values in Person Table

Figure 18: Inserting values in Person Table

• Inserting values in Student Table

Figure 19: Inserting values in Student Table

• Inserting values in Instructor Table

Figure 20: Inserting values in Instructor Table

19031078 Page | 25
CS5051NP Database

• Inserting values in Course Table

Figure 21: Inserting values in Course Table

• Inserting values in Specification Table

Figure 22: Inserting values in Specification Table

• Inserting values in Class Table

Figure 23: Inserting values in Class Table

• Inserting values in Module Table

Figure 24: Inserting values in Module Table

19031078 Page | 26
CS5051NP Database

• Inserting values in StudentDetails Table

Figure 25: Inserting values in StudentDetails Table

• Inserting values in CourseDetails Table

Figure 26: Inserting values in CourseDetails Table

6.3 Final Table


• Displaying values of Country Table

Figure 27: Displaying values of Country Table

19031078 Page | 27
CS5051NP Database

• Displaying values of Address Table

Figure 28: Displaying values of Address Table

• Displaying values of Person Table

Figure 29: Displaying values of Person Table

19031078 Page | 28
CS5051NP Database

• Displaying values of Student Table

Figure 30: Displaying values of Student Table

• Displaying values of Instructor Table

Figure 31: Displaying values of Instructor Table

• Displaying values of Course Table

Figure 32: Displaying values of Course Table

19031078 Page | 29
CS5051NP Database

• Displaying values of Specification Table

Figure 33: Displaying values of Specification Table

• Displaying values of Class Table

Figure 34: Displaying values of Class Table

• Displaying values of Module Table

Figure 35: Displaying values of Module Table

19031078 Page | 30
CS5051NP Database

• Displaying values of StudentDetails Table

Figure 36: Displaying values of StudentDetails Table

• Displaying values of CoueseDetails Table

Figure 37: Displaying values of CourseDetails Table

7 Database Querying
7.1 Information Query
1. List all the students with all their addresses with their phone numbers.

19031078 Page | 31
CS5051NP Database

Figure 38: Information Query No 1

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

Figure 39: Information Query No 2

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

Figure 40: Information Query No 3

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

19031078 Page | 32
CS5051NP Database

Figure 41: Information Query No 4

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

Figure 42: Information Query No 6

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

Figure 43: Information Query No 7

7. List the specification falls under the BIT course.

Figure 44: Information Query No 8

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

19031078 Page | 33
CS5051NP Database

Figure 45: Information Query No 9

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

Figure 46: Information Query No 10

7.2 Transaction Query

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 47: Transaction Query No 1

19031078 Page | 34
CS5051NP Database

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 48: Transaction Query No 2

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

Figure 49: Transaction Query No 3

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

Figure 50: Transaction Query No 4

19031078 Page | 35
CS5051NP Database

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

Figure 51: Transaction Query No 5

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

Figure 52: Transaction Query No 6

19031078 Page | 36
CS5051NP Database

8 Screenshot of dump file

Figure 53: Creating dump file

19031078 Page | 37
CS5051NP Database

9 Droping All Tables

Figure 54: Dropping Tables

19031078 Page | 38
CS5051NP Database

10 Conclusion
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. Initially before
starting the coursework, I had the mixed feeling of curiosity and fear. With the
previous knowledge on oracle database and SQL, I had the curiosity about how it can
be integrated in the applications because we had only learned to design and implement
the database in the terminal window in the third semester of the course. I thought it
would be very hard for me to adapt this programming language but with the
continuous guidance from the module leader and try outs, I found out that
programming in database is not hard as I thought.
This assignment was unlike any other Coursework I'd ever done before. But it was also
the most practical of the bunch. During this class, I had considerable difficulty running
queries. In SQL Plus, I also got a number of problems when generating and inserting
data. Some of the mistakes were caused by misspelled words or missing letters.
Because SQL plus was so easy to use, I was able to solve such issues. It displays the
error as well as the line number on which the mistake occurred. I had to go over my
lecture and tutorial slides several times in order to execute various queries.
Throughout this coursework, I gained a great deal of knowledge about how to preserve
and maintain a company's database system. I learnt how to obtain data from a database
using a variety of queries. I also learnt how to draw a relational diagram, how to
normalize tables, and how to enter data into a database. This seemed really practical to
me. This coursework was essential in providing us with practical understanding of
real-world scenarios. I learnt a lot of new stuff after completing the program that I
didn't know before.

19031078 Page | 39

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy