Documente Academic
Documente Profesional
Documente Cultură
Database project
Securitas
Submitted To:-
Submitted By:-
Prof.Imran Khan
Nikunjkumar Patel
C0678626
1.
TABLE OF CONTENT
SR
Contents
N
o
1
1.1
1.2
1.3
2
2.1
3
3.1
4
4.1
5
5.1
5.2
5.3
Requirments Analysis
Overview
of
Company
and
Products
Customer
Sales Invoice
Entity &
Attribute
Identification
Conceptual
Design
ER
Diagram
Logical Model
Normalization &
Relational
Schema
Physical
Model
Database
creation
Implementation
of
Physical
Model
Create Database
Tables
Identify Business
Rules/Database Constraints
Constraints
Testing
Pg
No:
Overview of Company
Overview of Company and Services
a. Name: Nikunjkumar Kiritkumar Patel
b. Student Id: C0678626
c. Company Name: Securitas Canada, Ltd
d. Company Type: Service Provider
e. Company Description:
Securitas, a global leader in the security industry, has been providing security services as
well as on-site guarding, remote guarding, mobile guarding, technology solution and investigation
services according to the requirement of the client.
f. Product/ Services
1 Services
Services
Service_code(PK)
Service_name
Service_type
Service_duration
Client_id
Service_charge
Employee_id
Employee_name
2.
To
Bob Joy
Technology Centre
Surrey Research Park
Guildford Surrey GU2 7YG
DURATION
DATE
02/05/2016
DESCRIPTION OF SERVICES
2/05/2015 to
28/4/2016
DAYS /
HOURS
WORKED
RATE PER
DAY /
HOUR
20$
2000$
SUBTOTAL
2000.00$
VAT @ 17%
350.00$
TOTAL
2350$
TOTAL
Data type
Description
Client_ID
Varchar(20)
Primary key
Client name
Varchar(20)
Address
Varchar(40)
Client
communication
address
Country
Varchar(20)
Client country
Phone
Long
Date
Employee_ID
Varchar(20)
Data type
Description
Memo_Id
Varchar(20)
Client_ID
Varchar(20)
Service_Contract_date
Date
Subtotal
Number
Discount
Varchar(20)
Discounts gives
discount
Varchar(20)
Employee_ID
Varchar(20)
1.3 Branch
Attribute
Data type
Description
Branch_ID
Varchar(20)
Branch_Location
Varchar(20)
Branch_Manager
Varchar(20)
Attribute
Data type
Description
Service_ID
Varchar(20)
Service name
Varchar(20)
Service name
Hour cost
Number
Requirement
Varchar(20)
Special
discount
or
requirement
Service Category
Varchar(20)
Service category
Discount
Number
Discount
it
gives
the
information of discount
1.5 Employee
Attribute
Data type
Description
Employee_ID
Varchar(20)
Employee_name
Varchar(20)
Employee Name
Address
Varchar(20)
Employee Address
Phone
Number
1.6 Contract
Attribute
Data type
Description
Contract_ID
Varchar(20)
Contract date
Date
Service_ID
Varchar(20)
Client_ID
Varchar(20)
Memo_ID
Varchar(20)
Contract_Duration
Number
ER DIAGRAM
Normalization
First Normal Form (Invoice Table)
Before Normal Form
Memo_ID
Contrac Subtotal
t date
Employee
_id
Client_ID
Branch_Id
Branch_loc
ation
SEC0001
1/05/20
16
$480
E101
CST0001
SCB
scarboroug
h
SEC0001
01/05/2
016
$480
E102
CST0001
BMT
Brampton
SEC0002
02/06/2
016
$120
E102
CST0002
DAT
Downtown
Contrac Subtotal
t date
Employee
_id
Client_ID
Branch_Id
Branch_loc
ation
SEC0001
1/05/20
16
$480
E101
CST0001
SCB
scarboroug
h
SEC0001
01/05/2
016
$480
E102
CST0001
BMT
Brampton
SEC0002
02/06/2
016
$120
E102
CST0002
DAT
Downtown
Memo_I
D
Contract
date
Subtotal
Employe
e_id
Client_I
D
Branch_
Id
Branch_l
ocation
SEC0001
1/05/2016
$480
E101
CST000
1
SCB
scarboro
ugh
SEC0002
02/06/2016 $120
E102
BMT
SEC0003
04/06/2016 $120
E103
CST000
2
CST000
2
Brampto
n
Downto
wn
DAT
10
Memo_I
D
Contract
date
Subtotal_
Employe
e_id
Client_I
D
E101
E102
CST000
1
CST000
2
(2) Branch
Branch_
Id
Branch_l
ocation
SCB
scarboro
ugh
BMT
Brampto
n
DAT
Downto
wn
Third Normal Form ( All Tables are already in Third Normal Form)
11
Relational Schema
Client(Client_ID, Clientrname, Address, Country, Phone, Employee_ID)
Contract (Contract_ID, Contract_Date, Contract_Duration, Client_ID, Memo_ID, Service_ID)
Employee (Employee_ID, Employeename, Address, Country, Phone)
Paymentmemo (Memo_ID, Service_Contract_Date, Subtotal, Discount, Employee_ID, Branch_ID,
Contract_ID, Client_ID)
Services (Service_ID, Service_Name, Requirement, Service_Category, Discount)
Branch (Branch_ID, Branch_Location, Branch_Manager)
12
13
Insert Command:
INSERT INTO client(Client_ID, Clientrname, Address, Country, Phone, Employee_ID) VALUES
('c101', 'Adam', 'Aligned Assets,Unit 5 River Court, Albert Drive,Woking, Surrey, GU21 5RP', 'UK', '+44
(0) 1483 717 950', 'e101'),
('c102', 'Smith', 'dsfsd', 'UK', '+44 (0) 1483 718 960', 'e102'),
('c103', 'Jones', 'Merrion Way, Leeds LS2 8NZ, United Kingdom\r\n', 'UK', '+44 (0) 1423 888 690', 'e103'),
('c105', 'Wiiliams', 'Market Place, Thorne, Doncaster DN8 5DJ, United Kingdom\r\n', 'UK', '+44 (0) 1423
658 543', 'e104'),
('c106', 'Davies', '11 Market Pl, Normanton WF6 2AU, United Kingdom\r\n', 'UK', '+44 (0) 1423 666 960',
'e105'),
('c107', 'Richardson', 'No1 Leeds, 26 Whitehall Rd E, Leeds LS12 1BE, United Kingdom\r\n', 'UK', '+44
(0) 1469 821 690', 'e106'),
('c108', 'Gray', 'B1222, York YO19 4RN, United Kingdom\r\nWebsite\r\nDirections\r\n', 'UK', '+44 (0)
1435 018 920', 'e107'),
('c109', 'Rose', 'Western House, Western Way, Bradford BD6 2SZ, United Kingdom\r\n', 'UK', '+44 (0)
1439 878 690', 'e108'),
('c110', 'Miller', 'West Bretton, Wakefield WF4 4LG, United Kingdom\r\n', 'UK', '+44 (0) 1432 178 690',
'e109'),
('c104', 'Taylor', 'Dry Sand Foundry, Foundry Square, Leeds LS11 5DL, United Kingdom\r\n', 'UK', '+44
(0) 1460 998 210', 'e110');
14
15
16
For Paymentmemo
ALTER TABLE Paymentmemo
ADD FOREIGN KEY (Branch_ID)
REFERENCES Branch(Branch_ID);
ALTER TABLE Paymentmemo
ADD FOREIGN KEY (Employee_ID)
REFERENCES Employee(Employee_ID);
ALTER TABLE Paymentmemo
ADD FOREIGN KEY (Discount_ID)
REFERENCES Discount(Discount_ID);
For Services
ALTER TABLE Services
ADD FOREIGN KEY (Discount_ID)
REFERENCES Discount(Discount_ID);
17
VALID
INVALID
2.Primary Constraint
VALID
INVALID
18
3.UNIQUE CONSTRAINT
INVALID
VALID
19
For Paymentmemo
ALTER TABLE Paymentmemo
ADD CHECK (Subtotal>0);
ALTER TABLE Paymentmemo
ADD CHECK (Discount>20);
ALTER TABLE Paymentmemo
ADD CHECK (Service_Contract_Date>'2016-01-01');
For EMPLOYEE
ALTER TABLE Employee
ADD CHECK (Country = 'canada' or Country='UK');
For BRANCH
ALTER TABLE Branch
ADD CHECK (Branch_Location = 'scarborough' or Branch_Location = 'markham' or Branch_Location =
'north york' or Branch_Location = 'etibicoc' or Branch_Location = 'Brampton' or Branch_Location =
'missisaga' or Branch_Location = 'brimly');
For Contract
ALTER TABLE Contract
ADD CHECK (Contract_Date>'2016-01-01');
ALTER TABLE Contract
ADD CHECK (Contract_Duration >= 3);
For Services
ALTER TABLE Services
ADD CHECK (Service_Category = 'full time' or Service_Category ='part time');
20
VALID
INVALID
2
VALID
INVALID
3
VALID
21
INVALID
4
VALID
INVALID
22
23