Top Banner
DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE Database Report Jordan Pountley 12009102 Stewart Blakeway
89
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Database report

DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE

Database Report

Jordan Pountley

12009102

Stewart Blakeway

Page 2: Database report

2

Table of Contents

Table of Contents ................................................................................................................ 2

1. Introduction .................................................................................................................... 2

2. History of databases ........................................................................................................ 3

2.1 Flat file database model ............................................................................................ 3

2.2 Hierarchical database model..................................................................................... 4

2.3 Relational database model........................................................................................ 5

2.4 Network database model .......................................................................................... 6

2.5 Object-Oriented database model .............................................................................. 6

3 Scenario ............................................................................................................................ 7

3.1 Requirements ............................................................................................................ 9

3.2 Business Operations ................................................................................................ 11

3.3 Business Rules ......................................................................................................... 13

4 Conceptual Design ......................................................................................................... 16

4.1 Conceptual diagram ................................................................................................ 20

4.2 Entity Relationships ................................................................................................. 20

4.3 Diagram script ......................................................................................................... 25

5 Logical Design ................................................................................................................. 28

6 Normalisation ................................................................................................................. 30

6.1 Cumulative design ................................................................................................... 30

7 Implementation ............................................................................................................. 38

7.1 Field attributes ........................................................................................................ 38

7.2 SQL Implementation ............................................................................................... 47

8 Security and Contingency .............................................................................................. 57

9. Testing ........................................................................................................................... 66

10. GUI .............................................................................................................................. 76

References ......................................................................................................................... 87

1. Introduction The following is a full database report for a company called Ace Training this report will give information on the background of databases and why they are important, it will also then inform the reader on the steps to creating a database from beginning to end starting with figuring out the problems and understanding the company background and requirements, which will then be processed into diagrams, implementation and finally the overall design of the database interface, each chapter will give clear definitions, information and understanding for the reader.

Page 3: Database report

3

2. History of databases Our lives are full of different types of information and because of computer

databases which interact with information more easily every day, but even before

the computer age databases were used to store information, things like ship

manifests, card catalogues and product inventory are all databases and then the

computer allowed databases to be automated early stages of computer

databases where flat files this was very simple and the records where a

consecutive list, there was a disadvantage to this method because the computers

had to search at the beginning of the list and search sequentially this wasn’t a

very effective way to search and maintain large amount of records as if would be

very slow.

It was in the 1960’s when IBM created the hierarchical database model for

their information management system to improve the previous way of searching it

was a treeline structure which pointed to child nodes from parent nodes, then a

more flexible network model was designed by a man named Charles Bachman

who made it so that the child nodes could be pointed at by more than one parent

node but this would prove confusing due to all the pointers when the database

grew.

In 1970 a database structure called the relational database model was

proposed by a man named Ted Codd who was a computer scientist at IBM, this

model organised a body of data into simple tables of related information this

meant that no more pointers where needed because the tables where only

connected by have the same data fields which proved to be very useful as it

made it easier to access, merge and even change data, This idea was then used

by Michael Stonebraker and his team in 1973 to create the INGRES relational

which was used as a basis by several large companies for successful

commercial products.

It wasn’t until 1975 when IBM came up with a relational database called

system R and it used a structured query language. In 1977 a man named Larry

Ellison who liked Ted Codds idea of the relational database took a big interest in

it and started his own business called ‘Oracle’ in which he designed a new

relation model that would be commercially available and also compatible with

IBM’s system R. (Rodgers-Ostema, 2004)

Page 4: Database report

4

2.1 Flat file database model

What is a flat file database? a flat file database is defined as an information structure that stores data in a simple two-dimensional format and with a flat file database information is stored in one long text file which is called a delimited file, and a delimited file is a special type of text file used as a data transfer from one computer to another, delimiters replace vertical lines between columns for example commas and tab stops and then each record is terminated by a character which is usually a carriage return and line feed.

Every entry made on the flat file e.g. ‘Place’ would be separated by a special character and each entry contains multiple pieces of information AKA ‘fields’ and then all this information is then grouped together to create a record. Users are able to set flat file database tables in numerous application types which include HTML documents and word processing and worksheets, this human-readable format works great for the simple sets of information but when it comes to the sets that are far more complex the best course of action would be to use a relational database, within the flat file database the tables are able to be organised based on column values, these tables are used as a simple solution for database tasks.

The flat file has a disadvantage to other database models as it has many limitations, but they are still used within different kinds of applications on a user’s computer it is used to store data related configuration, and these applications allow users to store and then retrieve information depending on their pre-defined set of fields from flat files. They do feature datatypes that are similar to other databases such as the database management system and separated columns as the database is based on fixed-width data formatting. (P.K singh 2009 pg 27).

2.2 Hierarchical database model

The Hierarchical database model created by IBM is generally used on mainframe

computers and they have been about since the mid-1960s its considered to be

one of the oldest methods of organizing and data storage and is still used today

by small businesses and things such as making travel reservations, the

hierarchical database is designed like a pyramid and the pointers are reaching

downwards for example there will be higher level records and also lower level

records this means that they will be above the child nodes below.

At the very top of the hierarchical model or (pyramid) there is the parent

record which is also named the root record and in the model the child node only

has one parent pointing to it and they will be linked and parent can be pointed at

numerous children which are also linked. The child nodes in the database model

can themselves become parent nodes as the way that the model works is from

top down and when searching for a record it is operated by starting at the very

Page 5: Database report

5

top and working down through the pyramid from parent to child until the

applicable child record is discovered.

The hierarchical database has a strong advantage in that is can be

accessed and updated immediately due to its structure and the relationships

between the records are defined in advance, but its advantage can also be its

disadvantage as the child nodes are only able to have one parent and users are

unable to link two child nodes together even if users look at it logically and it

could work to have a relationship between two child nodes and due to the

adamant design of the hierarchical model if users want to add a new field or

record it would require users to redefine the whole database. (P.K singh 2009 pg

27-28).

2.3 Relational database model

The relational database was first put forward in 1970 by Tedd Codd and rather

than being hierarchical the relationships between data files are in fact relational

which if different to a hierarchical database model because users have to pass

down hierarchy to find what kind of data users are searching for but with the

relational model users actually connect the data in different files by using

common data elements or a key field. The way that the data is stored in a

relational database is in different tables and each one has a key field this way the

rows can be identified uniquely, the relational database is much more flexible

than its competition the hierarchical database and the network database.

he way the relational database works is that there is key field for each

individual table and this uniquely identifies each row this can then be used to

connect two tables of data to one another for example if users have a one table

that had a customer account number as the key field along with other data like

age and address the customer account number in this table is then able to be

linked to another table of data that also has the customer account number known

as the key field but this table could contain information about something else

entirely like product information which could include item number and this would

also be a key field which can be then also linked to another table which contains

item number and then more information about products such as price, size,

quality etc... So by using his data model users are very easily able to link

customer information with product information.

he relational database is one of the most popular ways to store data due

to two major reasons them being that due to how user friendly it is users can use

it even if users had little training and sometimes even no training at all, and the

fact that when the user is entering data they can be easily modified without

compromising the whole structure of the model where users may have to

Page 6: Database report

6

redefine it all, there are however some drawbacks from using the relational

database one being the hardware it requires as the relational database systems

need to have more powerful hardware computers and larger storage devices this

way the system can run smoothly. (J. Glenn Brookshear, 2012 pg 400-407) (P.K

singh 2009 pg 30-35).

2.4 Network database model

The network model was created by charles bachman in 1969 with the

hierarchical database in mind he wanted to enhance it and make it more flexible

and easier to understand this was done by creating multiple links to the owner file

the model organises data by using 2 main constructs and these are named

records and sets, records have fields and the sets define relationships between

the records e.g. 'one-to-many' the model allows linkages between multiple

records to the same owner file. The model is designed so that the owner is at the

bottom and it looks like an upside down tree and the members are linked to the

owner.

The network model is popular today because of its high speed retrieval

and how easy it is to understand as the model itself is simple and users are able

to design it without finding it difficult one major advantage the network database

has is its ability to handle one-to-many relationships as well as many-to-many

relationships users can also change data characteristics and it will not affect the

application program.

Some drawbacks for the network model is the fact that data can only be

accessed one record at a time this means that if a user where to use this model

they would have to make sure that the database designers, admins and

programmers are all able to recognise and understand the internal data

structures this way they are able to gain access to the data they want, this means

that users are unfortunately unable to create a user friendly database

management system, alongside this making modifications to the database

proves to be very difficult as a result of the data access method being

navigational. (P.K singh 2009 pg 30).

2.5 Object-Oriented database model

The object-oriented model is different to the network and hierarchical models

because this model handles new data types which includes graphics, photos,

audio and video therefore its more advanced because the network and

hierarchical models are made to handle small structured data like ID number,

name, age etc... and this data is inserted into fields, rows and columns. The

object-oriented model stores many multimedia types of data and the work is

Page 7: Database report

7

produced as an output.

within the database objects are used and these objects are small reusable

parts of software, With the object there are 2 main aspects one being a piece of

data which would consist of sound, video, graphics etc... and the second would

be the instructions or the software programs named methods and these methods

are able to manage what to do with the given data.

Even though the object-oriented database is very advanced when it

comes to the data it stores there are some disadvantages one being the obvious

and thats the cost as to develop the database would cost alot more than it would

for the other database models mentioned, another is due to how the other

models have been around longer companies are hesitant to change the database

they currently have and have developed as they have probably invested alot of

money into it, but the object-oriented database is so advanced it would be perfect

and vastly for many different types of companies. (J. Glenn Brookshear, 2012 pg

415) (P.K singh 2009 pg 36-37).

This concludes the chapter about different types of databases available as well

as their history, the next chapter in the report will explain the scenario of Ace

Training and the requirements that are needed for the database as well as the

business rules and operations.

3 Scenario

This Section will give background information about the company Ace training it will also give a better insight as to how the business works and what problems need to be ironed out.

Ace Training is a business that deals with teaching certain courses and is in need of a database system this way they can record details of students, tutors and other different kinds of data, The students that have chosen to enrol onto a course or courses at ace training, a student will be able to enrol onto a chosen course using three different methods, one being by a list that will be uploaded by a tutor another would be using an online form by the tutor and lastly they can enrol by going online themselves and inputting there details but this will need to be authorised by a tutor, with the use of a database the students details can be stored these details will consist of Their first and second name, then their address including postcode and town or city, their next of kin details, course or courses they have chosen to enrol on, the fees that have been paid, their date of birth and finally their email address, if the student happens to be an international student then the visa expiry date and passport will also need to be included.

Page 8: Database report

8

As well as students there will be tutors who will have more privileges when it comes to the database as the students will have very restrictive access to certain parts of the database to prevent misuse, the tutors will be created by administrators but before they can be added there credentials have to be thoroughly checked, then that tutor will have to register as a tutor to become a course tutor when registering the tutor needs to fill in certain details the same as the student they will need to enter their first and second name, their address including postcode and town or city, their next of kin details, their office number, extension number, date of birth, email address and lastly their national insurance number.

