You are on page 1of 5

INFT3007 - The Information Resource

Assignment 2 Database Design & Implementation

Semester 1, 2017

Due Date Apr 26th 9:00am

Assignment 2 is due on Apr 26th, 9:00am. Each team will


upload the assignment to the Blackboard and
submit 1 hard copy of the assignment with a signed coversheet during tutorial on May
1st
demonstrate your assignment on Friday (Apr 28th) tutorial session

All members must be present for the demonstration. Groups without demonstrations will
be penalised for sections which are not demonstrated.

Weighting

25% of course mark

Assignment Information
This is a group assignment. However, there is an optional individual section (i.e. section 4)
that carries 2 bonus marks.

This assignment has 4 sections. Sections 1-3 are done in a group while section 4 is an
optional section completed individually to score 2 bonus marks.

Progress in each part for the group is monitored during tutorials. Note that all SQL scripts
created in this assignment needs to be commented for readability (Marks will be deducted
for uncommented, illegible SQL scripts).

Group Formation
You need to work in groups of 2-3 members for this assignment from your tutorial session.

The attached Group Formation Form needs to be filled and handed in the next tutorial
session (March 24th) which determines the groups and its members. You are unable to
change groups after it is formed (unless under extenuating situations with the approval of
the lecturer). If you do not submit a Group Formation Form, you are assumed to be in the
same group as in Assignment 1.

Section 1: Conceptual DB Design, EER Relational Mapping & Normalisation (5 marks)


In this section, you need discuss the requirements for Assignment 1 and EER model
returned with feedback from your lecturer with your group members, to revise the EER
model for the project that best meets the data requirements, transaction requirements and
business rules.

Next, the EER diagram needs to be mapped to a relational schema and normalised.

The relational model needs to be described in DBDL format. Sample DBDL format is given
in the below:

Page 1 of 5
ISBN (id, number, itemNo)
Primary Key id
Alternate Key number
Foreign Key itemNo references Book(itemNo)
ON UPDATE CASCADE, ON DELETE CASCADE

DBDL format is provided in your text Database Systems A Practical Approach to


Design, Implementation, and Management 6th Edition- Figure 17.8 Page 553.

Section 2: Implementation Database Script (5 marks)


Create a T-SQL script for the database design in section 1. You will create a database with
all the necessary tables and constraints: primary key, foreign key, not null, unique and
check constraints. The database must be populated with sufficient and meaningful
records for evaluation purpose.

Section 3: Stored Procedures (15 marks)


Implement the following stored procedures. Ensure that each stored procedure is tested
with appropriate sample data and appropriate error messages raised when required. Test
cases should be saved in a separate test script.

(1) Find top 10 most profitable products of all time

Procedure name usp_top10ProfitableProducts

Parameters None

Print the product id, product name, quantity sold and total profit to Office Store from the
Functionality
product

SQL script create_ usp_top10ProfitableProducts.sql

Test script test_usp_top10ProfitableProducts.sql

This stored procedure prints the top 10 most profitable products or Office Store. To find
Description the profit generated by each product item sold, deduct the cost price from the selling
price of the item sold.

(2) Create a store customer order

Procedure name usp_createStoreCustomerOrder

customerId (input) Id of a customer who places the order


products (input) a list of barcodes of product items are passed as a table-valued
parameter.
Parameters
employeeID employee handling the sales order
SalesOrderID (output) Output parameter that specifies the newly created Customer
Order id.

Functionality Create a customer order.

SQL script create_usp_createStoreCustomerOrder.sql

Test script test_usp_createStoreCustomerOrder.sql

Page 2 of 5
In this stored procedure, a customer id is passed in. If the customer id passed in is not
null and if the customer id exists, then you create a Customer Order for the specified
customer. Else if customer id is not null, create a new customer with the specified id.
Otherwise if customer id is null, then create order without a customer assigned to it.

Barcodes of product items are passed as a table valued parameter.

A customers order is created with order date as the current date, calculating total
discount, amount due etc. The newly created customer order id is passed as an output
Description
parameter.

Note that when a product is sold, the status of the product items with the specified
barcode must be changed to sold and sold price also inserted (after all discounts).
Also, available quantity for the product must be modified to reflect the available number
of items in store.

Note that all errors must be caught and handled. Appropriate error messages must be
raised. The stored procedure must be extensively tested in the test script.

(3) Create Payroll for Employees

Procedure name usp_createPayroll

start date (input) Start date for start of pay period


end date (input) End date for pay period
employee hours worked information (input) A table-valued parameter with employee
Parameters
id and hours worked for the pay period.
employee allowance information (input) A table-valued parameter with employee id,
allowance type id and allowance amount.
Create a pay slip in the database for the specified employees for the specified pay
Functionality
period.

SQL script create_usp_createPayroll.sql

Test script test_usp_createPayroll.sql

In this stored procedure, employee payslips for the given employees will be generated
and stored in the database. Note that base pay, taxable income, tax and net pay needs
to be calculated and stored for each payslip.
Description
Note that all errors must be caught and handled. Appropriate error messages must be
raised. The stored procedure must be extensively tested in the test script.

Ensure that appropriate sample data is used to test your database comprehensively. Also
ensure that appropriate error messages are generated.

Section 4: Research on SSD Storage and DBMS Design Individual Section (Bonus 2
marks)

