Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
C OV E N T RY U N I V E R S I T Y
B U S I N E S S I N F O R M AT I O N
T E C H N O L O G Y
DATA BAS E S
C H I M A O B I J I B U I K E , C L A U D I A A .
I F R I M , J A K E B U R G E S S , D E V O N
B R O W N , C H E V E L L E F I T Z G E R R A L D
2 | P a g e
Contents Contents .................................................................................................................................................................................. 2
Introduction ........................................................................................................................................................................ 3
Project Plan ......................................................................................................................................................................... 4
............................................................................................................................................................................................ 5
Databases .......................................................................................................................................................................... 10
Structured Query Language (SQL) ..................................................................................................................................... 13
Not Only Structure Query Language (NoSQL) ................................................................................................................... 15
Entity Relationship Model and Diagram ........................................................................................................................... 16
Entity Relationship Diagram (ERD) .................................................................................................................................... 24
SQL Database Implementation ......................................................................................................................................... 27
Class Diagram .................................................................................................................................................................... 39
Python Code ...................................................................................................................................................................... 40
ITIL – CSI ............................................................................................................................................................................ 46
Information Technology Infrastructure Library Continual Service Improvement ............................................................ 46
References ........................................................................................................................................................................ 49
3 | P a g e
Introduction
In this project we had to create SQL tables based around the ideas of our clients about how their company is structured so that the data that they had on their workforce was all put together and categorised in tables. The tables would then be linked to the python code that we created using an object relational mapper (ORM). The program source tree would link a repository that includes SQLAlchemy (our chosen ORM) to a command line so that we can put our python into the command line which would then go through the ORM and into our SQL.
4 | P a g e
Project Plan
The project plan was managed using two different plans which were the visual project plan in Microsoft project
and the more detailed project plan in Microsoft word.
Communication methods
To manage and communicate with the group members we used the following communication methods:
University email Personal email Google hangouts Mobile phones WhatsApp texting
Project plan in Microsoft project
The project is being monitored in two ways, one is using a project plan in Microsoft word and one is Microsoft
project.
5 | P a g e
6 | P a g e
Week Task Task start Task end Week 1 Read and understand the project
brief 09/02/2015 13/02/2015
Begin the assignment of the initial tasks
09/02/2015 13/02/2015
Assign the SQL research task 09/02/2015 09/02/2015 Assign the ORM research task 09/02/2015 09/02/2015 Assign the NoSQL research task 09/02/2015 09/02/2015 Start report 09/02/2015 09/02/2015 Start presentation (just headings and design)
09/02/2015 09/02/2015
Assign the ITIL research task 09/02/2015 09/02/2015 Begin entity relationship model work
13/02/2015 13/02/2015
Week 2 Develop ERM model 16/02/2015 16/02/2015 Develop ERM attributes 16/02/2015 16/02/2015 Continue working on research tasks
16/02/2015 21/02/2015
Begin SQL alchemy research 16/02/2015 16/02/2015
Week 3 Begin SQL 23/02/2015 23/02/2015 Create SQL tables 23/02/2015 23/02/2015 Begin database research 23/02/2015 23/02/2015 Refine table attributes 23/02/2015 23/02/2015 Work on presentation 23/02/2015 01/03/2015 Work on report 23/02/2015 01/03/2015
Week 4 Do the presentation 02//03/2015 02//03/2015 Get presentation feedback 02/03/15 02/03/2015 Finish ERM diagram 02/03/2015 06/03/2015 Do Class diagram 02/03/2015 06/03/2015 Put together report 02/03/2015 08/03/2015 Put SQL on all group computers 06/03/2015 06/03/2015 Do SQL queries 06/03/2015 06/03/2015 Do Normalization 06/03/2015 06/03/2015 Do the introduction 06/03/2015 06/03/2015 Explain the CMD issue 06/03/2015 08/03/2015
7 | P a g e
Analysis of group performance
Week Analysis
1 Good progress, many tasks handed out for group members to complete for next week, group knows what they need to do.
2 Good development of the ERM diagram and good progress in research.
3 Good SQL and ERD progress, few issues but the issues were resolved
4 Impressive performance from group members as SQl, ERD and Class diagrams are completed.
Breaking down the brief
Once we had been given the brief we highlighted key areas to make them stand out, the whole brief is important so the
areas that are not highlighted still need to be done.
8 | P a g e
9 | P a g e
Splitting the project tasks between the group
Group member Responsibilities Chimaobi Jibuike Project map
SQL research SQL alchemy SQL (main contributor) Individual python coding Normalization
Claudia Ifrim Python research Use case documentation Service catalogue Entity relationship modelling Definition (includes what is a key, attribute and object) Continuous service improvement looking at previous service catalogue Entity relationship diagrams SQL (main contributor) Individual python coding Queries
Devon Brown ITIL research CSI research SQL Individual python coding
Jake Burgess Introduction Project plan (word) Project plan (project) Project map Object relational mapper Entity relationship Diagram Class diagram Analysis of brief SQL Individual python coding
Chevelle Fitzgerald NoSQL research Database research SQL Individual python coding
10 | P a g e
Databases
What is a database? A collection of data that is interrelated and is usually store in structured frame, and is
organised in away where data is easily accessible on a computer. The information is organised in a table that
allows the users to access information easily while providing an efficient and effective way of retrieving, managing
and storing data. The information that is collected is stored in many different formats; there are many different
types of databases, for example, there are physical and electronic formats of database storage types.
(Mike Chapple 2015)
These database types where taken from the a online source, which explains the different types of database: “The
most prevalent approach is the relational database, a tabular database in which data is defined so that it can be
reorganized and accessed in a number of different ways. A distributed database is one that can be dispersed or
replicated among different points in a network. An object-oriented programming database is one that is congruent
with the data defined in object classes and subclasses.” (techtarget, 2015).
Who uses database? Database are used all over the world, in every business and organisation, to help provide
suitable and reliable for persons who needs it. The police uses database to store and retrieve relevant information,
on criminals, the DVLA, Banks, Government, Tax Records, Election Information and Statistics.
Pros and cons of using a Database.
The pros of using a Database is:
Organised information
Information is easily accessed
None repetitive data
The cons of using a Database is:
The information might be hard to find if the settings aren’t applied to the database for filtering.
Some information within the database could be old and out-dated.
Information could be overwhelming to someone who has no clue how to work a database.
(stockoverflow 2013)
11 | P a g e
Relational databases
What is a database?
A database is a collection of data that is all related to each other and all the data that is in the database can be
searched.
What is a relational database?
Relational databases can have any number of tables that the creator wishes to have but the tables have to be linked
to each other by having something in common which would be a key field which is a attribute of the tables e.g.
name.
“Relational processing entails treating whole relationships as operands. Its primary purpose is loop-avoidance, an
absolute requirement for end users to be productive at all, and a clear productivity booster for application
programmers.”
Dr Edgar F Codd
Image, Quote and information above from (Samra, P 2015)
12 | P a g e
What are the advantages of relational databases?
1. The key field data only needs to be entered into the relational database once since it can be used by the different tables. For example if a key field was the name ‘bob’ then the key field ‘bob’ would be able to be accessed by all the tables.
2. The fact that the key fields don’t have to be entered more than once then this is useful for making sure the size of the file is not bigger than it should be.
3. Another advantage due to only entering the key fields once is that there is a lower chance of making mistakes.
4. The key fields can be viewed using queries which can be used for business purposes which can help the user/client’s business.
(BBC N/A)
13 | P a g e
Structured Query Language (SQL)
SQL stands for Structured Query Language. The way that Structured Query Language is used in the modern days
society today is to enables access and communication with any databases (Bayer, N/A). SQL is that standard
language that’s used to access and communicate with databases. SQL is used to do certain tasks for example update
data ton databases to ensure that the data is being kept up to date, or another example could be to collect or
retrieve some data from the database for the business.
There are some relational database management systems that use SQL such as:
Oracle
Sybase
Microsoft SQL Server
Access
Ingres etc.
SLQA - Structured Query Language Alchemy
SQLA stands for Structured Query Language Alchemy. SQL Alchemy is a Python tool kit and object relational
mapper that gives developers the full power and the flexibility of SQL. It provides a high level of well-known
enterprise-level persistence patterns, that’s designed to be efficient and high-performing database access, which
can be adapted into a simple and basic form of Pythonic domain language.
SQL Alchemy makes out the database to be a relational algebra engine and not just any collection of tables. Rows
that are within the table can be selected from not just tables only but also joins and other select statements.
SQL Alchemy is the most famous for its Object-Relational Mapper (ORM), and component that is optional and also
provides the data mapper pattern, this is where classes can be mapped out even in a database in open ended,
multiple ways - allowing the object model and database schema to develop in a cleanly decoupled way from the
beginning.
SQL databases try to behave like object collections, the more size and performance start to matter. Object
collections behave more or less like tables and rows and the abstraction starts to matter. SQL Alchemy tries to aim
and accommodate both of these principles.
Within SQL Alchemy there are some features such as:
No Object-Relational Mapper (ORM) required - There are two components that is known to be in SQL Alchemy. One is the core and the other
Mature, High Performing Architecture
Database Administrator (DBA) Approved
14 | P a g e
Non-Opinionated
Unit Of Work
Function-Based Query Construction
Modular and Extensible
Separate Mapping and Class Design
Eager-Loading and Caching of Related Objects and Collections
Composite (Multiple-Column) Primary Keys
Self-Referential Object Mappings
Raw SQL Statement Mapping
Pre and Post Processing of Data
Supported Platforms
Supported Databases (Bayer, N/A)
Organisations that use SQL Alchemy:
Yelp!
The Open Stack Project
Mozilla
Survey Monkey
Lolapps
Freshbooks
Fedora Project (Bayer, N/A)
15 | P a g e
Not Only Structure Query Language (NoSQL)
NoSQL was developed in the late 2000 to deal with the limitation that was restricting the SQL database. The
purpose for the development of the NoSQL is to make the process of storing and retrieving data as easy and
efficient as possible. SQL had a limited amount of data it was able to store and the information was often replicated
and unstructured. The introduction to the NoSQL is an improvement to SQL with many changes, which has proven
effective for businesses or anyone that uses databases.
SQL stands for Structured Query Language; SQL uses relational databases, which was not developed and designed
to cope with the large scale of data and the complexity of the data storage process. SQL is the language that is used
in relational database management (Quinstreet Enterprise 2015).
NoSQL is a variety of different types of technology that was created as reaction to the rising about of data is stored
about, products, users and objects. Data is also stored in accordance with how frequent it’s being accessed, how it
preforms and the needs of the data.
There are 4 NoSQL database types:
1. Document databases- pair each key with a complex data structure known as a document. These Documents can contain many different nested documents; the documents can sometimes be key-value paired or key-array pairs.
2. Graph stores -are used to store information about networks, such as how social connections are made. Graph stores include Neo4J and HyperGraphDB.
3. Key-value stores-re the simplest NoSQL databases. Every item that is stored in the database is stored as an attribute name (or "key"), together with its value. Examples of key-value stores are Riak and Voldemort. Some key-value stores, allows each value to have a type, for example, "integer", which adds functionality.
4. Organisations such as Cassandra and HBase are optimized for queries over large datasets, and store columns of data together, instead of rows.
(MongoDB inc 2015)
16 | P a g e
Entity Relationship Model and Diagram
Peter Pin-Shan Chen of Massachusetts institute of Technology was the first to propose the ER model in 1970s.
The entity-relationship (ER) model is a database model which defines the rational relationship of entities (objects)
in order to create a database (M Rouse, 2015).
The database structure of the ER model is represented as a diagram which is called Entity-Relationship (ER)
Diagram, this diagram looks like a grammatical breakdown of a sentence into its grammatical parts.
In this diagram the entities take form of points, polygons, circles and ovals, and the relationship are represented as
lines connecting the points, polygons circles and ovals.
All ER diagrams have a corresponding logical table and vice-versa (M Rouse, 2015).
In a rational sense, the entities correspond to grammatical nouns (employees, students, products, building etc…)
and these can be defined by the assets means which are called attribute, while the relationships are corresponding
to verbs (being a member of a team or class, act of a purchase, etc…), which can be defined by the number of
entities related with it, this is also known as the degree (M Rouse, 2015).
What are Entities?
Entities are objects which represent significant data and these are usually nouns. There are three types of entities:
Strong entities which occur self-sufficiently from other entities types and these permanently
possess one or more attributes that individually differentiate each existence of the entity
(Lucidchart, 2015).
Strong
Entity
Weak
Entities
17 | P a g e
Weak entities which depend on other entity types, these do not possess individual attributes and they have no
importance in the diagram without depending on another entity. The depending entity is known as the owner
(Lucidchart, 2015).
Associative entities which are the entities that associate the occurrences of one or more
entity types. These have attributes which are unique to the relationship between those
entity occurrences (Lucidchart, 2015).
What are relationships?
There are relationships and weak relationships.
Relationships are significant links between entities, these are usually verbs (actions,
operations, etc…). A relationship provides valuable information that cannot be
distinguished with just the entity types (Lucidchart, 2015).
Weak relationships also known as identifying relationships are the connections that occur
between a weak entity type and its owner (Lucidchart, 2015).
There are three types of relationships between the entities and those are:
1. One-to-One This is one occurrence of entity (A) which is related with another occurrence of another entity (B) (Beal V. 2015).
Example
In a database of students, each student name (A) is related to one ID number (B).
Associativ
e Entity
Relationshi
p
Weak
Relationship
A B
18 | P a g e
2. One-to-Many
This is one occurrence of an entity (A) linked with zero, one or many occurrences of another entity (B), but for one
occurrence of entity (B) there is only one occurrence (A) (Beal V. 2015).
Example
In a University database, students are allocated to study in only one building, the building name (A) is linked with
many different student names (B) and those students are all sharing the same singular link with the entity (A).
3. Many-to-Many
This is one occurrence of an entity (A) linked with one, zero or many occurrences of an entity (B) and one
occurrence of entity (B) is linked to one, zero or many occurrences of entity (A) (Beal V. 2015).
Example
In a University database, with students working on multiple projects, each occurrence of a student (A) is linked
with many occurrences of projects (B) and at the same time each occurrence of a project (B) has multiple students
(A) linked with it.
A B B
B
A
B
A A
B B
19 | P a g e
Relationship types
These are a set of significant relations between one or more entity types. Every relationship type is given a role
name which defines its functions.
As well as with the entity and entity types, it is vital to be able to make difference between the relationship type
and relationship occurrence.
Relationship occurrence
This shows the specific entity occurrence which are linked. A sematic net is an object level model that uses to
define entities and symbol to characterise relationships.
Relationship are characterised by lines which join every entity with the related entity type (Connolly and Begg,
2014, pp 408-409).
Degree of relationship types
Degrees the number of entity types which are taking part in a relationship. The entities elaborated in a specific
relationship type are related to as members in that relationship.
Relationship of degree two is called binary and a relationship of degree three is called ternary (Connolly and Begg,
2014, pp 410-411).
20 | P a g e
Recursive relationship also called unary relationship
This is a relationship in which the same entity type takes part more than once in different roles. Relationships
could be given role names to designate the determination that every entity that takes part plays in a relationship.
The role names are vital for the recursive relationships in order to indicate the function of each member. These
names can also be used when two entities are linked through more than one relationship.
Role names are not always essential if the function of the entities members in a relationship is certain (Connolly
and Begg, 2014, pp 412-413).
What are attributes?
There are three types of attributes which are:
Attributes are features of an entity, a many-to-many relationship or a one-to-one relationship.
Attributes contain principles which define every entity occurrence and characterise the core part of
the data stored in the database.
Example
In a University database for students the entities can be defined as, names, department,
course, course fees, (etc…) attributes.
An attribute is an asset of entity types. The attributes keep values which defines every entity occurrence and
indicates the main part of the data stored within the database (Connolly and Begg, 2014, pp. 413).
Multivalued attributes are capable to hold many values for each entity occurrence (Lucidchart, 2015).
Example
In a University database for departments, the occurrence of the department entity type can have multiple values
for the telnum attribute. Department name EC linked to 0800 354 5555 and 0845 354 5555 telephone numbers.
In this example the telnum attribute is multivalued. The telnum attribute of the EC entity type can have between
one and two values, which means that the department can have a minimum of one and a maximum of two
telephone numbers (Connolly and Begg, 2014, pp. 414).
Attributes
Multivalued
Attributes
21 | P a g e
Derived attributes are attributes whose values can be calculated from linked attribute
values (Lucidchart, 2015).
These attributes characterise a value that is derivable from the value of the linked attribute
or a group of attributes which do not have to be in the same entity type (Connolly and Begg,
2014, pp. 414-415).
Example
In a University database for student finance, the value for the course fees attribute of the course length entity, is
calculated form the courseStart and courseEnd attributes also of the course length entity type.
The course fees attribute is a derived attribute from the courseStart and courseEnd attributes (Connolly and Begg,
2014, pp. 414-415).
Entity-relationship diagram Notations
Relationships show an association between two tables and in the physical data model the relationships are
characterised by conventional lines (Lucidchart, 2015).
Cardinality also known as ordinarily relationships link to the maximum number of times an occurrence in one
entity can be connected with occurrences in the linked entity, while a minimum number of times an occurrence in
one entity can be connected with an occurrence in the linked entity (Lucidchart, 2015).
Notations
(Lucidchart, 2015).
Derived
attributes
One
One and only one
Zero or one
One or many
Zero or many
Many
22 | P a g e
Or…
0..1 - zero or one entity occurrence
1..1 or 1 - only one entity occurrence
0..* or * - zero or many entity occurrences
1..* - one or many entity occurrence(s)
2..6 - minimum of 2 to a maximum of 6 entity occurrences
0, 3, 7-9 - zero, three, seven, eight or nine entity occurrence (Connolly and Begg, 2014, pp. 425).
Participation defines if all or only some entities occurrences take part in a relationship. The participation control
characterises if all entity occurrences are involved in a specific relationship, which is also denoted as the
mandatory participation or in some relationships denoted as optional participation.
The part of entities in a relationship shows as the minimum values for the multiplicity series on all sides of the
relationship.
Optional participation is characterised as a minimum value of zero, and/or mandatory participation, characterised
as a minimum value of 1 (Connolly and Begg, 2014, pp. 425-426).
Physical ER diagram symbols
Tables – these are another way of demonstrating entities.
Fields – these demonstrate the attributes of the entities.
Types – these relate to the type of that linked with the equivalent field in a table. Types can also relate to entity
types, which defines the structure of an entity.
Keys – these are one way to group attributes. There are three types of keys, these are:
Primary keys are attributes that specifically recognises one and only one occurrence of an entity, and it becomes a
foreign key in any entity type which is linked through 1..1 or 1..* relationship (Lucidchart, 2015).
Candidate keys are attributes that specifically recognises every occurrences of an entity. A candidate key is the
minimal number of attributes, and whose value specifically recognises each entity occurrence.
The candidate key must keep values which are specific all occurrences of an entity type, this means that a
candidate key cannot hold a null (Connolly and Begg, 2014, pp. 416).
23 | P a g e
Composite keys are have two or more attributes. Sometimes the key of an entity type is created of several
attributes and their values together are specific for every entity occurrence, but not on their own (Connolly and
Begg, 2014, pp. 4415).
(Lucidchart, 2015).
Entity Entity
Field
Field
Field
Field
Field
Filed
Field
Field
Key
Key
Key
Key
Entity
Type
Type
Type
Type
Field
Filed
Field
Field
Entity
Key
Key
Key
Key
Field
Filed
Field
Field
Type
Type
Type
Type
24 | P a g e
Entity Relationship Diagram (ERD)
Creating the Diagram:
Our initial designs of the ERD were done on paper by looking at the brief and coming up with a rough design, the
design was then shown to assistant lecturers and even the course leader to make sure that the ERD was done
properly. Once the tables had been established we had to link them together and make sure that there were no
many to many relationships, the diagram initially had a few many too many relationships which were not allowed
so more tables had to be added to fix the problem.
Once the tables were sorted we started to make lists of the attributes that were contained in the tables, these lists
included the tables’ primary keys and foreign keys, and these were also checked were the lecture staff to make sure
that we were doing things correctly.
Over the next 7 days the attributes and the ERD changed to better meet the objectives of the project, the final
design which was the 10th design is shown below, it is on paper since it is before we had put it on a computer.
25 | P a g e
For the presentation we created the ERD in PowerPoint due to issues with not being able to access our Microsoft Access
version at the time, the ERD in PowerPoint is shown below.
In the SQL tables the attributes and tables themselves are all in capitals to avoid case sensitive issues, for the report
the table names and attributes were put in both upper and lower case so they were easier to read and looked more
fitting.
The underlined attributes are the primary keys meaning they are the unique identifier of that table, the red
attributes are foreign keys which are attributes from other tables.
Throughout the project attributes were added and taken away to help meet the project objectives and
requirements hence why Work_Packages has an extra attribute in the list compared to the print screen of the
PowerPoint ERD since it was still being altered.
26 | P a g e
The final ERD in Microsoft Access:
27 | P a g e
SQL Database Implementation
SQL Tables
CREATE TABLE CLIENTS ( CLIENT_ID INT NOT NULL, CLIENT_NAME VARCHAR (30) NOT NULL, SECTOR VARCHAR (30) NOT NULL, ADDRESS VARCHAR (30) NOT NULL, CONTACT_NAME VARCHAR (30) NOT NULL, CONTACT_TELEPHONE INT NOT NULL, PRIMARY KEY (CLIENT_ID) ); CREATE TABLE PROJECTS ( PROJECT_ID INT NOT NULL, PROJECT_NAME VARCHAR (30) NOT NULL, PROJECT_MANAGER VARCHAR (30) NOT NULL, P_PREDICTED_START_DATE DATE NOT NULL, P_ACTUAL_START_DATE DATE NOT NULL, P_PREDICTED_FINISHING_DATE DATE NOT NULL, P_ACTUAL_FINISHING_DATE DATE NOT NULL, P_PREDICTED_COST INT NOT NULL, P_ACTUAL_COST INT NOT NULL, PRIMARY KEY (PROJECT_ID) ); CREATE TABLE EMPLOYEES ( EMPLOYEE_ID INT NOT NULL, EMPLOYEE_NAME VARCHAR (30) NOT NULL, EMPLOYEE_RATE DECIMAL (18, 2) NOT NULL, PRIMARY KEY (EMPLOYEE_ID) ); CREATE TABLE STAFF_TIME ( STAFF_TIME_ID INT NOT NULL, WORKED_HOURS INT NOT NULL, COST_OF_STAFF_TIME INT NOT NULL, PRIMARY KEY (STAFF_TIME_ID) );
28 | P a g e
CREATE TABLE ROLE ( ROLE_ID INT NOT NULL, ROLE_NAME VARCHAR (30) NOT NULL, ROLE_RATE NUMERIC NOT NULL, PRIMARY KEY (ROLE_ID) ); CREATE TABLE WORK_PACKAGES ( WORK_PACKAGE_ID INT NOT NULL, WORK_PACKAGE_NAME VARCHAR (30) NOT NULL, WKP_PREDICTED_START_DATE DATE NOT NULL, WKP_ACTUAL_START_DATE DATE NOT NULL, WKP_PREDICTED_FINISHING_DATE DATE NOT NULL, WKP_ACTUAL_FINISHING_DATE DATE NOT NULL, WKP_PREDICTED_COST INT NOT NULL, WKP_ACTUAL_COST INT NOT NULL, EQUIPMENT_USAGE_COST NUMERIC NOT NULL, PRIMARY KEY (WORK_PACKAGE_ID) ); CREATE TABLE DOCUMENTS ( DOCUMENT_ID INT NOT NULL, DOCUMENT_NAME VARCHAR (30) NOT NULL, PRIMARY KEY (DOCUMENT_ID) ); CREATE TABLE DOCUMENT_AUTHOR ( AUTHOR_ID INT NOT NULL, AUTHOR_NAME VARCHAR (30) NOT NULL, PRIMARY KEY (AUTHOR_ID) ); CREATE TABLE EXPENSES ( EXPENSE_ID INT NOT NULL, EXPENSE_AMOUNT INT NOT NULL, EXPENSE_TYPE VARCHAR (20) NOT NULL, PRIMARY KEY (EXPENSE_ID) );
29 | P a g e
Foreign keys
ALTER TABLE CLIENTS ADD PROJECT_ID REFERENCES PROJECTS (PROJECT_ID); ALTER TABLE PROJECTS ADD CLIENT_ID REFERENCES CLIENTS (CLIENT_ID); ALTER TABLE PROJECTS ADD WORK_PACKAGE_ID REFERENCES WORK_PACKAGES (WORK_PACKAGE_ID); ALTER TABLE PROJECTS ADD EMPLOYEE_ID REFERENCES EMPLOYEES (EMPLOYEE_ID); ALTER TABLE EMPLOYEES ADD PROJECT_ID REFERENCES PROJECTS (PROJECT_ID); ALTER TABLE EMPLOYEES ADD WORK_PACKAGE_ID REFERENCES WORK_PACKAGES (WORK_PACKAGE_ID); ALTER TABLE ROLE ADD EMPLOYEE_ID REFERENCES EMPLOYEES (EMPLOYEE_ID); ALTER TABLE ROLE ADD EXPENSES_ID REFERENCES EXPENSES (EXPENSE_ID); ALTER TABLE ROLE ADD WORK_PACKAGE_ID REFERENCES WORK_PACKAGES (WORK_PACKAGE_ID); ALTER TABLE ROLE ADD STAFF_TIME_ID REFERENCES STAFF_TIME (STAFF_TIME_ID); ALTER TABLE DOCUMENTS ADD WORK_PACKAGE_ID REFERENCES WORK_PACKAGES (WORK_PACKAGE_ID); ALTER TABLE DOCUMENT_AUTHOR ADD DOCUMENT_ID INT REFERENCES DOCUMENTS (DOCUMENT_ID); ALTER TABLE DOCUMENT_AUTHOR ADD EMPLOYEE_ID REFERENCES EMPLOYEES (EMPLOYEE_ID); ALTER TABLE EXPENSES ADD CLIENT_ID REFERENCES CLIENTS (CLIENT_ID); ALTER TABLE EXPENSES ADD WORK_PACKAGE_ID REFERENCES WORK_PACKAGES (WORK_PACKAGE_ID);
30 | P a g e
Functions we used while creating the database
DELETE FROM PROJECTS;
DELETE FROM DOCUMENTS;
DELETE FROM CLIENTS;
DELETE FROM EMPLOYEES;
DELETE FROM STAFF_TIME;
DELETE FROM EXPENSES;
DELETE FROM DOCUMENT_AUTHOR;
DELETE FROM ROLE;
DELETE FROM WORK_PACKAGES;
DROP TABLE PROJECTS;
DROP TABLE DOCUMENTS;
DROP TABLE CLIENTS;
DROP TABLE EMPLOYEES;
DROP TABLE STAFF_TIME;
DROP TABLE EXPENSES;
DROP TABLE DOCUMENT_AUTHOR;
DROP TABLE ROLE;
DROP TABLE WORK_PACKAGES;
DESCRIBE PROJECTS;
DESCRIBE DOCUMENTS;
DESCRIBE CLIENTS;
DESCRIBE EMPLOYEES;
DESCRIBE STAFF_TIME;
DESCRIBE EXPENSES;
DESCRIBE DOCUMENT_AUTHOR;
DESCRIBE ROLE;
DESCRIBE WORK_PACKAGES;
SELECT * FROM CLIENTS;
SELECT * FROM EMPLOYEES;
SELECT * FROM DOCUMENTS;
SELECT * FROM DOCUMENT_AUTHOR;
SELECT * FROM WORK_PACKAGES;
SELECT * FROM EXPENSES;
SELECT * FROM ROLE;
SELECT * FROM STAFF_TIME;
SELECT * FROM PROJECTS;
31 | P a g e
SQL QUERIES
List of all records in each table
SELECT * FROM CLIENTS;
SELECT * FROM EMPLOYEES;
SELECT * FROM DOCUMENTS;
SELECT * FROM DOCUMENT_AUTHOR;
SELECT * FROM WORK_PACKAGES;
SELECT * FROM EXPENSES;
SELECT * FROM ROLE;
SELECT * FROM STAFF_TIME;
SELECT * FROM PROJECTS;
Total cost of Actual Cost for a Work Package in a given month
SELECT WKP_ACTUAL_COST FROM WORK_PACKAGES
WHERE WKP_ACTUAL_START_DATE BETWEEN ‘01-DEC-2009’ AND ’31-DEC-2009’;
Total Projected Cost for a Project in a year
SELECT P_PREDICTED_COST FROM PROJECTS
WHERE P_ACTUAL_START_DATE BETWEEN ‘01-JAN2004’ AND ’31-DEC-2004’ AND
P_ACTUAL_FINISHING_DATE BETWEEN ’01-JAN-2004’ AND ‘01-DEC-2004’;
SELECT 1500 + 2550 FROM DUAL;
List of Employees and their Assigned Project Name
SELECT EMP.EMPLOYEE_ID,
EMP.PROJECT_ID
FROM EMPLOYEES EMP,
PROJECTS PRO
WHERE EMP.PROJECT_ID = PRO.PROJECT_ID;
32 | P a g e
Proof of SQL implementing
33 | P a g e
34 | P a g e
35 | P a g e
36 | P a g e
Proof of doing the queries
List of all records in each table
37 | P a g e
Total cost of Actual Cost for a Work Package in a given month
Total Projected Cost for a Project in a year
List of Employees and their Assigned Project Name
38 | P a g e
Normalization
39 | P a g e
Class Diagram
40 | P a g e
Python Code
####Claudia Start
from sqlalchemy import create_engine
engine = create_engine("oracle://ifrimc:[email protected]:1521/eclive.coventry.ac.uk")
Projects_table('PROJECTS'):
column(PROJECT_ID, integer, primary key= true)
column(PROJECT_NAME, string (30))
column(PROJECT_MANAGER, string (30))
column(P_PREDICTED_START_DATE, integer)
column(P_ACTUAL_START_DATE, integer)
column(PREDICTED_FINISHING_DATE, integer)
column(ACTUAL_FINISHING_DATE, integer)
column(P_PREDICTED_COST, integer)
column(P_ACTUAL_COST, integer)
column(CLIENT_ID, integer, foreign key= true)
column(WORK_PACKAGE_ID, integer foreign key= true)
column(EMPLOYEE_ID, integer foreign key= true)
class Project(object):
def __init__(self, project_id, project_name, project_manager, p_predicted_start_date,
p_actual_start_date, p_actual_finishing_date, p_predicted_finishing_date, p_predicted_cost, p_actual_cost):
self.project_id = ProjectID
self.project_name = ProjectName
self.project_manager = ProjectManager
self.p_predicted_start_date = PredictedStartDate
self.p_actual_start_date = ActualStartDate
self.predicted_finishing_date = PredictedFinishingDate
self.actual_finishing_date = ActualFinishingDate
self.p_predicted_cost = PredictedCost
self.p_actual_cost = ActualCost
def getproject_id(self):
return self.project_id
def getproject_name(self):
return self.project_name
41 | P a g e
def getproject_manager(self):
return self.project_manager
def getp_predicted_start_date(self):
return self.p_predicted_start_date
def getp_actual_start_date(self):
return self.p_actual_start_date
def getp_predicted_finishing_date(self):
return self.predicted_finishing_date
def getp_actual_finishing_date(self):
return self.actual_finishing_date
def getp_predicted_cost(self):
return self.p_predicted_cost
def getp_actual_cost(self):
return self.p_actual_cost
### Claudia End :)
42 | P a g e
############# CJ Start #############
work_packages_table ('work_packages'):
column(Work_Package_ID, integer, primary key= true)
column(Work_Package_Name, string (30))
column(wkp_predicted_start_date, integer)
column(wkp_actual_start_date, integer)
column(wkp_predicted_finishing_date, integer)
column(wkp_actual_finishing_date_cost, integer)
column(wkp_actual_cost, integer)
column(equipment_usage_cost, integer)
class Work_Packages (object):
def __init__(self, work_Package_ID, work_package_name ,wkp_Predicted_Start_Date, wkp_actual_start_date,
wkp_predicted_finishing_date, wpk_actual_finishing_date, wpk_predicted_cost, wpk_actual_cost,
equipment_usage_cost):
self.work_Package_ID = Work_Package_ID
self.work_package_name = Work_Package_Name
self.wkp_predicted_start_date = Work_Predicted_Start_Date
self.wkp_actual_start_date = Work_Package_Actual_Start_Date
self.wkp_predicted_finishing_date = Work_Package_Predicted_Finishing_Date
self.wkp_actual_finishing_date = Work_Package_Actual_Finishing_Date
self.wkp_predicted_cost = Work_Package_Predicted_Cost
self.wkp_actual_cost = Work_Package_Actual_Cost
self.equipmnet_uasage_cost = Equipment_Usage_Cost
def get(self):
return work_packages.__init__()
############# CJ End #############
43 | P a g e
######## DEVON STAR #########
class staff_time (object):
def __init__(self,staff_time_id,worked_hours,cost_of_staff_time):
self.staff_time_id = Staff Time ID
self.worked_hours = Worked Hours
self.cost_of_staff_time = Cost of Staff Time
def getstaff_time_id(self):
return self.staff_time_id
def getworked_hours(self):
return self.worked_hours
def getcost_of_staff_time(self):
return self.cost_of_staff_time
class documents (object):
def __init__ (self, document_id, document_name):
self.document_id = Document ID
self.document_name = Document Name
def getdocument_id(self):
return self.document_id
def getdocument_name(self):
return self.document_name
#### DEVON END #######
44 | P a g e
#Start of Jakes work PT
Base = declarative_base()
class EMPLOYEES(Base):
__tablename__ = 'EMPLOYEES'
EMPLOYEE_ID = Column(Integer, primary_key=True)
EMPLOYEE_NAME = Column(String)
EMPLOYEE_RATE = Column(Float)
ROLE_ID = Column(Integer)
ROLE_NAME = Column(String)
ROLE_RATE = Column(Float)
class EXPENSES(Base):
__tablename__= 'EXPENSES'
EXPENSE_ID = Column(Integer, primary_key=True)
EXPENSE_AMOUNT = Column(Float)
EXPENSE_TYPE = Column(String)
s.commit
s.close
#Tyers, M.Data types, variable, input output [online lecture] (2014) N/A Coventry University
#Gantan, X. (2014). Python's SQLAlchemy vs other ORMs. Available: http://www.pythoncentral.io/sqlalchemy-vs-
orms/. Last accessed 06/03/2015.
#End of Jakes work PT
45 | P a g e
#### Chevelle start ####
Class client(object)
Def_init_(self, client_id, client_name, client_sector, client_address, client_contacttelephone, client_contactname):
Def get client_id(self):
Return self.client_id = client_id
Def get client_name(self):
Return self.client_name = client_name
Def get client_sector(self):
Return self.client_sector = client_sector
Def get client_address(self):
Return self.client_address = client_address
Def get client_contacttelephone(self):
Return self.client_contacttelephone = client_contacttelephone
Def get client_contactname(self):
Return self.client_contactname = client_contactname
#### Chevelle end ###
# We were not able to properly arrange it and test the code for any errors due to
missing library(s) between the SQL and Python which are needed in order to be
able to connect the two
# of them, to be able to access the data in SQL and run it through python.
46 | P a g e
ITIL – CSI Information Technology Infrastructure Library Continual Service Improvement
ITIL definition and background
ITIL stands for information technology infrastructure library. It ITIL was developed by the UK government Office of
commerce in the late 1980s. Its original goal was to improve IT Service Management in the United Kingdom. ITIL
wasn’t used worldwide until mid-1990
The latest version of ITIL is v3 this came out in 2007 and is the latest version. ITIL is currently owned by AXELOS,
which is committed to the further improvement and future development of future ITIL versions.
ITIL is a best practice framework that is being used by both the public and private sectors as well as
internationally. It documents how IT resources should be centered to add business and service value, while
documenting processes, functions and roles.
ITIL is split into 5 core publications and within those publications are numerous processes
ITIL Service Strategy 1. Design coordination Service level management 2. Availability management 3. Capacity management 4. Supplier management 5. Information security management 6. Service catalogue management 7. IT service continuity management
ITIL Service Design o Change management o Release and deployment management o Knowledge management o Transition planning and support o Service validation and testing Service o asset and configuration management –
47 | P a g e
ITIL Service Transition o Change management o Release and deployment management o Knowledge management o Transition planning and support o Service validation and testing Service o asset and configuration management
ITIL Service Operation o Incident management o Problem management o Event management o Request fulfilment management o Access management o Monitoring of CSI Initiatives
Continual service improvement
CSI over sees the continual review and evaluation of the service for continual improvement. For example a school
never stays the same feedback checks are constantly reviewed and changes for the better are always implemented.
(axelos N/A)
Continual service improvement processes
Service Review: to constantly review the service as a whole, with the aim of improving overall service quality. And
providing more economical way of delivering the service to the customer
Process Evaluation: this involves evaluating the continual service requirements on a regular basis. If certain target
metrics are not met, when calculating averages. Then action will be taken to improve the service.
(Finbarr Callan 2015)
How businesses use CSI
Business’s constantly review the service they are outputting against their target goals. For example a pizza delivery
service has a metric target to deliver a pizza within 30 minutes. The company will then go on to measure how
many pizza’s take 30+ to deliver and measure the amount of time over. This type of service review will enable the
service provider to improve in the long run.
Businesses also constantly evaluate their services to foresee any potential issues also to fix any current underlying
issues.
Roles within CSI
CSI Manager
48 | P a g e
The CSI manager is responsible for the overall watch of the CSI process He will continually watch over the service to continually improve efficiency quality and reaching up and
above on targets. Process Architect
Processing all changes to processes and the service and making sure everything is running smooth This role often involves managing and improving the ITIL processes, (edward Chung 2014)
ORM What is ORM?
ORM, which stands for object relational mapping is used to link the chosen relational database with the code that
has been written in a programming language, ORM allows the programming data to be compatible with the
relational databases. (Jonssen, C. N/A)
The reason ORM’s are used is because the relational database andf the programming language are incompatible if
the ORM wasn’t used. The reason they are not compatible is because of the data types used, some of the data types
used by programming languages do not work in relational databases meaning if someone tried to link the
programming to the relational database without the ORM it would not work properly and have a lot of issues.
(Gantan, X 2013)
49 | P a g e
References
Albodour, R Entity Relationship Modeling [Online lecture] (2015) N/A Coventry University
Albodour, R Objects, Classes and Instances ...Diagrams and more [Online lecture] (2015) N/A Coventry University
Albodour, R Class Diagrams Part 2….multiplicities, Inheritance, Aggr [Online lecture] (2015) N/A Coventry University
axelos. (N/A). ITIL® Intermediate Module - Continual Service Improvement. Available:
https://www.axelos.com/qualifications/itil/itil-intermediate-level/continual-service-improvement. Last
accessed 28th august 2015.
Bayer, Michael. N/A. Key Features of SQLAlchemy. SQLAlchemy. [Online] Blogofile & Mako Templates for Python , N/A
N/A, N/A. [Cited: February Thursday 12th, 2015.] http://www.sqlalchemy.org/features.html.
Bayer, Micheal. N/A. SQLAlchemy. SQLAlchemy. [Online] Blogofile & Mako Templates for Python , N/A N/A, N/A. [Cited:
February Thursday 12th, 2015.] http://www.sqlalchemy.org/.
BBC. (N/A). Databases and data capture. Available:
http://www.bbc.co.uk/schools/gcsebitesize/ict/databases/2databasesrev2.shtml. Last accessed 09/02/2015.
Beal V. (2015) entity-relationship model (diagram), [Online] Available at:
http://www.webopedia.com/TERM/E/entity_relationship_diagram.html Last Accessed [13/02/2015]
Connolly and Begg (2014) Database System: A Practical Approach to Design, Implementation, and Management: Global
Edition. United Kingdom: Pearson Education Limited. Pp range 408-426
Dale, C. (2002). Rational Rose Tips. Available:
http://www1.coe.neu.edu/~ctd/ISY240/RationalRose.htm. Last accessed 06/03/2015.
Finbarr Callan. (2015). CSI. Available: http://www.slideshare.net/AxiosSystems/fy12-lead-nurtureitilv5.
Last accessed February 28th 2015.
Mike Chapple . (2015). What is database?. Available:
http://databases.about.com/od/specificproducts/a/whatisadatabase.html. Last accessed 25.02.2015.
edward Chung. (2014). ITIL v3 Foundation Notes: Continual Service Improvement. Available:
http://edward-designer.com/web/continual-service-improvement/. Last accessed 28th February
2015 .
dummies.com. (N/A). How to set Table Relationships in Access 2013.Available:
http://www.dummies.com/how-to/content/how-to-set-table-relationships-in-access-2013.html.
Last accessed 02/03/2015.
50 | P a g e
Gantan, X. (2013). Python's SQLAlchemy and Object-Relational Mapping.Available:
http://www.pythoncentral.io/introductory-tutorial-python-sqlalchemy/. Last accessed
06/03/2015.
Jonssen, C. (N/A). Object-relational mapping (ORM). Available:
http://www.techopedia.com/definition/24200/object-relational-mapping--orm. Last accessed
09/02/2015.
LucidChart (2015) ER Diagram Symbols and Meaning, [Online] Available at: https://www.lucidchart.com/pages/new/ER-
diagram-symbols-and-meaning?utm_expid=39895073-
112.KN9z3EZyRXqnCFsJWmj4FQ.1&utm_referrer=https%3A%2F%2Fwww.google.co.uk%2F Last Accessed [13/02/2015]
Mockaroo. (N/A). Need some mock data to test your app?. Available:
https://www.mockaroo.com/. Last accessed 02/03/2015.
MongoDB Inc.. (2015). nosql-explained . Available: http://www.mongodb.com/nosql-explained.
Last accessed 16.02.15.
Rouse M. (2015) entity-relationship model (ERM or ER Model) definition, [Online] Available at:
http://searchsqlserver.techtarget.com/definition/entity-relationship-model Last Accessed [13/02/2015]
Samra, P Copy of introduction to Databases and searching [Online lecture] (2015) 06/02/2015 Coventry University
stockoverflow. (2013). What are the pros and cons for using a database to store configuration information compared to
a File System. Available: http://stackoverflow.com/questions/10078511/what-are-the-pros-and-cons-for-using-a-
database-to-store-configuration-informati. Last accessed 25.02.2015.
Techtarget. (2015). What is database?. Available: http://searchsqlserver.techtarget.com/definition/database. Last
accessed 25.02.2015.
Tekstenuitleg.net. (N/A). Create a one-to-many relationship in Access.Available:
http://en.tekstenuitleg.net/articles/software/create-a-one-to-many-relationship-in-access. Last
accessed 02/03/2015.
Quinstreet Enterprise. (2015). What is SQL?. Available: http://www.sqlcourse.com/intro.html. Last
accessed 16.02.2015.