Due to tutors having more privileges it means that they are granted to do certain things students are not such things as being able to store resources within the database for their each individual course the resources will be things such as presentations and other documents that the students might need or find helpful, and once stored they can either be made available to students or not available until a certain date has been reached this allows the students to focus on work they are currently learning about rather than skipping ahead to other material, and the resources are also able to be transferred to other tutor on other courses should the tutor think that it is needed.

With the database there should also be a mechanism in place that allows online assessments for the students in the form of different types of quizzes such as multiple choice and true or false for each individual course, once the quizzes have been taken there should then be a record kept with each student that has completed certain quizzes along with what they scored on the quizzes they had took and that student should be allowed to view their own quiz score to get a better understanding of the material and see where and if they went wrong, the tutor must also know each students on his courses score on the quizzes then they are able to give that student feedback on how they may be able to improve their score next time, and it is imperative that no other students see the scores of another student as some students may want their score kept secret between them and the tutor.

Ace training also want there to be a progress bar in place for students so they are able to see how their students are progressing through the course this will allow tutors to step in if certain students are not progressing as well as the other students and give them help if they desire it, ace training also would like knowledge bar in place so that they are able to see how much their students understand the course they are taking.

The database needs to be made so that details of both the students and staff on the database cannot be deleted but instead their details will stay on the system with either unregistered for students or left for the tutors this way there will be no confusion and if said student or tutor end up coming back for any kind of reason then it makes it a lot easier to reinstate them to the database, when it comes to the courses that are available there should be a way to delete them for reasons such as inactivity for a long period of time this will also save confusion if a student is to believe that course is still available when it is not.

If a student tries to apply to Ace Training to do a course that they have

Page 9: Database report

9

already undertaken then that student should not be allowed to enrol and the same goes for a student if they have got any oustanding fees from previous course or courses that they have been part of, and if a new student has paid a certain amount of their fees they should be given a reciept and or an invoice.

3.1 Requirements

Student

A student will be able to enrol onto a course using three different methods first

one being a list which will only be able to be uploaded by a tutor the next is an

online form only used by a tutor and finally the student can do it themselves

online this will then need to be verified by a tutor before said student can be

registered to register the students must fill in their name, address, next of kin

details, course(s) enrolled for, date of birth and email address, if these are not

filled in then the students enrolment would become void as they all need to be

filled in in addition to this if a student is an international student they will need to

provide their visa expiry date and also passport number, students also need a

progress bar that will be updated when they complete certain tasks give e.g quiz.

Tutor

Tutors have to have their credentials checked before they can be created this will

be performed by administrator(s) then there has to be information stored about

said tutor this will include, name, address, next of kin details, office number,

extension number, date of birth, email address and national insurance number

these details need to be added for the tutor to be created, the Tutor will then

have the responsibility to store multiple resources in the database for their

course(s) such as presentations and documents the tutor will have the power to

change the settings of the resources like data that will be available to students

and data that won’t be the tutor can also change the time the data is available for,

Tutors will also have a username and password for.

Course

The course will be created by the administrator and a tutor will be assigned to

each course and then they are able to change the course details and once the

students enrol they can then select which course they would like to register in the

data that should be stored in the course will be, course name, credit value,

duration, course code, start date, end date and fee administrators will be able to

delete and or achieved after a time scale of inactivity.

Page 10: Database report

10

Quiz

Quizzes should be created by the tutor of each course for their students, the

students can then access these quizzes and complete them there should be

multiple types of questions like multiple echoice, true or false and fill in the blank

when the student has completed a certain quiz which is given to them by the

tutor it will then be added to his/her progress bar the quizzes must be configured

so that not only can students see their own score as well as the tutor but others

students cannot see another students score but the tutor will be able to see all.

Resources

The resources are to be controlled by the tutors this way they are able to

implement what data they need such as documents and presentations these

resources will be set to a specific course by the administrator to avoid confusion

with other courses the tutor is then able to set the resources so that parts of it

can be seen by students and other parts cannot be seen by students.

Enrolment

The enrolment is how the students enrol into their chosen course of study there

will be an enrolment number to keep track of certain enrolments and some can

be turned down if they try to re-enrol with outstanding fees to be paid.

Progress bar

The progress bar shows a student how well they are doing on their course of

study, it can also be viewed by the tutor so they are able to inform certain

students where they can improve and how to do it.

Quiz scores

The quiz scores depend on how a student does on the quiz they have been

assigned to do these quiz scores can then be viewed by the by both the student

and the tutor.

Questions

Page 11: Database report

11

The questions are what are in the quizzes given to the students they will have

either multiple choice or true/false.

Incorrect answer

This entity will contain the incorrect answers to the quiz and that way if the

student uses this answer they will not get a point for a certain question answered.

Correct answer

This works just like the incorrect answer but if a student chooses this answer

then they gain a point in the quiz.

Next of kin

This allows all users (administrator, student and tutor) to have a next of kin where

and this is used for all users in case of emergency they have a contact to inform

them.

The next part of this chapter shows what the business rules and operations are,

this shows what kind of privileges will be granted to each of the users among

other things the business operations states the things users are able to do and

the business rules state what things users are not able to do in the database

system.

3.2 Business Operations

1. Students can view course details

2. Students can enrol by list uploaded by tutor

3. Students can enrol by using an online form by a tutor

4. Students can enrol online by student

5. Student data is stored

6. Tutors authorise a student to enrol

7. tutors are created by administrators

8. Tutor credentials are checked by administrators

9. Tutor data is stored

Page 12: Database report

12

10. Tutors are given permissions to storing resources

11. Resources are made available to students

12. Quizzes are created for each course

13. There is a record of quizzes for each student

14. Student score is kept from the quiz

15. Different types of questions are made

16. The Tutor sees the data from the quiz

17. Students can see the data from their individual quiz

18. A Progress bar is created for a student

19. A knowledge bar is also created for a student

20. A student can view their progress bar

21. A student can view their knowledge bar

22. A tutor can view a student on their course progress bar

23. A tutor can view a student on their course knowledge bar

24. A tutor can use an offline register

25. Student can become unregistered

26. Tutors can become no longer employed

27. courses can be deleted

28. courses can be achieved

29. Course details can be changed by a tutor

30. students log in using username and password

31. tutors log in using username and password

32. permissions are given to tutors by administrators

33. permissions are given to students by administrators

Page 13: Database report

13

34. students have an attendance record

35. tutors can view attendance record of all students

36. students can access their individual attendance

37. administrators create a register for each course

38. Tutors can add a new course

39. administrators can move students to different courses

40. students can access resources

41. Tutors can add new assessments

42. students can apply for more than one course

43. administrators can add new tutor

44. Timetables are made administrators

45. Timetables can be amended by tutors

46. Students can view their timetable

47. Students can change their password

48. Administrators can change usernames and passwords

49. Tutors can mark completed quizzes

50. Administrators can view attendance records

3.3 Business Rules

1. Tutors cannot delete a course

2. Students cannot amend any course details

3. Students cannot delete course details

4. Students cannot enrol themselves

5. Students cannot register until fields are filled in

Page 14: Database report

14

6. International students cannot register until visa and passports data is filled

in

7. Tutors cannot create themselves

8. Tutors cannot be created until credentials are checked

9. Tutors cannot become a course tutor until registered

10. Tutors cannot register until the fields have been filled in

11. specific resources cannot be accessed by students

12. Resources cannot be shared across courses

13. Students cannot amend quizzes

14. Students cannot look at quiz answers

15. Students cannot look at another students quiz score

16. Students cannot look at another students details

17. Students cannot look at a tutors details apart from name

18. Students cannot look at another students progress bar

19. Students cannot look at another students timetable

20. Students cannot look at another students details

21. Students cannot create a timetable

22. Students cannot create a course

23. Students cannot amend a timetable

24. Tutors cannot create a timetable

25. Tutors cannot unregister a student

26. Tutors cannot delete other tutors

27. Students cannot delete a tutor

28. Students cannot delete another student

Page 15: Database report

15

29. Students cannot enrol on a course they have already undertaken

30. Students cannot enrol again if fees are outstanding

31. Tutors cannot change a student’s username and password

32. Students cannot change their username

33. Students cannot amend other students details

34. Students cannot change their fees

35. Tutors cannot change a student’s fees

36. Tutors cannot change their permissions

37. Students cannot change their permissions

38. Tutors cannot delete a student

39. Students cannot amend the register

40. Students cannot move themselves to a different course

41. Tutors cannot move a student to a different course

42. Tutors cannot change a student’s details

43. Students cannot store resources

44. Students cannot delete a tutor

45. Students can not add assessments

46. Students cannot create quizzes

47. Students cannot give permissions

48. Tutors cannot give students permissions

49. Tutors cannot give themselves permissions

50. Tutors cannot view other course resources

Page 16: Database report

16

This concludes the scenario chapter which has explained Ace Training scenario,

requirements for the database and also the business rules and operations that

should be taken into account, the next part of this report will go on to explain

what a conceptual diagram is and why they are important as well as the

conceptual diagram itself designed for Ace Training, and a diagram script which

shows a breakdown of the database.

4 Conceptual Design

A conceptual diagram can also be known as an explanatory or summary diagram. A conceptual diagram provides an overview in graphical form of how people, things, ideas, influences, actions and many more interrelate with each other. This is done by consolidating large amounts of data into one chart which is an ideal way of presenting the material which might be still in the idea stage, They can be just as effective in communicating simple and complex concepts. They are usually not quantitative and never go into to much detail. One huge advantage a conceptual diagram has is that it applies itself to any kind of subject such as; concrete or abstract, theoretical or actual, current, historical, or future.

There is not much of a distinction between conceptual diagrams and certain other types of diagrams for example; flow charts and organizational charts its not always clear. Usually if the diagram becomes more detailed then it is considered to no longer be a conceptual diagram, there are a few block and Venn diagrams that are known as conceptual diagrams also. Conceptual diagrams can sometimes be used in presentations due to them being extremely easy and quick to understand which can leave more of an impact on the audience and can also be remembered for a longer space of time due to it being a diagram rather than it being just words and numbers.

Conceptual diagrams are made up of geometric shapes, lines, arrows, symbols, pictures or sketches and text. When being used in conceptual diagrams the standard symbols can sometimes have different meanings when used in different diagrams. The main benefits from using the conceptual diagram are that it helps focus the design of the application by coupling the design to the tasks that the user is doing as well as being able to support having a good process for developing the product from the initial design and makes using the application much easier for the given user, the conceptual diagram is basically the foundation and it informs the design, process and experience these all then feed off each other and grow together.

The conceptual model is made up of four types of structures these are entities,

Page 17: Database report

17

attributes, special entity types (sub type entities) and relationships, the entity is represented in a box with square corners and then this box will have the name of the entity within the middle of it and all entities must be singular not plural to save confusion.

The attributes in the conceptual design are pieces of information about objects or events that the user may wish to store within the database these attributes can be known to describe the objects they are attached to such things as 'TutorID' for example could be used in a Tutor entity but there are different kinds of attributes one attribute can be used to describe and another can be used to identify these are known as 'identifying attribute' which uniquely identifies the entity it is placed in using 'TutorID' for example this is usually the primary key and has a lollypop like shape next to it coloured in and 'describing attribute' which only describes to properties of an entity 'name, address, email etc...' this attribute will also have a lollypop like shape next to it but not coloured in.

