You are on page 1of 11

ITDT5.

220 Data
Assessment 2: Database Assignment
Semester 2 2014
Due Date:
Type:
Weighting:
Marks:

Introduction:

6/11/2014
Individual
40% of your final mark
100

This assignment is worth 40% of your total mark for Data. It is


designed so that students can implement simple database designs; to
solve given business problems.

Instructions:
Your assignment must be submitted with a standard cover sheet.
Assignments must be handed in before 8:15am on the due date.
You must have a copy of all files on your H: You must also load a copy into
EIT Online. (See page 3)
All questions must be completed to a reasonable standard.
All assessments must be handed in following the rules stated in the Degree
Handbook.
Extensions can only be approved by the Programme Coordinator.
Marking:

Part A:

50

Part B

25

Part C:

25

Total:

100

Page - 2

Contents
Part A: Business Rules .................................................................................................. 5
A1: Auckland Zoo.......................................................................................................... 5
A2:Tricks ....................................................................................................................... 6
Part B: ............................................................................................................................ 7
Database Creation And Insertion of Data ...................................................................... 7
Part C: SQL Queries ..................................................................................................... 9

Complete all questions

Page - 3

Submitting Softcopies
You are required to submit a softcopy you must:
Have a copy of the file(s) on your H:\.
You are required to upload only one file.
o In the case of multiple files zip these into one file

You must upload a softcopy to the drop box found into EIT Online.

Dates for up loading the assignment follow the same rules as for submitting normal
assignments stated in the Degree Handbook

Computer failure is not an adequate excuse for late submissions. i.e. It is not
advisable to upload your assignment just before the due date. Allow adequate time.

Note

You will be given instructions in class on how to upload your assignments


If a softcopy cannot not be found in the appropriate drop box on EIT Online or on your
H:\ drive you may be awarded zero marks for that section
Allow adequate time.

For any SQL statements include comments


e.g.
/**************************************************************************************
This section creates tblcustomer
cutFirstName Stores customer First Name bla bla bla
*************************************************************************************/

Name your database DB<<your name.>>


e.g .
DBGrahamHenry

Assessment Schedule
8
9
10

11
12
13
14
Study
Week

8-Sep
15-Sep
22-Sep
29-Sep
6-Oct
13-Oct
20-Oct
27-Oct
3-Nov

9-Sep
16-Sep
23-Sep
30-Sep
7-Oct
14-Oct
21-Oct
28-Oct
4-Nov

10-Sep
17-Sep
24-Sep
1-Oct
8-Oct
15-Oct
22-Oct
29-Oct
5-Nov

11-Sep
18-Sep
25-Sep
2-Oct
9-Oct
16-Oct
23-Oct
30-Oct
6-Nov

10-Nov

11-Nov

12-Nov

13-Nov

Page - 4

12-Sep
19-Sep
26-Sep
3-Oct
10-Oct
17-Oct
24-Oct
31-Oct
7-Nov Assignment
Due
14-Nov

PART A: Business Rules

50 Marks

A1 Auckland Zoo
Animals from all over the world are sent to Auckland Zoo. Countries like Africa
send many animals. Auckland Zoo are proud to have four African Loins. On
arrival each animal is assigned a zoo keeper to oversee its care. Some
keepers look after many animals. e.g. The keepers in the Bird Aviary look
after many birds. Zoo keepers belong to a department. Each department has
one manager who is a zoo keeper. Management has a policy that all people
working at the zoo, including the CEO, should have a hands on approach and
should supervise at least one animal. Animals are housed in specially
designed buildings. Each building has rooms/enclosures . Each
room/enclosure may house at least one animal. E.g. All the loins are in The
Loin Enclosure. Some rooms/enclosures dont house animals. e.g. offices,
canteen. Some animals put on shows for the public. An animal may have
more than one show a day. e.g Jumbo the elephant has a morning and
afternoon show. A team of independent vets look after the health of the
animals. Each animal will have at least one health check a year. This will be
performed by at least one vet and involve a blood test that may show the
presence of at least one disease,
.You can assume vets are area subcontracted by the zoo and are therefore
not employed by the zoo. i.e. Vets dont supervise any animals
Using Viso create a ERD that follows the above business rules
Your entity must have
Appropriate name
Primary Key
At least 3 other fields for each entity
Any required foreign fields
Linked to other tables using appropriate cardinality
Deliverables for Part A1
Softcopy PDF of ERD diagram and business rules

Page - 5

A2 Tricks
The Seal Trainers are developing a new show. Each trainer is responsible for
developing at least one new trick. Each trick will be performed by at least one
seal and involve the use of at least one piece of equipment. Seals use can
do more than one trick. Equipment can be used in more than one tricks
The following ERD has been produced

At least one extra entity is required for the physical implementation.

A softcopy of the above ERD can be found on EIT OnLine. Download the file and
then modify the ERD diagram to show all the relationships including optionality
and cardinality.
You will need to add
o Additional tables(s) with correct relationships
o Add appropriate fields for these new table(s) including key Fields and
foreign fields
1) Write out the business rules for the new ERD.
Deliverables for Part A2
Softcopy PDF of ERD diagram and business rules
(For the revised structure)

Page - 6

PART B:
Database Creation and Insertion of Data

25 Marks

