0% found this document useful (0 votes)
10 views

Advanced Database

Database

Uploaded by

Sheriff Ayew
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Advanced Database

Database

Uploaded by

Sheriff Ayew
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Advanced Database Management System 1 2 3 4 5

Presentation

by
Sheriff Ayew
About Imani Impressionz

• Imani Impressionz ltd is a printing firm that deals solely with printing
and graphic designing.
• The company can be located at Kokomlemle and satisfies the needs
of about 1,000 – 3,000 customers yearly.
• Imani Impressionz has two of its company in Accra.
• The main office block is located at Kokomlemle, while the annex is
located at Accra-Newtown.
• Currently, the company has 48 workers of which forty (40) are full
time workers while the other eight are part time workers.
Functions of the database

Two

One

Track the use of Inventory


Hold relevant materials in the company
information on with regards to the
the daily job ongoing missing items in
acquisition to the firm. This is to make
make relevant sure money is not wasted
decision on the on buying new materials
growth of the all the time
company
EER Diagram for Database
Logical Table Derivation

Employee: (empid#, did#, brid# First name, Last name, Initials(Signature) gender,
address, dob, branch, job worked on, salary, date employed, status of employment
(full or part time), email, department, phone);

Job: (jid#, Name, date, time, price, date ordered, date submitted, job type);

Client: (cid#, jid# first name, last name, gender, initials(Signature), Date of Birth,
Address, Job ordered, email, city, phone);

Inventory: (itemid#, Name, date bought, supplier name, supplier address, unit price of
item,
price of item, quantity);

Company Branch: (brid#, Name, location, employees of branch);


Indexes

HR. Employee Table


CREATE UNIQUE INDEX idx_phone ON HR.Employees(phone);

JB.Client Table
CREATE UNIQUE INDEX idx_jobOrdered ON JB.Client(jobOrdered);

INV.Inventory Table
CREATE UNIQUE INDEX idx_supplier ON INV.Inventory(supplier);

CP.Company Branch Table


CREATE UNIQUE INDEX idx_location ON CP.Company_Branch(location);
Trigger

CREATE TRIGGER trgAfterInsert ON HR.Employees


FOR INSERT
AS
declare @empid int;
declare @firstname nvarchar(15);
declare @lastname nvarchar(15);
declare @address nvarchar(20);

select @empid=i.empid from inserted i;


select @firstname=i.firstname from inserted i;
select @lastname=i.lastname from inserted i;
set @address='Inserted Record -- After Insert Trigger.';

insert into SA67032016LOG.HR.Employees_log


(empid,firstname,lastname,address)
values(@empid,@firstname,@lastname,@address);

PRINT 'AFTER INSERT trigger fired.'


GO
Query

SELECT itemId,
nameOfItem, "Unit Price
Range" =
CASE SELECT empid, firstname,
WHEN unitPrice = LastName, dateEmployed,
0 THEN 'Invalid Item' employment_Status, Salary
WHEN unitPrice < FROM HR.Employees
50 THEN 'Under GHS 50' WHERE employment_Status =
WHEN unitPrice >= 'Full'
50 and unitPrice < 100 THEN AND (FirstName NOT LIKE 'A%')
'Under GHS100'
WHEN unitPrice >=
250 and unitPrice < 1000 SELECT jid, nameOfJob, price
THEN 'Under GHS1000' FROM JB.JOB
ELSE 'Over GHS WHERE price > 500
1000' ORDER BY price ASC
END
FROM INV.Inventory
ORDER BY itemId ;
Thank You for your Audience

You might also like