The relationships in the conceptual diagram happen when there are over two entities are linked to each other in some way, and these are sorted using associations these associations include:

One to one – e.g. a student has one quiz score and that quiz score belongs to that student only.

One too many – e.g. a student can have many enrolments but an enrolments can only have one student at a time.

Many too many – e.g. A tutor can teach on many courses and a course can have many tutors.

Page 18: Database report

18

constant to one – This means that there is an optional association existence and this is shown by symbol on the line of the optional association e.g. a quiz score may be seen by one of the tutors.

Constant to many – This means that there is a mandatory association existence and this is shown with a e.g. a course must have a payment

option.

Other relationships in a conceptual model include generalisation and recursive, with a generalisation this means that multiple entities can be connected to one other entity such as Tutors, administrators are all users so there should be an entity named user that all these entities can be connected to using a large arrow for example:

Page 19: Database report

19

And finally there is the recursive relationship this is a relationship can go back into itself, such as a tutor may also be a head tutor and a tutor is overseen by one head tutor and a head tutor may oversee a number of tutors. Example:

The next part of this chapter will show a fully completed conceptual diagram for Ace Training.

(Harris, RLH, 1999, Page 100) (Johnson, JJ, 2012 2,10) (Toby, J, Teorey. Sam S, 2011 pg 17)

Page 20: Database report

20

4.1 Conceptual diagram

4.2 Entity Relationships

These show each relationship that are in the conceptual diagram as a breakdown.

A tutor can have many courses just as a course is able to have many tutors.

Page 21: Database report

21

A tutor is able to have many resources they can upload and resources can have many tutors.

One tutor can have a look at many quiz scores for their given course and quiz scores can only have one tutor for their given course.

A student is able to view many resources and resources can have many students

Page 22: Database report

22

One student is only allowed to view their progress bar and there can only be one progress bar per student

One student can view and have theirs and theirs alone quiz score and quiz scores can only be allocated to one student each.

One student is able to enrol many times, there can be only one student per enrolment.

Many courses can have many enrolments and enrolments can have many courses.

Page 23: Database report

23

Many courses can have many students on that courses and many students can have more than one course.

One Quiz score can have many quizzes and many quizzes can only have one quiz score for each.

One next of kin can only have one user and one user can only have a certain next of kin.

Page 24: Database report

24

One quiz score can have many quizzes and many quizzes can only have one quiz score.

One quiz can have many questions in it and questions can only have one quiz.

There can be many incorrect answers in many questions, and questions can have many incorrect answers

Page 25: Database report

25

Questions can have one correct answer and the correct answer can have many questions

4.3 Diagram script

Entity Attributes identified Synonym Related to

Student Student ID

Forename

Surname

Address line 1

Address line 2

TownCity

Postcode

Phone number

Email address

Payment option

Fees paid

Many students can access many resources.

A student has one progress bar.

A student can enrol many times.

Many students can be on many courses.

A student can have one quiz score.

Tutor Tutor ID

Forename

Surname

Address line 1

Address line 2

TownCity

Postcode

Phone number

Email address

A tutor can view many quiz scores.

Many tutors can teach many courses.

Many tutors can upload many

Page 26: Database report

26

resources

Quiz Quiz ID

Course Code

Quiz name

A quiz has many questions

Many quizzes have one quiz score

Resorces Tutor ID

Student ID

Resource type

Many resources have many students

Many resources have many tutors

Enrolment Enrolment number

Student ID

Course Code

Status

Enrolment type

Many enrolments can have a certain student.

Many enrolments can have many courses.

Next of kin Relation

Phone number

Address line 1

Address line 2

TownCity

Postcode

Phone number

Email address

One next of kin has one user (Tutor, Student, and Administrator).

Correct answer Question ID

Correct answer

One correct answer has many questions.

Progress bar Student ID

Progress percent

One progress bar has one student.

Quiz scores Score

Student ID

Course Code

One quiz score has one quiz.

One quiz score is assigned to a certain student.

Questions Question ID Many questions can have many

Page 27: Database report

27

incorrect answers.

Many questions can have one correct answer.

Incorrect answer Question ID

Incorrect answer

Many incorrect answers can have many questions.

Course Course code

cost

description

Course name

Many courses can be taught by many tutors.

Many courses can have many students.

Many courses can have many enrolments.

Administrator Admin ID

Forename

Surname

Address line 1

Address line 2

TownCity

Postcode

Phone number

Email address

This concludes this chapter on the explanation about the conceptual model as

well as the conceptual model itself and the diagram script, The next chapter will

be about the logical diagram which is the next part of the design phase, it will

explain the importance of the logical model as well as the diagram itself designed

for Ace Training.

Page 28: Database report

28

5 Logical Design After completing the conceptual diagram the next diagram to create is the logical

diagram this is achieved by extracting all the information from the conceptual and

putting it all together but this time including the attributes as well as the entities, it

is known as a fully attributed data model that does not have DBMS, technology,

data storage or organizational constraints.

The logical diagram shows the data requirements for Ace Training from

more of a business point of view and are easy to understand by most users, and

allows them to understand what information goes where in the database due to

the attributes and entities being listed clearly and is a clean-up of any loose ends

of data that have been put into the conceptual diagram and new entities are

made for the entities that where by many-to-many thus making it easier when

transferring the model onto a physical design.

The following steps show the steps needed in creating a logical diagram:

Identify business rules and operations

Identify both key and non-key data items

Identify the paths and consolidate them

Find a strategy for archiving data

Create a volume table to allow for future expansion

The data that is defined can then be made into logical relationships called 'entities' and 'attributes', entities are known as blocks of information and attributes are known as components of an entity and these are what help a user to define uniqueness of an attribute.

(Victor, VE, 2012 pages 11-12)