For this section you must construct some DDL SQL statements. Write code to
construct and populate the tables in the ERD given below.
The Zoo has a Merchandise shop that sells products to people visiting the zoo.
Customers choose items and then proceed to the checkout where an operator totals
their order
Relationships
A customer can have many invoices
Each invoice belongs to one customer
Each invoice is processed by one checkout operator
A checkout operator processes many invoices
Each Invoice has many lines
Each line appears only on one Invoice
Each product appears on many lines
Each line has only one product
Calculated fields
OrderlineCost = Product Unit Price * Quantity
OrderCost = sum of orderlines
tblCustomer
PK

CustomerID
CustFirsname
CustLastName
CustAddress
CustCity
CustPhone
Plus 2 others

tblOrderLine

tblProduct
PK

ProductID
ProductName
ProductUnitPrice

PK

tblOrder

OrderLineID

PK

FrnProuctID
FrnOrderID
Quantity
OrderlineCost*

OrderID
frnStaffID
frgnCheckOpID
Datetime
OrderCost*

tblCheckOutOp
PK

CheckOpID
StaffFirstname etc

Continued next page


Requirements:
Page - 7

Create a SQL script which creates all the tables.


o Include appropriate comments
o Each column is to have
appropriate data type
appropriate field annotations e.g. null and not null etc
o Each table is to have the following
an auto-increment primary key
at least one index
at least one unique index
referential integrity if appropriate
Create a SQL script that populates each of the tables
o At least five rows of data for each table

Deliverables for Part B


o
o

Softcopy zipped and uploaded to EITonline


Retain a softcopy on your H Drive
Demonstration to lecturer (Authenticity certificate signed)
You must present you text file in Sections
e.g This part of the text creates and populates the customer table.

Page - 8

PART C: SQL Queries

25 Marks

For this section you must construct some DML SQL statements
A database has been constructed based on the following ERD diagram and
associated business rules.
.
tblCustomer
tblJob
tblTrade
PK

PK

JObID

TradeID
TradeName
Tr_Nos
Tr_Street
Tr_Suburb
Tr_City
Tr_Hourlyrate

frgnCustomerID
frgntradeID
job_timestamp
job_Hours
jobMaterials
Job_SubTotal*'
Job_GST*
Job_Cost*

PK

Cu_NameID
Cu_FirstName
Cu_LastName
Cu_Gender
Cu-HouseNumber
CU_Street
Cu-Suburb
Cu_City
Cu_DOB
Cu_JOB
CU_Income

Business Rules
Many to many relationships.
A consumer can hire many tradesmen.
A tradesmen can be hired by many consumers
One to many relationships
A consumer can have many jobs done
Each job is done for one consumer
A tradesman can complete many jobs
A job is completed by one tradesman
Note
Job_SubTotal = job_Hours*Tr_HourlyRate
Job_GST = JobSubTotal *.15
Job_Cost = Job_SubTotal + Job_GST
Setting up the database
1. Download Database for Assignment .zip from EIT Online
2. Extract all files
3. Copy the following files to the C:\ drive
a. Customer_SS.csv
b. JOb_SS.csv
c. Trade_Spreadsheet.csv
4. Run DBAssignmentPartC .txt in MYSQLConsole
This should create a database called DBAssignmentPartC with the following
tables tblCustomers, tbltrade and tblJob
o Check by typing
show databases;
show tables;
etc;
A copy of the DDL code used to create the tables can be found on page Error!
Bookmark not defined.
Page - 9

Using table tblCustomers you must produce queries to do the following.


Each question is to have its own unique query. i.e. The same query cannot be used
to answer more than one question.
1. A query using at least one of the Boolean operators (not, and ,or)
2.

A query using at least two of the Boolean operators (not, and ,or)

3.

A query using at least three of the Boolean operators (not, and ,or)

4.

A query that produces a calculated field result from multiple fields

5.
6.

A query that uses a function (original non-trivial


(i.e.. A function other than simple ones like max, min)
A query that uses an Boolean operator and a calculated field result

7.

A query that uses an Boolean operator and a function

8.

A query that uses an regular expression

9.

Repeat question 2 and 3 using at least two tables

10. One query of your own choosing

Queries must
Have appropriate comments
Have appropriate fields.
Have appropriate sorting.

Deliverables for Part C


Softcopy zipped and uploaded to EIT Online
Retain a softcopy on your H Drive
o Demonstration to lecturer (Authenticity certificate signed)

Page - 10

Assistance to other students


Students themselves can be an excellent resource to assist the learning of fellow
students, but there are issues that arise in assessments that relate to the type and
amount of assistance given by students to other students. It is also important to
recognise what types of assistance are beneficial to anothers learning and also
what types of assistance are acceptable in an assessment.

Acceptable Assistance
o Study Groups
o Discussion
o Testing another students work and giving them the result of that
testing
o Sharing reading material

Unacceptable Assistance
o Working together on one copy of the assessment and submitting it
as your own work
o Telling another student what to write
o Giving another student your work
o Copying someone elses work (this includes work done by
someone not on the course)
o Changing/Correcting another students work for them
o Copying from books, Internet etc. and submitting it as your own
work. Anything taken directly from another source must show
the source alongside the quotation.

Note:
o You must use your own test data as the source for your data values
to input
o If you use another students data as the source for your input data,
your assignment will not be marked

Page - 11

You might also like