You will do this section of the assignment individually and carry bonus 2 marks.

The statement SSD technology is rapidly becoming the secondary storage of choice
replacing magnetic disks. Explore SSD technology vs Magnetic Disks and the implications
of SSD technology on DBMS design and implementation.

Page 3 of 5
You can review recent industry and research articles in this emerging area to write up your
report. You should use a referencing style such as APA, IEEE when referencing others
work. You report must not exceed 5 pages.

Submission Requirements
Each group will submit both soft and hard copies for the assignment.

Sections 1-3: Soft copy submission (Group)


Soft copy submission is via Blackboard. Each group will submit a zip file which contains
the following items:
1. Database documentation containing requirements, revised EER Model and normalised
Relational Database Schema in DBDL
2. SQL Server Backup
3. SQL Script files

The SQL script files to be included are listed below.


Section SQL scripts

Database createDB.sql

create_usp_createCustomerOrder.sql
test_usp_createStoreCustomerOrder.sql
Stored create_usp_top10ProfitableProducts.sql
Procedures test_ usp_top10ProfitableProducts.sql
create_usp_createPayroll.sql
test_usp_createPayroll.sql

Section 1-3: Hard copy submission (Group)


Hard copy is to be submitted to your lecturer. The following items will be required for
submission.
Signed Group Assessment Cover Sheet
Printout of database documentation (item 1 above)

Section 4: Soft and hard copy submission (Individual)


Softcopy of the SSD Storage and DBMS Design report needs to be submitted via the
TurnItIn link. Hardcopy of section 4 report must be submitted along with a signed Individual
Assessment Cover Sheet.

Progress Monitoring
Each group must show their progress. Progress needs to be outlined in the PBL-AID tool
by the due date. Log in PBL-AID via http://col2p.com/studentindex.aspx . Log in
information will be provided at the tutorial.

Section Progress Due Date


Section 1 Finalized EER March 31st tutorial session
Section 2, Relational Model + Database script + April 7th tutorial session
Section 3 (i.) Draft scripts for
usp_top10ProfitableProducts
Section 3 (ii.) (iii.) Draft scripts for Submit online April 14th 5pm
usp_createStoreCustomerOrder and
usp_createPayroll

Page 4 of 5
Demonstration
All groups must demonstrate their database implementation. Group demonstration will be
held during 28th Apr tutorial session. Each members contribution will be evaluated
individually during demonstrations. Failure to attend the demonstration can result in a zero
grade for the assignment by the member of the group.

The assessment RUBRIC is given below:


Excellent Good Satisfactory Poor Fail
Section 1 - (5) (4) (3) (2) (0-1)
Conceptual DB All requirements are Most requirements are Documentation and Poor/missing Missing or poor
Design, EER accurately captured accurately captured EER model has requirements. EER requirements. EER
Relational Mapping and modelled in EER. and modelled in EER. errors/incomplete. The with many mistakes diagram, relational
& Normalisation The documentation is The documentation is relational model is and poorly schema is missing
complete, accurate accurate and mapped mostly mapped documented. Partial and/or poorly
and correctly mapped to relational model. accurately. relational model with constructed. No
to relational model. The relational schema Normalisation has no normalisation normalisation
The relational schema is normalised. omissions/errors. performed
is normalised.
Section 2 (5) (4) (3) (2) (0-1)
Database Script The T-SQL script The T-SQL script T-SQL maps to design The T-SQL script has Missing or poorly
maps to the earlier maps to the earlier for most cases. The missing/partially maps written script with
design accurately. The design accurately. The script executes to design. Many critical errors, missing content
script executes without script executes without correctly with some objects missing/errors objects, constraints
any errors. The code any errors. The code constraints. Partial in script. Partial or no and data.
is well- documented. is documented. data inserted to documentation of
All necessary tables Necessary tables and database. scripts. Missing or little
and constraints are constraints are shown. data inserted.
clearly shown. The The database is
database is populated partially populated.
with sufficient and
meaningful records for
evaluation purpose.
Section 3 Stored (5) (4) (3) (2) (0-1)
procedures The functionality is The functionality is The code has minor The code has major No code and/or basic
(SP1 5) implemented without implemented correctly. errors. The code is errors. It is poorly outline of functionality
(SP2 5) errors. The code is The code is partially partially documented documented and presented. No
(SP3 5) well-documented and documented and/or and tested. The code tested. functionality executes
presented. All tested. Major test compiles and executes or tested.
appropriate warning cases are and has at least 1 test
and error messages implemented. case.
are raised. All
appropriate test cases
are implemented to
verify the correctness.
Section 4 (5) (4) (3) (1-2) (0)
Research Question The research question The research question SSD and Magnetic Poor referencing and No submission.
is well-addressed. is addressed. disk technology is analysis. SSD
Excellent research Relevant research is discussed. Implications technology is not
and referenced work. referenced. Clear of SSD on DBMS sufficiently discussed.
Clearly articulated discussion on SSD design is only partially Impact of SSD
discussion on SSD technology, Magnetic discussed. Correct technology on DBMS
technology, Magnetics disks and some referencing style design is missing.
disks and implications implications of SSD followed.
of SSD technology in design of DBMSs is
design of DBMSs provided.

Page 5 of 5