Database Case Study Report
Database Case Study Report
REPORT
MIS602 Data Modelling and Database Design
Contract
CREATE TABLE Contract ( Contract_ID INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY );
insert into contract values (01);
insert into contract values (02);
insert into contract values (03);
insert into contract values (04);
ALTER Table contract add column `Expiry date` date;
insert into contract (contract_id,`expiry date`) values (05,"2023-08-11");
UPDATE contract SET `expiry date` = '2022-11-26' WHERE contract_id = 4;
UPDATE contract SET `expiry date` = '2023-03-25' WHERE contract_id = 3;
UPDATE contract SET `expiry date` = '2023-06-25' WHERE contract_id = 2;
UPDATE contract SET `expiry date` = '2022-12-28' WHERE contract_id = 1;
Vendor
CREATE TABLE vendor ( vendor_name VARCHAR(30) NOT NULL );
alter table vendor add column vendor_id varchar (3);
insert into vendor (vendor_name, vendor_id) values ("Techsmith",01);
insert into vendor (vendor_name, vendor_id) values ("Adobe",02);
insert into vendor (vendor_name, vendor_id) values ("Autodesk",03);
insert into vendor (vendor_name, vendor_id) values ("Oracle",04);
insert into vendor (vendor_name, vendor_id) values ("Microsoft",05);
insert into vendor (vendor_name, vendor_id) values ("Kasperski",06);
insert into vendor (vendor_name, vendor_id) values ("SAP",07);
insert into vendor (vendor_name, vendor_id) values ("Scooter Software",08);
insert into vendor (vendor_name, vendor_id) values ("Rehat",09);
insert into vendor (vendor_name, vendor_id) values ("Underware",10);
License
CREATE TABLE license ( license_id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, SKU
VARCHAR(3), contract_id VARCHAR(3), asset_id VARCHAR(3) );
SELECT * FROM license;
/* contract 1, techsmith, snaig, device 1 and 2 */
insert into license (license_id, SKU,contract_id,asset_id) values (01,01,"01",01);
insert into license (license_id, SKU,contract_id,asset_id) values (02,01,"01",02);
/* contract 2, adobe, photshop, device 1 and 2 */
insert into license (license_id, SKU,contract_id,asset_id) values (03,02,02,02);
UPDATE license SET asset_id = 01 WHERE license_id = 03;
insert into license (license_id, SKU,contract_id,asset_id) values (04,02,02,02);
/* contract 3, adobe, lightroom, device 1 and 2 */
insert into license (license_id, SKU,contract_id,asset_id) values (05,02,09,01);
insert into license (license_id, SKU,contract_id,asset_id) values (06,02,09,02);
/* contract 3, microsoft, windows 8 device 1,2,3,4 + windows 10 device 5,6 */
insert into license (license_id, SKU,contract_id,asset_id) values (07,03,06,01);
insert into license (license_id, SKU,contract_id,asset_id) values (08,03,06,02);
insert into license (license_id, SKU,contract_id,asset_id) values (09,03,06,03);
insert into license (license_id, SKU,contract_id,asset_id) values (10,03,06,04);
insert into license (license_id, SKU,contract_id,asset_id) values (11,03,07,05);
insert into license (license_id, SKU,contract_id,asset_id) values (12,03,07,06);
Manager
create table manager (manager_id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, name
varchar(30));
insert into manager values (01,"Allan Amorim");
insert into manager values (02,"Will Camara");
Staff
CREATE TABLE staff ( staff_id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, name
VARCHAR(30), role VARCHAR(15), manager_id VARCHAR(3) );
insert into staff values (01,"Allan Amorim",01);
insert into staff values (02,"Will Camara",02);
insert into staff values (03,"Lisa Malady",01);
insert into staff values (04,"Matt Sauerbrown",01);
insert into staff values (05,"Brian Adams",02);
insert into staff values (06,"Gabriel Kalliman",02);
Devices
CREATE TABLE device (asset_id INT NOT NULL, device_type VARCHAR(30) NOT NULL,
device_name VARCHAR(30) NOT NULL, staf_id VARCHAR(30), PRIMARY KEY (asset_id));
/* 2. INCLUDING INITAL DEVICE DATA */
insert into device values (asset_id, device_type, staf_id) values (01,"notebook",01);
insert into device values (02,"desktop",01);
insert into device values (03,"notebook",02);
insert into device values (04,"destktop",02);
insert into device values (05,"tablet",02);
insert into device values (06,"notebook",03);
/* a new column was created later for device name */
insert into device (asset_id, device_type, staf_id, device_name) values (07,"netbook",07,
"Apple netbook");
insert into device (asset_id, device_type, staf_id, device_name) values
(08,"desktop",07,"Lenovo All-in-One");
This query answers questions such as "How many devices does each employee have" and
"What devices does employee X have available". It can be used when you need to buy new
equipment and know if employees have devices available.
Group by query
Counting how employee have a specific software using group by
This query answers questions such as "How many employees have X software" and can be
used when we need to examine whether all employees have access to the software, they need
to do their jobs.
Join Query
View for software name - license
This query answers questions such as "How much will be the expiration date of software
installed on machines" and "What software installed is closest to having its expiration date",
and can be used when we need to know which software to renew the subscription and using
this information, do the right decisions.
For a future update, this same query can be arranged in a variety of ways, like as device type, if
we wish to assume that notebooks will require Windows 8 and desktops will have Windows
10.
Nested Query
Find software that is about to expire
This query complements the one developed earlier, giving a more accurate idea of exactly
what software is due for expiration.
Data Visualization
If there are duplicate licenses, the information about how much software per device may
reveal them.
It does not happen in our scenario because each device only has one type of software.
However, it can show which device has more software installed than the others, allowing for a
review of the requirement for too many apps in a single device.
Visualizations that show the requirement for renewal or the risk of receiving an unauthorised
item are essential. Contract number 5 is going to expire in this case, and it should be reviewed.
Some updates, on the other hand, may be postponed or delayed by reviewing log contracts.
For example, if the license for Windows 8 is active for nearly a year and is already paid for, a
Windows 8 replacement for Windows 10 may not be recommended.
The presentation of how many and what types of software are in use may lead to knowledge
about a company's bias and tendencies, as well as a plan for upgrading. Simultaneously, some
representations of how many netbooks, tablets, or notebooks each employee has are
beneficial. It is normal to have one notebook and one desktop, but why does Willian have two
gadgets of the same type? Why does one of the staff members have two notebooks? Is there a
cause for this, or is it just a case of bad asset allocation? The display of how many and what
sorts of software are in use can provide insight into a company's biases and trends, as well as a
strategy for upgrading. At the same time, certain visual depictions of how many netbooks,
tablets, or notebooks each employee owns are useful. It's common to have one notebook and
one desktop computer, but why does Willian have two identical devices? Why is it that one of
the members of the staff has two notebooks? Is there a reason for this, or is it simply a result
of poor asset allocation?