(http://technet.microsoft.com/en-us/library/cc505843.aspx)

Page 29: Database report

29

This is a logical diagram of Ace Training database it has been converted from

conceptual to logical model, and the logical model has to have some

requirements the most needed one would be that each entity needs to have a

primary key which is done by have (pk) next to an attribute that is recognised as

the primary key, the entities are then given their relationships to other entities on

the model as there has to be at least one relationship if there is more than one

entity and then these relations must be defined by the use of a foreign key which

are made clear with the use of (fk) The foreign key is an attribute that is able to

complete a relationship by identifying the parent entity.

As this is the next step after the conceptual model other requirement must

be take into consideration such as generalisation will not be allowed in the logical

Page 30: Database report

30

model instead there are two choices one being collapsing it back into a super

class or have it as an entity that is separate but has the same key as the super

class would have and then have one to one relationships in the diagram above

the user has chosen the second option, also many to many relationships are not

allowed as they do not work they have to be replaced by associative entities for

example 'Tutor' and 'Course' were many to many and a next entity named 'Tutor

On Course' has been created where both 'Tutor' and 'Course' can connect to as a

one to many then their primary keys are stored into the associate entity as

foreign keys, and one to one relationships are only allowed if they cannot be

reduced to a single entity.

This concludes the chapter on the explanation of the logical design and why they

are important as well as the logical design itself, the next part of the report will go

on to explain normalisation and why it is important to normalise when creating a

database.

6 Normalisation

6.1 Cumulative design

This section allows the user to get a better understanding of the logical design this is done by creating a cumulative design, as it can be easier to understand the user is then able to add new rules to each entity using update, cascade, delete and restrict to understand what each entity is doing.

DDL

DDL or database design language is used to show the logical diagram in the

format of text, this will let the user understand foreign keys (fk) as it explains it in

detail including the rules of update and delete rules, and with these rules it allows

the user to update, delete and set how the child attribute will be affected by the

changes. The tables will be set underneath this way the user is able to see the

relationships between table (fk to pk) more clearly. The other functions are

restrict which means that nothing can be deleted if there is a child row and

cascade which means the child row will be deleted /updated too.

Page 31: Database report

31

Cumulative design

The cumulative design works by listing each of the entities just once, it then

identifies the foreign key as well as the update and delete rules for the relations

of the foreign keys, there are only duplicates allowed for those which are

identified as foreign keys.

Student (StudentID, Forename, Surname, Address Line 1, Address Line 2,

Town/city, Postcode, Phone Number, Email Address, Payment Option, Fees

Paid)

Tutor (TutorID, Forename, Surname, Address Line 1, Address Line 2, Town/city,

Postcode, Phone Number, Email Address)

Course (Course code, cost, description, name)

Questions(QuestionID)

Administrator(Email Address, Forename, Surname, Address Line 1, Address

Line 2, Town/city, Postcode, Phone Number, Payment Option, Fees Paid)

Next of Kin(Email Address, Forename, Surname, Address Line 1, Address Line

2, Town/city, Postcode, Phone Number)

Tutor On Course(Tutor ID, Course code)

FK Tutor ID --->> Tutor

Update Cascade

Delete

Page 32: Database report

32

Restrict

FK Course Code --->> Course

Update Cascade

Delete restrict

Student On Course(Student ID, Course code)

FK Student ID --->> Student

Update Cascade

Delete

Restrict

FK Course Code --->> Course

Update Cascade

Delete restrict

Enrolment (Enrolment number, Student ID, course code)

FK Student ID --->> Student

Update Cascade

Delete

Restrict

FK Course Code --->> Course

Update Cascade

Delete

Restrict

Page 33: Database report

33

Student resources(Student ID, Tutor ID)

FK Tutor ID --->> Tutor

Update Cascade

Delete

Restrict

FK Student ID --->> Student

Update Cascade

Delete

Restrict

Resources ( Tutor ID, Student ID, Score)

FK Tutor ID --->> Tutor

Update Cascade

Delete

Restrict

FK Student ID --->> Student

Update Cascade

Delete

Restrict

Progress Bar ( Student ID, Progress bar)

FK Student ID --->> Student

Update Cascade

Delete

Page 34: Database report

34

Restrict

User(Student ID, Admin ID, Tutor ID, Email Address)

FK Student ID --->> Student

Update Cascade

Delete

Restrict

FK Tutor ID --->> Tutor

Update Cascade

Delete

Restrict

FK Admin ID ---->> Administrator

Update Cascade

Delete

Restrict

FK Email Address --->> Next Of Kin

Update Cascade

Delete

Restrict

Enrolment onto course(Enrolment number, Course Code)

FK Enrolment number --->> Enrolment

Update Cascade

Delete

Page 35: Database report

35

Restrict

FK Course Code --->> Course

Update Cascade

Delete

Restrict

Quiz Scores (Student ID, Course Code, Score)

restrictFK Student ID --->> Student

Update Cascade

Delete

Restrict

FK Course Code --->> Course

Update Cascade

Delete

Quiz(Quiz ID, Course Code, Quiz name)

FK Course Code --->> Course

Update Cascade

Delete

Questions(Question ID)

Incorrect Answer to Question(Question ID, Incorrect answer ID)

FK Question ID --->> Question

Update Cascade

Page 36: Database report

36

Delete

FK Incorrect answer ID --->> Incorrect answer

Update Cascade

Delete

Correct answer(Correct answer ID, Question ID, Correct answer)

FK Question ID --->> Question

Update Cascade

Delete

Incorrect answer( Question ID, Incorrect answer)

FK Question ID --->> Question

Update Cascade

Delete

Normalisation

The main reason Normalisation is used is to make sure that only relevant data is

stored and to make sure its stored in a way so that there isn’t any unnecessary

space is being used up.

When normalising there are two main objectives which are removal of any

redundant data or duplicated data as well as making sure that the data

dependencies make sense, there are dependencies in a database when

information is stored in the same table uniquely determines other information

that is stored in the same table.

Page 37: Database report

37

Normalisation is applied to new databases using a a series of guidelines

which include having normalised forms and these are numbered from 1 and can

go up to 5 the first normal form is known as (1NF) and this carries on through to

5NF which is the 5th normal form but generally normalisations only go up to 3rd

normal form so the first three are the most commonly used and due to them

being guidelines sometimes there is a need to depart from them if a business is

in need of a deviation.

(Rob, PR, 2007, Page 153)

UNF

To start normalisation the user will have to create an un-normalised table from the given data source which has to include a list of the attributes of the entity, there must be an identification of the primary key e.g. Student ID then the user must find all the repeating group of attributes and identify the key from the group that is repeating.

1NF

After creating a UNF the user can then go on to the next step which is 1NF known as the first normal form to create this form the user must dismiss the repeating group of attribute to from a completely new entity and then it has to have the original key added to it, this will cause be two entities that are linked by the primary key.

2NF

2NF or second normal form can only be made if a relation has filled the requirements to be in first normal form as well as each non-key attribute in the relation has to be functionally dependent on the set primary key, there will be a creation of separate tables this allows there to be no dependency problem.

3NF

3NF or third normal form is usually the last form to be normalised and there can be sometimes complications as there can be a key and dependent relationship between non-key attributes in an entity. The way to convert 2NF to 3NF the user must first find any dependencies between non-key attributes in each table and then remove said dependencies to form another table once this is done the user must then choose the most proficient attribute to become the new key of that table and this is known as a foreign key link to the original table.

Page 38: Database report

38

The tables for this certain database is already in 3rd normal form and therefore do not need to be normalised any further. (Stephen, SM, 2011. Pages 96-99)

(Victor, VE, 2012 pages 14-18)

This concludes the chapter on the normalisation, the next chapter will focus on

the implementation stage of a database, this will show the field attributes of the

database as well as the code that will be used to create the database, and the

explanation of SQL and why it is used.

7 Implementation

7.1 Field attributes

This section of the report focuses on the overall implementation of the database, to start the physical design has to be created this is done by making a table with different fields the first part of the table that should be filled in is the field section which should be filled with attributes from each entity usually starting with the primary key, the user will then go onto deciding which data type should be attached to that field e.g. The primary key will usually be an integer as it’s a unique number and the names will usually be varchar which stands for variable character there are many other different data types to use, next the user will decide the right size for each field this may take some research depending on each field to stop and redundant space not being used or not enough space for certain people.

The next field on the table to be filled in is the format this is used to input the most appropriate format for that datatype, then there is the key type this is where the user will input what kind if any key types there are such as primary and foreign, the final two fields are index and required the index should be filled in with an index type and required section should be filled in with a yes or no.

Page 39: Database report

39

Student

Field Data type

Field size

Format Key type Index Required

Student ID integer Primary key

Yes (no duplicates)

Yes - auto number

Forename VarChar 36 No

Surname VarChar 36 Yes (duplicates ok)

Yes

Address line 1 VarChar 25 yes

Address line 2 VarChar 25 No

TownCity VarChar 58 Yes

Postcode VarChar 10 Yes Yes

Phone number

VarChar 20 Yes

Email address VarChar 255 Yes

Payment option

VarChar 25 Yes

Fees paid Decimal 5,2 Yes

Integer has been used for Student ID to create a number that will just a number

and no fractional or decimal components, the forename and surname has a data

type varchar and a field size of 36 because some names can go upto that

amount of characters, varchar is also used for address line 1 and 2 with a field

size of 25 as some street names can be very long, TownCity has been made into

a varchar and given a field size of 58 as there is a town in wales that has 58

characters. The use of varchar has continued onto the postcode with a field

value of 10 due to some postcodes being larger than 8 characters, the phone

number is set to a 20 field size with a varchar data type for phone numbers that

can be extremely long including phone area codes, the email address is set to

varchar with a field size of 255 because there could be a email address that size

because there is not a limit, payment option is the last one with a varchar data

type and that is 25 to give a bit a leeway as there are numurous ways of

payment, lastly fees paid is set to decimal as it will be a number and the field size

is set to 5,2 for large numbers.

Page 40: Database report

40

Tutor

Field Data type

Field size

Format Key type Index Required

Tutor ID integer Primary key

Yes (no duplicates)

Yes - auto number

Forename VarChar 36 No

Surname VarChar 36 Yes (duplicates ok)

Yes

Address line 1

VarChar 58 yes

Address line 2

VarChar 58 No

Town/City VarChar 58 Yes

Postcode VarChar 10 Yes Yes

Phone number

VarChar 20 Yes

Email address

VarChar 255 Yes

These are the same values that have been previously justified on the student

table.

Page 41: Database report

41

Quiz

Field Data type

Field size

Format Key type Index Required

Quiz ID integer Primary key

Yes (no duplicates)

Yes - auto number

Course code integer Foreign key

Yes (no duplicates)

Yes

Quiz name VarChar 30 Yes

Quiz ID is set to integer due to needing just numbers for the ID of the quiz and

that it is a primary key and needs to be unique so it can be set up as an

autonumber as well as course code, the quiz name is set to varchar and a field

size of 30 as the name of the quiz can become long for unexpected reasons.

Resources

Field Data type

Field size

Format Key type Index Required

Tutor ID integer Compound key

Yes (no duplicates)

Yes - auto number

Student ID integer Compound key

Yes (no duplicates)

Yes

Page 42: Database report

42

Resources type

VarChar 30 Yes

Again the tutor ID and Student Idhave a data type integer for reasons already

stated on previous justifications, and resource type has a varchar data type set to

30 as there can be a resource type with a long name or multiple names.

Enrolment

Field Data type

Field size

Format Key type Index Required

Enrolment Number

integer Compound key

Yes (no duplicates)

Yes - auto number

Student ID integer Compound key

Yes (no duplicates)

No

Course code integer Compound key

Yes (no duplicates) (duplicates ok)

Yes

Status VarChar 58 Yes

Enrolment type

VarChar 19 Yes

Enrolment number, student ID and Course code have all been given a integer

data type as they all need to be numbers, the status field has been given a field

size of 58 as there may be a small explanation of what status the enrolment is in,

and enrolment type has been given a field size of 16 as there are only three ways

to enrol and the max number of characters needed for this is 19.

Page 43: Database report

43

Next of kin

Field Data type

Field size

Format Key type Index Required

Email Varchar 255 Primary key

Yes (no duplicates)

Yes

Forename VarChar 36 No

Surname VarChar 36 Yes (duplicates ok)

Yes

Address line 1 VarChar 58 yes

Address line 2 VarChar 58 No

Town/City VarChar 58 Yes

Postcode VarChar 10 Yes Yes

Phone number

VarChar 20 Yes

These are the same values that have been previously justified on the Tutor table.

Correct answer

Page 44: Database report

44

Field Data type

Field size

Format Key type Index Required

Question ID Integer compound key

Yes (no duplicates)

Yes

Correct Answer ID

integer compound key

Yes (no duplicates)

Yes

Correct answer

VarChar 35 Yes

Question ID and Correct answer ID are both set as integers as they need to be

numbers, and correct answer is set to varchar with a field size of 35 due to the

answer could be a sentence.

Incorrect answer

Field Data type

Field size

Format Key type Index Required

Question ID Integer Compound key

Yes (no duplicates)

Yes

Incorrect answer ID

integer Compound key

Yes (no duplicates)

Yes

Incorrect answer

varchar 35 Yes

These have the same values as the 'correct answer' table.

Page 45: Database report

45

Progress bar

Field Data type

Field size

Format Key type Index Required

Student ID Integer Foreign key

Yes (no duplicates)

Yes

Progress percent

number 3 Yes

Student ID is set to integer because it needs to be an autonumber, and progress

percent is set to number with a field size of 3 as percentage can only go up to

100.

Quiz scores

Field Data type

Field size

Format Key type Index Required

student ID Integer Compound key

Yes (no duplicates)

Yes

Course code integer Compound key

Yes (no duplicates)

Yes

Score number 4 Yes

Student ID and Course code are set to integer because they need to be an

Page 46: Database report

46

autonumber, and score is set to number with a field size set to 4 as scores can

go into the thousands.

Questions

Field Data type

Field size

Format Key type Index Required

Question ID Integer Primary key

Yes (no duplicates)

Yes

Question ID is set to integer because it needs to be an autonumber.

Course

Field Data type

Field size

Format Key type Index Required

Course code integer Primary key

Yes (no duplicates)

Yes

cost decimal 5,2 yes

Description VarChar 255 no

Course name VarChar 25 yes

Course code is set to integer because it needs to be an auto number, cost is a

decimal set to 5,2 for a large number, the description is set to varchar with 255

for the field size as the description can be large, and course name is set to

varchar with a field size of 25 as the name of the course could be bigger than just

one word.

Page 47: Database report

47

Administrator

Field Data type

Field size

Format Key type Index Required

Admin ID integer Primary key

Yes (no duplicates)

Yes - auto number

Forename VarChar 36 No

Surname VarChar 36 Yes (duplicates ok)

Yes

Address line 1

VarChar 58 yes

Address line 2

VarChar 58 No

Town/City VarChar 58 Yes

Postcode VarChar 10 Yes

Phone number

VarChar 20 Yes

Email address

VarChar 255 Yes

The same values in the Tutor apply to the administrator table also.

7.2 SQL Implementation

Databases need to store and retrieve data for different types of computer programs as well as web-based programs such as blogs and photo galleries, and because of this many database software support a computer language which is known as SQL (sequel) and this language was designed specifically to make it easier for the users as programs that want the software for the database to be able to handle the low-level work of managing data just have to use the SQL language to send it instructions.

There are multiple different databases that support the use of SQL so they can access data the more popular ones are MySQL and postgreSQL so this means that MySQl is one of many brands of database software and the same

Page 48: Database report

48

goes for PostgreSQL, these are among the most popular probably due to the fact that they are free.

SQL needs to allow the user the create the database and relation structures as well as being able to perform certain procedures such as insertion, modification and deletion of data from relations and of course it must allow the user to also perform complex queries as well as simple ones and this must also be performed so that user effort is at a minimum, the command structure has to be easy to learn for the user in case there needs to be anything else added to the database.

SQL is an easy language to learn and use as it is non-procedural which means that the user only specify what information the user requires rather than how to get said information.

When writing SQL commands it’s good to know that all SQL statements consist of words that are reserved as well as user-defined words, the said reserved words are a part of SQL which are fixed and because of this these words must be spetl correctly and exactly as required otherwise they will not work at all, the other part is user-defined words and these are made up by a user which could represent names of different types of database objects like names of different columns.

For the most part of SQL statements they are not case sensitive unless it is for literal character data then it will have to be case sensitive, SQL is much easier to read when it has indentation and lination this means that with every clause there should be a new line created and then the start of the new clause should line up with the start of the previous clauses in order for the user to avoid confusion and sometimes there may be several parts to a clause then the way to lay it out would be to allow it to appear on a separate line and be indented under the start of the clause.

Another part of SQL is literals and literals are constants that are used in SQL statements the way this works is that all literals that are non-numeric must be enclosed in single quotes (e.g. 'Liverpool') and all literals that are numeric should not be enclosed in quotes (e.g. 100.0)

(Victor, VE, 2012 pages 12-14)

The following shows the creation of the Ace Training database using MySQL, to start the user must use -uroot -p and then change the password to whatever the user might see fit this way the database will be secure then the user will go on to create the database this is done by simply using the statement 'CREATE DATABASE' the user can then name that database anything they seem fit as long as it has no spaces and after the name there has to be ';' symbol to state that that line is over, then the user must type the statement 'SHOW DATABASES' this will then allow all databases to be shown and the next line can then be used which is 'USE' then the name of the database the user wants to use after this the user can then add tables to said database this is done by using the statement 'CREATE TABLE' then name the table anything the user sees fit but to save confusion it is

Page 49: Database report

49

best to start the name with 'tbl' (e.g. TblStudent) this way the user will know what part of the database are tables then ending that statement with '('.

The user is then able to add attributes to the table they have created such a 'Student ID' and 'Names' and like the physical design the user will have to input each of the values for each attributes usuing ',' after each attribute is filled going to the next line and filling in new attributes and after they have finished that they then have to state which one of the attributes are the primary key or the foreign key this is done at the bottom of the statements with using the word 'Primary and/or Foreign' with said attribute next to it in brackets then to end that table the user must end it with a ');@ on a new line.

MYSQL -uroot -p

SET PASSWORD FOR 'root'@'localhost' =

PASSWORD ('newPassword');

CREATE DATABASE aceTraining;

SHOW DATABASES;

USE aceTraining;

CREATE TABLE tblStudent (

StudentID integer auto_increment not null unique,

forename varchar(36),

Surname VarChar (36) not null,

AddressLine1 VarChar (58) not null,

AddressLine2 VarChar (58),

TownCity VarChar (58) not null,

Postcode VarChar (10) not null,

PhoneNumber VarChar (20) not null,

Page 50: Database report

50

EmailAddress VarChar (255) not null,

PaymentOption VarChar (25) not null,

FeesPaid Decimal (5,2) not null,

primary key (StudentID)

);

CREATE INDEX indexStudentID ON tblStudent (StudentID);

CREATE INDEX indexSurname ON tblStudent (Surname);

CREATE INDEX PostcodeID ON tblStudent (postcode);

CREATE TABLE tblTutor (

TutorID integer auto_increment not null unique,

forename varchar(36),

Surname VarChar (36) not null,

AddressLine1 VarChar (58) not null,

AddressLine2 VarChar (58),

TownCity VarChar (58) not null,

Postcode VarChar (10) not null,

PhoneNumber VarChar (20) not null,

EmailAddress VarChar (255) not null,

primary key (TutorID)

Page 51: Database report

51

);

CREATE INDEX indexTutorID ON tblTutor (TutorID);

CREATE INDEX indexSurname ON tblTutor (Surname);

CREATE INDEX PostcodeID ON tblTutor (postcode);

CREATE TABLE tblAdmin (

AdminID integer auto_increment not null unique,

forename varchar(36),

Surname VarChar (36) not null,

AddressLine1 VarChar (58) not null,

AddressLine2 VarChar (58),

TownCity VarChar (58) not null,

Postcode VarChar (10) not null,

PhoneNumber VarChar (20) not null,

EmailAddress VarChar (255) not null,

primary key (AdminID)

);

CREATE INDEX indexAminID ON tblAdmin (AdminID);

CREATE INDEX indexSurname ON tblAdmin (Surname);

CREATE INDEX PostcodeID ON tblAdmin (postcode);

Page 52: Database report

52

CREATE TABLE tblCourse (

CourseCode integer auto_increment not null unique,

cost varchar(36),

description VarChar (255),

CourseName VarChar (25) not null,

primary key (CourseCode)

);

CREATE INDEX indexCourseCode ON tblCourse(CourseCode);

CREATE TABLE tblQuiz (

QuizID integer auto_increment not null unique,

CourseCode integer not null,

Quizname varchar (30) not null,

Primary key (QuizID)

);

CREATE INDEX indexQuizID ON tblQuiz (QuizID);

CREATE INDEX indexCourseCode ON tblQuiz (CourseCode);

Page 53: Database report

53

CREATE TABLE tblResources (

TutorID integer not null,

StudentID integer not null,

ResourceType varchar (30) not null,

foreign key (TutorID) REFERENCES tblTutor (TutorID) on update

cascade on delete restrict,

foreign key (StudentID) REFERENCES tblStudent (StudentID) on

update cascade on delete restrict,

);

CREATE INDEX indexTutorID ON tblResources (TutorID);

CREATE INDEX indexStudentID ON tblResources (StudentID);

CREATE TABLE tblEnrolment (

EnrolmentNumber auto_increment not null unique,

StudentID integer not null,

CourseCode integer not null,

Status varchar(58) not null,

EnrolmentType(58) not null,

Primary key (EnrolmentNumber),

foreign key (StudentID) REFERENCES tblStudent (StudentID) on

update cascade on delete restrict,

Page 54: Database report

54

foreign key (CourseCode) REFERENCES tblCourse (CourseCode) on

update cascade on delete restrict,

CREATE INDEX indexEnrolmentNumber ON tblEnrolment

(EnrolmentNumber);

CREATE INDEX indexStudentID ON tblEnrolment (StudentID);

CREATE INDEX indexCourseCode ON tblEnrolment (CourseCode);

CREATE TABLE tblNextOfKin (

EmailAddress VarChar (255 not null,

forename varchar(36),

Surname VarChar (36) not null,

AddressLine1 VarChar (58) not null,

AddressLine2 VarChar (58),

TownCity VarChar (58) not null,

Postcode VarChar (10) not null,

PhoneNumber VarChar (20) not null,

primary key (EmailAddress)

);

CREATE INDEX indexEmailAddress ON tblNextOfKin (TutorID);

CREATE INDEX indexSurname ON tblNextOfKin (Surname);

Page 55: Database report

55

CREATE INDEX PostcodeID ON tblNextOfKin (postcode);

CREATE TABLE tblCorrectAnswer (

CorrectAnswerID auto_increment not null unique,

QuestionID no null,

CorrectAnswer varchar(35) not null,

primary key (CorrectAnswerID)

);

CREATE INDEX indexCorrectAnswerID ON tbltblCorrectAnswer

(CorrectAnswerID);

CREATE INDEX indexQuestionID ON tblCorrectAnswer (QuestionID);

CREATE TABLE tblIncorrectAnswer (

incorrectAnswerID auto_increment not null unique,

QuestionID no null,

incorrectAnswer varchar(35) not null,

primary key (incorrectAnswerID)

);

CREATE INDEX indexincorrectAnswerID ON tbltblincorrectAnswer

(incorrectAnswerID);

Page 56: Database report

56

CREATE INDEX indexQuestionID ON tblCorrectAnswer (QuestionID);

CREATE TABLE tblProgressBar (

StudentID auto_increment not null unique,

ProgressPercent varchar(3) no null,

foreign key (StudentID) REFERENCES tblStudent (StudentID) on

update cascade on delete restrict,

CREATE INDEX indexStudentID ON tblProgressBar (StudentID);

CREATE TABLE tblQuizScores (

StudentID integer not null,

CourseCode integer not null,

score varchar(4) not null,

foreign key (TutorID) REFERENCES tblTutor (TutorID) on update

cascade on delete restrict,

foreign key (CourseCode) REFERENCES tblCourse (CourseCode) on

update cascade on delete restrict,

);

CREATE INDEX indexTutorID ON tblQuizScores (TutorID);

CREATE INDEX indexStudentID ON tblQuizScores(CourseCode);

Page 57: Database report

57

This concludes the chapter on implementation, the next chapter will explain the

necessity of security and contingency, the security is part of the database that makes

sure there is no misuse between the created users, as well as the SQL code that has

gone into creating security and it will also explain why contingency is needed.

8 Security and Contingency

This part of the report focuses on the need for security and contingency inlcluding what would happen if there wasnt any security and contingency first off the database needs to have security implemented into it using the language of MySQL this is done to give the users a clear list of database requirements as well as restrictions in place for the users this will prevent any kind of misuse.

The following is an implementation of database security using MySql the user has to create credible users for instance people who will be using the database e.g. (Student) and then the user who will usually be the head administrator can give these created user different privileges these are usually decided within the business rules and operations that have already been made on the previous section 3.2 and 3.3, once there is an understanding as to what is wanted from each type of user the administrator can then start granting privileges using Mysql to start they must enter -root -p and enter password when prompted which has already been established in the previous section 7, the administrator can then go on to using the CREATE USER statement e.g ('student'@'localhost';) this means that the user student has been created and is assigned to the local host.

The Administrator can then use the GRANT statement which initializes that a user will be given privileges there are many different types of privileges the more common ones are as follows:

ALL – This allows All except grant

ALTER - This means that the user will be able to alter the table

CREATE USER - This allows one to create user, drop user, rename user and also revoke

CREATE – This Enable the creation of databases and tables

DELETE – This allows a user to be able to delete records

DROP – This allows databases the tables and views to be dropped

INDEX – This allows indexes to be created

INSERT – This allows users to insert rows into tables

SELECT – This allows users to select data from a database object

UPDATE – This allows the user to update data in a table

After the GRANT statement the administrator will then choose a table or tables to give users privileges to e.g. (Student Table) the administrator can then use different statements to give privileges for example SELECT this means that this particular user

Page 58: Database report

58

can select parts of data in the table then after deciding what kinds of privileges should be given the administrator will have to give the privileges a destination the is done by using the ON statement where the administrator will then have to state what database its on followed by what table, then which user its set to for example (ON aceTraining.tblStudent TO 'Student ' @ ' localhost';)

(http://dev.mysql.com/tech-resources/articles/mysql-complete-reference-ch14.pdf.)

mysql -root -p

USE aceTraining;

CREATE USER 'Student'@'localhost';

GRANT

SELECT (StudentID, forename, Surname, AddressLine1, AddressLine2,

TownCity, Postcode, PhoneNumber, EmailAddress, PaymentOption,

FeesPaid),

UPDATE (forename, Surname, AddressLine1, AddressLine2, TownCity,

Postcode, PhoneNumber, EmailAddress)

ON aceTraining.tblStudent TO 'Student'@'localhost';

GRANT

SELECT (CourseCode, cost, description, CourseName),

ON aceTraining.tblCourse TO 'Student'@'localhost';

GRANT

SELECT (TutorID, StudentID, Resource type),

ON aceTraining.tblResource TO 'Student'@'localhost';

GRANT

SELECT (QuizID, CourseCode, QuizName),

ON aceTraining.tblQuiz TO 'Student'@'localhost';

GRANT

SELECT (StudentID, ProgressPercent),

ON aceTraining.tblProgressBar TO 'Student'@'localhost';

GRANT

SELECT (Forename, Surname),

ON aceTraining.tblTutor TO 'Student'@'localhost';

Page 59: Database report

59

GRANT

SELECT (StudentID, CourseCode, Status, EnrolmentType),

ON aceTraining.tblEnrolment TO 'Student'@'localhost';

GRANT

SELECT (StudentID, CourseCode, Score),

ON aceTraining.tblQuizScore TO 'Student'@'localhost';

CREATE USER 'Tutor'@'localhost';

GRANT

SELECT (TutorID, forename, Surname, AddressLine1, AddressLine2,

TownCity, Postcode, PhoneNumber, EmailAddress),

UPDATE (forename, Surname, AddressLine1, AddressLine2, TownCity,

Postcode, PhoneNumber, EmailAddress)

ON aceTraining.tblTutor TO 'Tutor'@'localhost';

GRANT

INSERT,SELECT (TutorID, StudentID, Resource type),

UPDATE (Resource type)

ON aceTraining.tblResource TO 'Tutor'@'localhost';

GRANT

INSERT,SELECT (QuizID, CourseCode, QuizName),

UPDATE (QuizName)

ON aceTraining.tblQuiz TO 'Tutor'@'localhost';

GRANT

INSERT,SELECT (StudentID, CourseCode, Score),

UPDATE (Score)

ON aceTraining.tblQuizScore TO 'Tutor'@'localhost';

GRANT

INSERT,SELECT (StudentID, ProgressPercent),

UPDATE (ProgressPercent)

ON aceTraining.tblProgressBar TO 'Tutor'@'localhost';

GRANT

INSERT,SELECT (CourseCode, cost, description, CourseName),

UPDATE (Description, CourseName)

ON aceTraining.tblCourse TO 'Tutor'@'localhost';

GRANT

INSERT, SELECT, DELETE (StudentID, forename, Surname,

AddressLine1, AddressLine2, TownCity, Postcode, PhoneNumber,

Page 60: Database report

60

EmailAddress, PaymentOption, FeesPaid),

UPDATE (forename, Surname, AddressLine1, AddressLine2, TownCity,

Postcode, PhoneNumber, EmailAddress, PaymentOption, FeesPaid)

ON aceTraining.tblStudent TO 'Student'@'localhost';

CREATE USER 'Admin'@'localhost';

GRANT

INSERT, SELECT, DELETE (StudentID, forename, Surname,

AddressLine1, AddressLine2, TownCity, Postcode, Phone Number,

EmailAddress, PaymentOption, FeesPaid),

UPDATE (forename, Surname, AddressLine1, AddressLine2, TownCity,

Postcode, PhoneNumber, EmailAddress, PaymentOption, FeesPaid)

ON aceTraining.tblStudent TO 'Admin'@'localhost';

GRANT

INSET, SELECT, DELETE (TutorID, forename, Surname, AddressLine1,

AddressLine2, TownCity, Postcode, PhoneNumber, EmailAddress),

UPDATE (forename, Surname, AddressLine1, AddressLine2, TownCity,

Postcode, PhoneNumber, EmailAddress)

ON aceTraining.tblTutor TO 'Admin'@'localhost';

GRANT

INSERT,SELECT, DELETE (TutorID, StudentID, Resource type),

UPDATE (Resource type)

ON aceTraining.tblResource TO 'Admin'@'localhost';

GRANT

INSERT,SELECT, DELETE(QuizID, CourseCode, QuizName),

UPDATE (QuizName)

ON aceTraining.tblQuiz TO 'Admin'@'localhost';

GRANT

INSERT,SELECT, DELETE (StudentID, CourseCode, Score),

UPDATE (Score)

ON aceTraining.tblQuizScore TO 'Admin'@'localhost';

GRANT

INSERT,SELECT, DELETE (StudentID, ProgressPercent),

UPDATE (ProgressPercent)

ON aceTraining.tblProgressBar TO 'Admin'@'localhost';

GRANT

INSERT,SELECT, DELETE (CourseCode, cost, description,

CourseName),

UPDATE (cost, Description, CourseName)

Page 61: Database report

61

ON aceTraining.tblCourse TO 'Admin'@'localhost';

GRANT

INSERT,SELECT, DELETE (EmailAddress, forename, Surname,

AddressLine1, AddressLine2, TownCity, Postcode, PhoneNumber ),

UPDATE (EmailAddress, forename, Surname, AddressLine1,

AddressLine2, TownCity, Postcode, PhoneNumber)

ON aceTraining.tblNextOfKin TO 'Admin'@'localhost';

GRANT

INSERT,SELECT, DELETE (QuestionID, CorrectAnswerID,

CorrectAnswer),

UPDATE (CorrectAnswer)

ON aceTraining.tblCorrectAnswer TO 'Admin'@'localhost';

GRANT

INSERT,SELECT, DELETE (QuestionID, IncorrectAnswerID,

IncorrectAnswer),

UPDATE (IncorrectAnswer)

ON aceTraining.tblIncorrectAnswer TO 'Admin'@'localhost';

GRANT

INSERT,SELECT, DELETE (QuestionID),

ON aceTraining.tblIncorrectAnswer TO 'Admin'@'localhost';

GRANT

INSET, SELECT, DELETE (AdminID, forename, Surname, AddressLine1,

AddressLine2, TownCity, Postcode, PhoneNumber, EmailAddress),

UPDATE (forename, Surname, AddressLine1, AddressLine2, TownCity,

Postcode, PhoneNumber, EmailAddress)

ON aceTraining.tblAdmin TO 'Admin'@'localhost';

The previous code is the privileges given to all users in Ace Training and the next part of this chapter is contingency which deals with preemptive security.

Contingency is when an event might happen which didn’t seem likely to happen or even

intended to happen, so it can be known as a possibility, which needs to be prepared for

in case something happens in the future e.g an emergency.

When working with databases their needs to be things taken into consideration

when it comes to contingency as there are many different occurrences that can possibly

happen such as the database might crash which causes major problems if people are

trying to use it at the time, even where the servers are kept can become a problem for

things such as natural disasters, fires or vandalism and if there the right kind of security

Page 62: Database report

62

and have information someone might want hackers can be a major problem as well as

the hardware which can die such as the motherboard and hard disk depending on the

quality of it, the server space given might cause server load to be too high if there are to

many people using the database at the same time there needs to be maximum which

allows all users to be on it at once to avoid this from happening.

It is important that if the database goes down all the data has been backed up

regularly, there are many options for backing up a database but there can only be one

chosen for certain databases.

How to back up using transact-SQL

A user will have to backup a database by executing a 'backup database statement' this is

achieved by specifying the name of the database to back i.e “aceTraining” and then

going on to choosing the back up device which the full database backup will be written

to.

Example of backup:

BACKUP DATABASE aceTraining

TO backup_device [,...n]

[WITH with_options [,...o]];

The with statement allows the users to have a few basic with options such as

compression or no compression, description and name, this allows the user to add

information to the backup so its easier to understand if there ever needs to be another

backup.

Tape

Backing up data on a tape can be proficient as in the event of a hard disk crash or

comparable failure the data won’t be lost as it will be on the tape, users can back up the

data manually or use the proper software to be programmed which allows it to happen

automatically, the tape can also be taken off-site which can be a good thing as well as a

bad thing the fact that users can transport it is user friendly but at the same time there is

human error and the backups can be lost left behind or even stolen which can cause

huge problems for a company but the tape has a life expectancy of 4 or more years

which is very good for businesses that are around for a long time.

The technology and software used on the tape is very well established and been

improved over the years which allows it use less power and less heat requirements, the

Page 63: Database report

63

reason the tape is popular with small businesses is that they are able to add additional

tapes and there is no limit to how many the user can keep adding and the tapes are just

one fixed cost, there are also no issues with the networks security once the backup has

completed.

There can be some drawbacks from using the tape a major one is that it is

unable to become a shared resource so expanding a business can be harder, and even

though it is a fixed price, the price per gigabyte is slightly higher compared to other

methods of backing up data as well as higher price per GB the tape is also slower at

backing up and can also be fragile if it is not properly handled in the right way which can

cause information being destroyed.

RAID

RAID (redundant array of independent disks) is used in a way so that the same

data will be stored in different places on numerous different hard drives, doing

this input and output operations overlap but in a balanced way which causes the

performance to be improved, due to using numerous disks the mean time

between failures increases and storing data redundantly enhances fault

tolerance, There are many different types of RAID that the user can use:

RAID 0 – blocks striped, no mirror, no parity

RAID 1 – blocks mirrored, no stripe, no parity

RAID 5 - blocks striped, distributed parity

RAID 10 - blocks mirrored. (And blocks striped)

A strip is data that is striped (in the option the user can choose 64kb or 128kb for

strip a size).

RAID can be adept by how fast it recovers data and the cost per gigabyte

is slightly cheaper than the average and because its saved onto a hard disk the

user has the choice whether they want to have it re-purposed, its main benefit is

that if the user loses a drive in an array it doesn’t necessarily mean that there is

data loss this is because there are other disks with the same information.

When using RAID there can be some drawbacks one being the increased

Page 64: Database report

64

difficulty when trying to use is off-site, if the users have 5 drives when using RAID

5 then one is usually the parity drive and if there is a loss of a drive a user can

still recreate it but if there is a loss of a second one during recreation then there

is a possibility that the whole database can be lost, another drawback is that it

cannot handle long-term archive and the only way it is able to is if it has a huge

amount of hard disk space, but its usually fine if the business is not to big, some

businesses staff may need to be trained in how to use RAID as its harder to set

up than the other methods of backing up and RAID has higher requirements

when it comes to both the power and cooling.

Network Backup

A network backup are one the most popular way to backup a persons or a company’s

data as they are easy to access for users either at home or at the office, it allows

multiple users to backup to the same location and can also share computers over the

network, some of the benefits of are that this kind of backup allows users to be able to

wireless utilities and it can be managed in-house.

There are a few downsides to a network backup, these include how slow it can

be which all depends on the infrastructure and if this is the case there could be

repercussions when it comes to the cost of the hardware as it may have to be updated if

the backup is not quick enough, there will be some training needed for staff members

who have not got the right kind of expertise.

The network backup has been known not to handle long-term storage well which

can cause a company huge problems if they are planning to store their data for a long

period of time, as well as this there is a limit storage capacity which will not be beneficial

for large companies.

Offsite backup

Offsite backup also known as cloud backup is a way of backing up data which involves

sending a copy of the data over a public network onto an off-site server and this server is

usually hosted by a third party service provider who will charge the customer a certain

amount of money to the customer which is usually based on bandwidth or number of

users, this kind of backup is built around a client software application which is run on a

schedule which will be determined by the level of service that a certain customer has

Page 65: Database report

65

paid for.

Some of the pros to this type of backup is that once its initially installed its

seamless and extremely easy to use, it also offers many types of security depending on

how much is spent this is true for the amount of storage too.

Some of the cons involved with cloud backup is that the data is stored on a third

party server which can be controversial when it comes to the ownership of data aswell

as this there is no way of knowing that the data is 100% secure as its in the hands of

someone else plus the servers that it is stored in can be in multiple different countries

which can be hit with natural disasters as well as different laws for information.

(Sack,JS, 2000, Pages 6-7, 285-290)

Conclusion

The right backup for ace training would be the tape backup over the other backups as its

a portable medium which allows offsite storage of data which means that it can be used

in disaster recovery, there are also different types of security for tape such as WORM

and hardware based encryption these allows the tape to be secure in both transit and at

rest.

Another reason it is more superior is because it’s both cost and space efficient if

its for a long term company, there are some tapes such as the LTO5 that can store up to

3TBs of compressed data it might not be needed but the option is there for the

customers and this type of tape can be secure in an offsite vault and is able to exist

offline without any power or requirements for cooling.

The lifespan for the tape is impressive as some have had a shelf life of up to 30

years which is very reliable for long-term archival.

Server backup should be performed at the end of each day this is done by

inserting the tape and allow the backup process run overnight this means if the server

suffers from a disaster then there is at least all the saved files from the previous day this

should be performed by the administrator.

This concludes the chapter on security and contingency, the next chapter will be about

the testing of the SQL code and why it is important.

Page 66: Database report

66

9. Testing

This section focuses on testing this allows the user to extract parts of the code they have

written and test it in MySql giving the user a better understanding of the code that has

been written the user will test each pieces of code to make sure they are working and if

they do not work as they should the user can then explain how it has been rectified or

the code might be fine the way it already is.

Code to be tested What should happen

What did happen

Amendments

CREATE TABLE

tblStudent (

StudentID integer

auto_increment

not null unique,

forename

varchar(36),

Surname VarChar

(36) not null,

AddressLine1

VarChar (58) not

null,

AddressLine2

VarChar (58),

TownCity VarChar

(58) not null,

Postcode VarChar

(10) not null,

PhoneNumber

VarChar (20) not

null,

EmailAddress

VarChar (255)

not null,

This piece of code is made to create a table for the user students including all the attributes associated with it, as well as the primary key and indexes.

After testing the code there was no errors and the table was created successfully.

No amendments were needed.

Page 67: Database report

67

PaymentOption

VarChar (25) not

null,

FeesPaid Decimal

(5,2) not null,

primary key

(StudentID)

);

CREATE INDEX

indexStudentID ON

tblStudent

(StudentID);

CREATE INDEX

indexSurname ON

tblStudent (Surname);

CREATE INDEX

PostcodeID ON

tblStudent

(postcode);

CREATE TABLE tblTutor

(

TutorID integer

auto_increment

not null unique,

forename

varchar(36),

Surname VarChar

(36) not null,

AddressLine1

VarChar (58) not

null,

AddressLine2

VarChar (58),

TownCity VarChar

(58) not null,

Postcode VarChar

(10) not null,

PhoneNumber

VarChar (20) not

null,

EmailAddress

This piece of code is made to create a table for the user tutors including all the attributes associated with it, as well as the primary key and indexes.

After testing this code there were no errors and the Tutor table was created successfully.

No amendments were needed.

Page 68: Database report

68

VarChar (255)

not null,

primary key (TutorID)

);

CREATE INDEX

indexTutorID ON

tblTutor (TutorID);

CREATE INDEX

indexSurname ON

tblTutor (Surname);

CREATE INDEX

PostcodeID ON

tblTutor (postcode);

CREATE TABLE tblAdmin

(

AdminID integer

auto_increment

not null unique,

forename

varchar(36),

Surname VarChar

(36) not null,

AddressLine1

VarChar (58) not

null,

AddressLine2

VarChar (58),

TownCity VarChar

(58) not null,

Postcode VarChar

(10) not null,

PhoneNumber

VarChar (20) not

null,

EmailAddress

VarChar (255)

not null,

primary key (AdminID)

This piece of code creates the third and final user table for Administrators, including all the attributes associated with it, as well as the primary key and indexes.

After testing this code there were no errors and the table for administrators was created successfully.

No amendments were needed.

Page 69: Database report

69

);

CREATE INDEX

indexAminID ON

tblAdmin (AdminID);

CREATE INDEX

indexSurname ON

tblAdmin (Surname);

CREATE INDEX

PostcodeID ON

tblAdmin (postcode);

CREATE TABLE

tblCourse (

CourseCode

integer

auto_increment

not null unique,

cost varchar(36),

description

VarChar (255),

CourseName

VarChar (25) not

null,

primary key

(CourseCode)

);

CREATE INDEX

indexCourseCode ON

tblCourse(CourseCode)

;

This piece of code is supposed to create a table for the course with attributes and including the primary key and indexes.

The table for courses was created successfully without any errors.

No amendments needed.

CREATE TABLE

tblResources (

TutorID integer

not null,

StudentID integer

not null,

ResourceType

varchar (30) not

null,

This next section of code should create a table as well as all the attributes, primary key, foreign key and indexes for resources.

This piece of code work fine after testing with no errors and the table creation was a success.

No amendments were needed.

Page 70: Database report

70

foreign key (TutorID)

REFERENCES tblTutor

(TutorID) on update

cascade on delete

restrict,

foreign key

(StudentID)

REFERENCES tblStudent

(StudentID) on update

cascade on delete

restrict,

);

CREATE INDEX

indexTutorID ON

tblResources

(TutorID);

CREATE INDEX

indexStudentID ON

tblResources

(StudentID);

CREATE TABLE

tblEnrolment (

EnrolmentNumber

auto_increment

not null unique,

StudentID integer

not null,

CourseCode integer

not null,

Status varchar(58)

not null,

EnrolmentType(58) not

null,

Primary key

(EnrolmentNumber),

foreign key

(StudentID)

REFERENCES tblStudent

(StudentID) on update

cascade on delete

restrict,

foreign key

(CourseCode)

This part of the sql code is to make a table for the enrolment, including its attributes, primary key, both foreign keys and indexes.

After testing this code, the tables were created successfully with no errors.

There were no amendments needed for this piece of code.

Page 71: Database report

71

REFERENCES tblCourse

(CourseCode) on

update cascade on

delete restrict,

CREATE INDEX

indexEnrolmentNumber

ON tblEnrolment

(EnrolmentNumber);

CREATE INDEX

indexStudentID ON

tblEnrolment

(StudentID);

CREATE INDEX

indexCourseCode ON

tblEnrolment

(CourseCode);

CREATE TABLE

tblNextOfKin (

EmailAddress

VarChar (255 not

null,

forename

varchar(36),

Surname VarChar

(36) not null,

AddressLine1

VarChar (58) not

null,

AddressLine2

VarChar (58),

TownCity VarChar

(58) not null,

Postcode VarChar

(10) not null,

PhoneNumber

VarChar (20) not

null,

primary key

(EmailAddress)

This part of code is used to create a table for next of kin with all attributes a primary key and indexes.

The table for next of kin was created successfully with no errors.

There were no errors there for no amendments were needed.

Page 72: Database report

72

);

CREATE INDEX

indexEmailAddress ON

tblNextOfKin

(TutorID);

CREATE INDEX

indexSurname ON

tblNextOfKin

(Surname);

CREATE INDEX

PostcodeID ON

tblNextOfKin

(postcode);

CREATE TABLE

tblCorrectAnswer (

CorrectAnswerID

auto_increment not

null unique,

QuestionID

no null,

CorrectAnswer

varchar(35) not null,

primary key

(CorrectAnswerID)

);

CREATE INDEX

indexCorrectAnswerID

ON

tbltblCorrectAnswer

(CorrectAnswerID);

CREATE INDEX

indexQuestionID ON

tblCorrectAnswer

(QuestionID);

This partition of code is used to create a table for correct answers with the attributes and primary key as well as indexes.

It worked fine after testing with no errors and the table was created.

No errors therefore no amendments were done.

CREATE TABLE

tblIncorrectAnswer (

incorrectAnswerID

auto_increment not

null unique,

QuestionID

This part of code is used to make a table for incorrect answers which also includes the attributes

The code worked fine and the table was created with no errors.

No amendments were needed in this case.

Page 73: Database report

73

no null,

incorrectAnswer

varchar(35) not null,

primary key

(incorrectAnswerID)

);

CREATE INDEX

indexincorrectAnswerI

D ON

tbltblincorrectAnswer

(incorrectAnswerID);

CREATE INDEX

indexQuestionID ON

tblCorrectAnswer

(QuestionID);

primary key and indexes.

CREATE TABLE

tblProgressBar (

StudentID

auto_increment not

null unique,

ProgressPercent

varchar(3)

no null,

foreign key

(StudentID)

REFERENCES tblStudent

(StudentID) on update

cascade on delete

restrict,

CREATE INDEX

indexStudentID ON

tblProgressBar

(StudentID);

This part of code is used to make a table for incorrect answers which also includes the attributes primary key, foreign key and indexes.

The code worked as intended and the table was created with no errors.

No errors meant there was no amendments were needed.

CREATE TABLE

tblQuizScores (

StudentID integer

not null,

CourseCode integer

not null,

This section of sql code is used to create a table for quiz scores as well as the attributes primary key,

The code worked as intended and the table was created with no errors.

No errors meant there was no amendments were needed.

Page 74: Database report

74

score varchar(4)

not null,

foreign key (TutorID)

REFERENCES tblTutor

(TutorID) on update

cascade on delete

restrict,

foreign key

(CourseCode)

REFERENCES tblCourse

(CourseCode) on

update cascade on

delete restrict,

);

CREATE INDEX

indexTutorID ON

tblQuizScores

(TutorID);

CREATE INDEX

indexStudentID ON

tblQuizScores(CourseC

ode);

both foreign keys and indexes.

CREATE USER

'Student'@'localhost'

;

This part of code should create the user student.

The user was created and named correctly .

No amendments needed

GRANT

SELECT (StudentID,

forename, Surname,

AddressLine1,

AddressLine2,

TownCity, Postcode,

PhoneNumber,

EmailAddress,

PaymentOption,

FeesPaid),

UPDATE (forename,

Surname,

AddressLine1,

AddressLine2,

TownCity, Postcode,

PhoneNumber,

EmailAddress)

ON

This code should give the user students certain types of privileges when it comes to the student table which have been declared in the business rules and operations.

After the code was typed into mysql there were no errors and the console stated that 'Query OK, 0 rows affected (0.01)'

There were no amendments needed

Page 75: Database report

75

aceTraining.tblStuden

t TO

'Student'@'localhost'

;

CREATE USER

'Tutor'@'localhost';

This part of code should create the user Tutor.

The user was created and named correctly.

No amendments needed

GRANT

SELECT (TutorID,

forename, Surname,

AddressLine1,

AddressLine2,

TownCity, Postcode,

PhoneNumber,

EmailAddress),

UPDATE (forename,

Surname,

AddressLine1,

AddressLine2,

TownCity, Postcode,

PhoneNumber,

EmailAddress)

ON

aceTraining.tblTutor

TO

'Tutor'@'localhost';

This code should give the user Tutors certain types of privileges when it comes to the Tutor table which have been declared in the business rules and operations.

After the code was typed into mysql there were no errors and the console stated that 'Query OK, 0 rows affected (0.01)'.

No amendments were needed.

CREATE USER

'Admin'@'localhost';

This part of code should create the user Admin.

The user was created and named correctly .

No amendments needed

GRANT

INSERT, SELECT,

DELETE (StudentID,

forename, Surname,

AddressLine1,

AddressLine2,

TownCity, Postcode,

Phone Number,

EmailAddress,

PaymentOption,

This code should give the user Tutors certain types of privileges when it comes to the Tutor table which have been declared in the business

After the code was entered the was an unfortunate syntax error as there was human error when coming to inserting the code. In this

To fix this it just had to be made into one word, after this was done it was then tested again and worked fine.

Page 76: Database report

76

FeesPaid),

UPDATE (forename,

Surname,

AddressLine1,

AddressLine2,

TownCity, Postcode,

PhoneNumber,

EmailAddress,

PaymentOption,

FeesPaid)

ON

aceTraining.tblStuden

t TO

'Admin'@'localhost';

rules and operations.

case it was that ‘PhoneNumber’ had a space between each word.

This concludes the chapter on testing, the next chapter will discuss the key

definitions and principles of the databases GUI (graphical user interface), as well

as the overall design.

10. GUI

The GUI or (graphical user interface) is a piece of software that works at the point of contact (interface) between a user and the computer, which contains graphical elements such as dialog boxes, a menu, scroll bars, icons etc... Rather than having text characters to allow the user to give commands to the computer or change what is on the screen in front of them.

A GUI is usually used using a pointing device such as a mouse which allows the user to select certain things and navigate around the GUI, it should be taken into consideration that when all programs are running under the GUI they use a default set of graphical elements this is to make it easier for the user to learn how to use the interface because once they are able to remember it they are then able to use all programs rather than learning new commands.

There are six main principles to take into consideration when creating the design for the user interface theses are as follows:

Layout

The way that the interface is layed out is very important for the users as most layout concepts are the same, the screen is more than likely to be divided up into 3 different kind of boxes one for the navigation area this is usually at the top, one for the status are which is usually placed at the bottom and finally the work area

Page 77: Database report

77

which will be in the middle, if there are areas on the layout that are similar to each other or more than one then they should be grouped together, The user should not have to move about the interface to much so the layout must be designed in a way to minimise this as well as this the best layouts are made so that they are consistent for the same areas, such things as size, shape, data entry should be remaining the same throughout to avoid user confusion.

Content Awareness

All the interfaces on the GUI need to have a title for each, alongside this the interface should also contain menus and then these menus should allow the user to understand where he/she is as well as where the user had been previously to end up where they are currently, the content awareness for users should also make it clear what information is within each areas.

Aesthetics

Interfaces need to be user friendly and allow the user to want to use the interface, this can be done by making it aesthetically pleasing using multiple different methods, a new user would be to overcome if there was a lot of information in front of them the more simple it is the better for new users, it is not only the information on screen that may confuse a new user but the way it is presented such things as text font and the size of the text can put a user off from an interface, The colours of the interface are a big part of it being aesthetically pleasing as some colours can be harsh on the eyes especially if they clash with each other, the colours will need to separate different items so the users are able to differentiate between them.

User experience

The user should be content with the program that they are using especially if they are using it for the very first time, it should be memorable to user and easy for them to learn, this also goes for the experts that need to also use the programs such as the administrators so there should be shortcuts for the experts to use so they are then able to get to a point on the interface in a shorter amount of time.

Consistency

The GUI needs to be consistent for all users throughout this way the users are able to then predict what will happen as well as know precisely where certain information is, this will of course reduce the learning curve as the information they seek will usually be in the same place as it was previously, as the user navigates through the interface the different parts need to have the same information as all the other parts, much like a website has its links usually at the top of the webpage, it will be the same for the database interface so the users can navigate to different areas with ease.

Page 78: Database report

78

Minimal user effort

A user wants to be at a point they are looking for when on an interface in the shortest amount of time otherwise it can be tedious which would make the users unfriendly with the interface therefore there is a rule named the three clicks rule this means that the users should be able to go from one point in the interface for e.g. 'main menu' to the information or action they want within three clicks or three key strokes.

(Stewart, SB 2013, slides 16-28)

Interface Design

This is the log in which the users will face when trying to access the database, the users will have been given a certain user name and a password, these unique user names will allow the interface to differentiate between the students, tutors and administrators and they will then go onto the next part of the interface.

Page 79: Database report

79

This is the homepage which the certain user will be presented with when they have logged in, from here they are able to navigate through the interface and do certain things, the interface show a highlighted link to allow the user to know what page they are on as well as this the name of the page they are visiting will be at the top of the page.

Page 80: Database report

80

This will be what faces the user if they are a student when clicking on the student link at the top of the interface they are able to view all their details and make any changes that might be needed to make they are then also able to click on the sub categories for the students.

Page 81: Database report

81

One of the sub categories for students is the progress bar this is where the students can view the progress they have made so far on the course they are on.

This sub category shows the students information on fees, such as the payment option they have used and the fees that they have paid so far.

Page 82: Database report

82

This section of the interface will allow the student to see what course they are on with information about it.

This next link is for the tutor, from here they can see all their details and make any changes if necessary this can only be viewed if the user that is logged in is a tutor if it’s a student then they will not be able to click on the tutor link.

Page 83: Database report

83

This section of the interface is also for the tutor and is accessed by clicking the courses sub category, they are able to see the details of the course or courses they are teaching again the students will not be able to access this part of the interface but the tutors will be able to.

Page 84: Database report

84

This section can be accessed by both students and tutors and they are able to select the resources available, the only difference is that tutors are able to upload more resources and make them available to students, but students are not able to perform this action.

Page 85: Database report

85

This part of the interface lets the users select and complete quizzes that have been uploaded by their tutor, only tutors are able to upload more quizzes this action is restricted for students.

Page 86: Database report

86

This section of the interface is also for just the tutors they can see what kind of progress their students are making.

This concludes the chapter of the GUI this is the last part of the database report next will be the full conclusion of the report.

Report Conclusion

The database report for ace training has gone over each step to creating a database, starting from the history of databases and why they have used as well as different types of databases available, the report then went on to explain the scenario of Ace Training and what requirements they need, it then goes on to designing the database using diagrams with conceptual and logical designs with clear understanding of why they are needed and how the models are made.

It then showed how to normalise and went on to show how to implement using SQL language and how security and contingency works, and finishes by showing testing of the implemented SQL and final designs of the interface for the database.

Page 87: Database report

87

References

A Gentle Introduction to Relational and Object Oriented Databases - Frank

Stajano[ONLINE] Available at: http://www.cl.cam.ac.uk/~fms27/db/tr-98-2.pdf.

[Accessed 15 October 2013].

Database Models: Hierarcical, Network, Relational, Object-Oriented,

Semistructured, Associative and Context. . 2013. Database Models: Hierarcical,

Network, Relational, Object-Oriented, Semistructured, Associative and Context. .

[ONLINE] Available at: http://unixspace.com/context/databases.html. [Accessed

14 October 2013]

Glossary. 2013. Glossary. [ONLINE] Available at:

http://emeld.org/school/glossary.html. [Accessed 11 October 2013].

Harris, RLH, 1999. Information Graphics: A Comprehensive Illustrated Reference. 1st ed. New york: Oxford university press. Page 100

History of Databases - CHM Revolution . 2013. History of Databases - CHM

Revolution . [ONLINE] Available at:

http://www.computerhistory.org/revolution/memory-storage/8/265/2207.

[Accessed 15 October 2013]

J. Glenn Brookshear (2012). Computer science an overview. 11th ed. England:

Anghuman Chakraborty. 400-415.

Johnson, JJ, 2012. Conceptual Models: Core to Good Design. 1st ed. Morgan

& Claypool pages 2,10.

Lesson 1: Systematically Approaching Design Stages. 2014. [ONLINE] Available

at http://technet.microsoft.com/en-us/library/cc505843.aspx [Accessed 1 January

2014]

Max Logix: Advantages and Disadvantages of using relational databases. 2013..

[ONLINE] Available at: http://maxlogix.blogspot.co.uk/2009/09/advantages-and-

disadvantages-of-using.html. [Accessed 13 October 2013].

Network database model - Computer Business Research. 2013. Network

database model - Computer Business Research. [ONLINE] Available at:

http://www.computerbusinessresearch.com/Home/database/network-database-

model. [Accessed 14 October 2013]

Network Database Model - Database Management. 2013. Network Database

Page 88: Database report

88

Model - Database Management. [ONLINE] Available at:

http://databasemanagement.wikia.com/wiki/Network_Database_Model.

[Accessed 14 October 2013].

OBJECT-ORIENTED DATABASE (OODB). 2013. OBJECT-ORIENTED

DATABASE (OODB). [ONLINE] Available at:

http://people.cs.pitt.edu/~chang/156/19oodb.html. [Accessed 15 October 2013]

P.K singh (2009). Database management system concepts. India: V.K

enterprises. 26-45.

Patrick, PRO, 2004. The History of Databases. PowerPoint presentation.

Rob, PR, 2007. Database Systems: Design, Implementation, and Management.

5th ed. United States: Course Technology. Page 153

Sack, JS, 2000. SQL Server 2000 Fast Answers for DBAs and Developers,

Signature Edition. 1st ed. United States: Apress..Pages 285-290

Security, Access Control, and privileges [ONLINE] Available at

http://dev.mysql.com/tech-resources/articles/mysql-complete-reference-ch14.pdf.

[Accessed 6 January]

Stephen, SM, 2011. Access 2010: Part I. 1st ed. United States: The Mouse

Training Company. Pages 96-99.

Stewart, SB 2013. Database Technology User Interface Design. PowerPoint

presentation. [ONLINE] Available at

http://cs.hope.ac.uk/courses/dbTech/lectures.php [Accessed 7 January]

The advantages and disadvantages of database network model. 2013. The

advantages and disadvantages of database network model. [ONLINE] Available

at:

http://wiki.answers.com/Q/The_advantages_and_disadvantages_of_database_n

etwork_model. [Accessed 14 October 2013]

The advantages and disadvantages of database network model. 2013. The

advantages and disadvantages of database network model. [ONLINE] Available

at:

http://wiki.answers.com/Q/The_advantages_and_disadvantages_of_database_n

etwork_model. [Accessed 15 October 2013].

Toby, JT, Sam S, 2011. Database Modeling and Design. Fifth ed. Lightstone.

Page 89: Database report

89

Pages 17

Victor, VE, 2012. What Is Sql ?. 1st ed. Bloomington: AuthorHouse. Pages 12-18.

What is a Flat File Database? - Definition from Techopedia . 2013. What is a Flat

File Database? - Definition from Techopedia . [ONLINE] Available at:

http://www.techopedia.com/definition/7231/flat-file-database-database. [Accessed

11 October 2013]

www.data-e-education.com - History of Database. 2013. www.data-e-

education.com - History of Database. [ONLINE] Available at: http://www.data-e-

education.com/E084_History_of_Database.html. [Accessed 15 October 2013]

www.data-e-education.com - Network Database Model. 2013. www.data-e-

education.com - Network Database Model. [ONLINE] Available at:

http://www.data-e-education.com/E087_Network_Database_Model.html.

[Accessed 15 October 2013]