You are on page 1of 10

ITECH 1006 - Database Management Systems – Summer Semester 2017

Assignment 2
Overview
For this assignment you will implement and query a database from a supplied ER
Diagram and Schema. You will be required to write the SQL statements to create
the database structures, to fill the database with data and to run queries on the
data.

Timelines and Expectations


Percentage Value of Task: 20%
Due: Friday in Week 11 (11:55 pm)
Minimum time expectation: 20 hours

Learning Outcomes Assessed


The following course learning outcomes are assessed by completing this
assessment:
 A1.design and implement a relational database using a database
management system
 A2.utilise a query language tools and techniques to obtain data and
information from a database
 K5. describe relational algebra and its relationship to Structured Query
Language (SQL)
 S1.interpret entity-relationship diagrams to implement a relational
database
 S2.demonstrate skills in designing and building a database application
using a commercially available database management system
development tool
 S3.use a query language for data manipulation

Assessment Details
Books For Everyone (BFE) is a company that sells books and e-books. The
company has provided you with a standard solution for the conceptual data model
(the ER diagram). You have been commissioned to continue your role (in your
capacity as a Database Management System consultant) and to write the SQL
statements to create the database and its tables, add data, and provide answer to
some of their everyday queries. The database should be created based on the ER
diagram provided at the end of this document. Some sample data are also
provided to be used for inserting data to tables. You are required to insert
sufficient data to test the reports given below.

CRICOS Provider No. 00103D Document1 Page 1 of 10


To implement the database
1. Translate the ER diagram provided into a relational schema using the
correct notations and standards for this course. It should include:
a. Table names
b. Attribute names and field types (as required by XAMPP)
c. Primary and foreign keys identified
2. Create a text file called nnnn_create.sql (where nnnn is your student
number). The file should include:
a. The SQL statements to create a database called bfe_nnnn (where
nnnn is your student ID)
b. The SQL statements to create the tables and the relationships
between them.
3. Create a text file called nnnn_insert.txt (where nnnn is your student
number). The file should include:
a. The SQL statements to load sufficient data into each table you have
created to test the queries given below. Sample data has been
provided, but you will need to include further data to test the
requirements. You should add at least one record to the existing
test data for each table (you will lose marks if you only insert the
sample data).
b. You are required to include your name as one of the customers (you
don’t have to have your address if you don’t want to), but you MUST
have your name and give your student id as the phone number.
4. Create a text file called nnnn_query.txt (where nnnn is your student
number). The file should include the SQL statements necessary to display
the following reports:
a. List all details of all the wholesalers, sorted by suburb in ascending
order.
b. List all the titles of all the books in inventory with their wholesaler’s
name, email, phone number and suburb.
c. List all the authors who are based in USA and who have a biography
on file. Print their name as ONE column with a suitable heading, and
show the number of books written by the author in inventory.
d. List all of the inventory by category. Display the title and the category
of each, sort in descending order of title.
e. List all reviews with reviewer name and review date and title of
inventory item. Also Include book title, author name and surname.
Order by reviewer name.
f. List all categories that have no inventory items.
g. Delete the all customers from postcode 3353.
h. Change the price of the inventory Item “A Brief History of Time” to
$15.99.

CRICOS Provider No. 00103D Document1 Page 2 of 10


i. List all the books and e-books with their authors. Print the name of
the authors and their roles in one column for each with an appropriate
title.
j. Insert an e-book as follows: the title is “Astrophysics for People in a
Hurry" (category Science) written by Neil deGrasse Tyson in 2017.
The author is based in USA, and no details are on file yet for this
author. The e-book price is $18 for the Kindle version, and the
abstract is: “What is the nature of space and time? How do we fit
within the universe? How does the universe fit within us? There’s no
better guide through these mind-expanding questions than acclaimed
astrophysicist and best-selling author Neil deGrasse Tyson.”.
k. Find the fulfilled orders made since 1st July 2017. List customer name
and surname, date of order, number of items ordered and total price.
l. Find the book which was ordered most often. List the author name
and surname and date published.

Your documentation should include:


1. A title page clearly stating your name and student ID and your tutor’s name.
2. A copy of the relational schema you have developed from the ER diagram
provided. Ensure that you ist any assumptions you have made.
3. A copy of the three files you are required to create included in the document
(ie nnnn_create.txt, nnnn_insert.txt and nnnn_query.txt - where nnnn is your
student number).
4. Full APA referencing of any resources you have used to complete your
submission

You should submit the following:


1. The documentation file described above EITHER as a MS word file or a
PDF. If you are using a mac, please submit in a PDF so I can be sure of
opening it. If you submit a compressed archive, please use zip only.
2. The nnnn_create.txt file (where nnnn is your student number).
3. The nnnn_insert.txt file (where nnnn is your student number).
4. The nnnn_query.txt file (where nnnn is your student number).
Please note that the SQL files must be either .txt or .sql because I will be running
them. If they are in a word or pdf file there will be extra characters that will prevent
the files from running without errors and THIS WILL COST YOU MARKS!

The assignment is to be submitted via the Assignment 2 submission box in


Moodle. This can be found in the Assessments section of the course Moodle
shell.

CRICOS Provider No. 00103D Document1 Page 3 of 10


ER Diagram
AUTHOR

REVIEW authorID
name
CATEGORY country
REVIEWER
reviewerID bio
reviewerID inventoryID
reviewText categoryID
name name
email reviewDate
description
avatar
customer

WRITTEN-BY

authorID
inventoryID
INVENTORY role

inventoryID
category
title
abstract
yearPublished
unitPrice WHOLESALER

wholesalerID
name
contactName
BOOK phone
email
E-BOOK-TYPE E-BOOK inventoryID address
wholesaler suburb
ebookTypeID inventoryID qtyInStock postcode
fileType EBookType
description country
comments

CUSTOMER
ORDER-LINE
ORDER
customerID
firstName orderID
orderID inventoryID
lastName
customerID quantity
phone
dateOrdered amount
email
dateFulfilled
address
postageAmount
suburb
discountApplied
postcode
loyaltyDiscount

CRICOS Provider No. 00103D Document1 Page 4 of 10


Sample Data for Tables.

CATEGORY
REVIEWER
name description Name email customer
Cooking Cookbooks, food and Anna Anna.coulter@bigpond.com.au
beverage encyclopedias Coulter
Sports Sports documentaries, Peter ptock@students.mit.edu.au
biographies and stories Tock
Children Books for all age groups to Toby tobymcm@westnet.net 6
15 McMillan
Science Fiction Deirdre thehappyreader55@gmail.com
Crime Fiction Castle
History Historical research and Jerry Fong jerryfong@iinet.net.au
ancient book reprints Jet Tila Jet747@gmail.com
General Fiction Any other fiction
Academic School, college, university
books
Health &
Wellbeing
Science Popular Science

Wholesaler
Name Contact Phone Email Address Subur Postco Country Comments
b de
Tuggerano Jack Pratt 02 6606 sales@tugbooks.com. 1 Jones St Tugge 2601 Australia Good prices on
ng 1458 au ranon health books
Bookbarn g
Mega James +6135555 sales@megatainment. 32 East St Perth 6140 Australia
Books McGrath 1549 com
Sporting Nadine 04487899 sales@sportingworld. 8 North Auckl 1141 New Christmas orders
World McMaster 87 co.nz Road and Zealand by December 10
Rare Books Steven 07516729 s.saunder@rarebooks 15 Albury Cabra 2166 Australia
Saunders 24 .com.au Street matta
Premiere Jodie 06571683 info@premierebooks. 1548 Glenfi 2167 Australia
Books Vaughn 42 com Hume Hwy eld
Book Peter +4107529 sales@book- 15 Boulos Lond 9911 UK Recalculate VAT
Magic Buttler 817 magic.co.uk Parade on
VIC Rupert 04985284 rb@vicentertainment. 62 Kew 3056 Australia Great Fiction
Entertainm Ballinger 17 net.au Yellowston selection
ent e Ave
Monsoon Doris +1174019 sales@monsoon.com 3 Lexin 78428 USA Minimum order
Books & Mackenzie 841 Ironworks gton $500 USD
Films Turnpike

CRICOS Provider No. 00103D Document1 Page 5 of 10


REVIEW
Reviewer Inventory Date Review
2 3 1/7/2015 Extremly well written book, a pleasure to read from cover to
cover.
1 2 15/6/2008 Well researched and a thoroughly great read!
4 1 30/9/2017 Enjoyed the recipes!
5 6 24/12/2012 A rip-roaring great story. Fantastic description of characters.
Can’t wait for the next book in the series.
6 3 24/2/2017 Good read, but not as detailed as I expected.
1 5 15/12/2016 A masterfully written tale.
3 7 1/4/2014 The kids loved this book!

E-Book Type
File Type Description
PDF Portable document format –
all devices
Kindle Kindle device, also readers
Audiobook
HTML Online only

CUSTOMER
First Last Phone Email Address Suburb Post- Loyalty
name Name code Discount
John Brigg 53159510 JohnnoBrigg@gmail.com 1 Bells Road Napoleons 3352 1.3%
Joe Summers 45613208 jsummers@yahoo.com 52 Main St Maryborough 3465
Sam deWinter 12356713 winter@xyz.net.au 2156 Skipton Sebastopol 3356
Rd
Mary Donald 13265413 flowers58@iprimus.com 98 Neil St Cressy 3373
Sally Fall 15626543 autumn@gmail.com 65 Commercial Clunes 3370 2.5%
St
Toby McMillan 040853185 tobymcm@westnet.net 65 Crest Ave Ballarat 3353
Pat Jones 049513572 patsyJ@anet.com.au 46 Wattle Ave Wendouree 3355 2.5%
Dick Matthews 21356467 d.matthews@mynet.com 7 Hepburn Daylesford 3460
Springs Blvd
Tommy Jones 51657896 whereistom@gone4good. 1254 Sturt St Ballarat 3353 4%
com
Barry McKenzie 32165489 bazza@adventure.com 47 Gillies St Ballarat 3350

AUTHOR
First Name Surname Country Bio Books written
Ina Garten UK In 1978, Ina Garten left her job as a budget analyst in 1 (author)
the White House to pursue her dream of operating a
specialty food store in the Hamptons. She is a frequent
2 (author)
contributor to major national magazines and writes a
recurring column in O Magazine.
Jack L. Chalker USA No info available 5 (author)
6 (author)
Stephen Hawking USA Stephen Hawking's ability to make science understandable 3 (author)
and compelling to a lay audience was established with the
4 (author)
publication of his first book, A Brief History of Time, which
has sold nearly 10 million copies in 40 languages.
Vera Brosgol USA No info available 7 (illustrator)

CRICOS Provider No. 00103D Document1 Page 6 of 10


Susan D. Kalior USA No info available 8 (author)
Aaron Reynolds USA No info available 9 (author)
Gary Mack USA Gary Mack is a leading sports psychology consultant and 10 (co-author)
counselor who has worked with athletes in the NBA, NFL,
NHL, WNBA, and Major League Baseball. He is president of
two consulting firms, Sports Assist and Planning Solutions; the
director of sports psychology for Griffey International; and
team counselor for the Phoenix Suns and Phoenix Mercury
David Casstevens USA No info available 10 (co-author)

INVENTORY
ID Title Cat. Unit abstract Year Quantity in Whole- E-book
Price published Stock (Book) saler type
(Book) (E-Book)
1 Cooking 1 $21.38 Ina’s most personal cookbook 2016 5 2 n/a
yet, Cooking for Jeffrey is
for Jeffrey
filled with the recipes Jeffrey
and their friends request most
often as well as charming
stories from Ina and Jeffrey’s
many years together.
2 Barefoot in 1 $24.79 Hearty boeuf Bourguignon 2004 8 2 n/a
served in deep bowls over a
Paris
garlic-rubbed slice of baguette
toast; decadently rich croque
monsieur, eggy and oozing
with cheese; gossamer crème
brulee, its sweetness offset by
a brittle burnt-sugar topping.
Here is the book that helps
you bring that spirit, those
evocative dishes, into your
own home.
3 A Brief 10 $14.00 A landmark volume in 1998 10 2 n/a
science writing by one of
History of the great minds of our time,
Time Stephen Hawking’s book
explores many profound
questions.
4 The Grand 10 $10.00 A landmark volume in science 2012 n/a n/a Kindle
writing by one of the great
Design
minds of our time, Stephen
Hawking’s book explores
many profound questions.
5 Midnight 4 $14.99 Midnight at the Well of Souls 2014 5 7 n/a
is the first book set in the Well
at the Well
World universe.
of Souls
6 The Sea Is 1 $7.99 This exciting, action-packed 1999 4 7 n/a
novel marks Jack Chalker's
Full Of
triumphant return to his
Stars celebrated multivolume saga:
The Well World. The Sea Is
Full of Stars explores an
unknown interstellar
civilization.
7 Leave Me 3 $10.33 One day, a grandmother 2016 16 3 n/a
shouts, "LEAVE ME ALONE!"
Alone!
and leaves her tiny home and
her very big family to journey
to the moon and beyond to
find peace and quiet to finish

CRICOS Provider No. 00103D Document1 Page 7 of 10


her knitting. Along the way,
she encounters ravenous
bears, obnoxious goats, and
even hordes of aliens!
8 The Simple 1 $6.00 A decade of solutions from a 2017 n/a n/a Kindle
psychotherapist regarding
Guide to
family and romantic
Feeling problems, high anxiety, deep
Better depression, self esteem, and
life success.
9 Creepy 3 $11.95 Jasper Rabbit loves carrots— 2017 n/a n/a Kindle
especially Crackenhopper
Carrots
Field carrots.
He eats them on the way to
school.
10 Mind Gym: 2 $24.68 In Mind Gym, noted sports 2002 n/a n/a Audio
psychology consultant Gary
An book
Mack explains how your mind
Athlete's influences your performance
Guide to on the field or on the court as
Inner much as your physical skill
does, if not more so.
Excellence

ORDER
ID Customer Date Ordered Date Fulfilled Postage Disc.Applied Order-lines
(inventory id,
quantity, amount)
1 1 18/1/2017 19/1/2017 - 1.3% 1, 1, $21.38
8, 1, $6.00
2 6 15/12/2017 18/12/2017 $5.50 - 3, 1, $14
3 2 1/9/2017 6/9/2017 $9.50 - 7, 2, $10.33
9, 1, $9.90
4, 1, $10
4 5 11/10/2017 13/10/2017 $9.50 2.5% 1, 1, $21.38
5 3 1/12/2017 3/12/2017 $9.50 10% 1, 1, $19.24
6 6 8/1/2018 - - 4, 1, $10
7 4 5/6/2017 10/6/2017 $9.50 - 1, 1, $21.38
2, 1, $24.79
6, 1, $7.99
8 7 3/1/2018 $5.50 - 5, 1, $14.99
9 8 28/5/2017 30/5/2017 $5.50 - 8, 1, $6.00
3, 1, $14
10 9 7/10/2017 7/10/2017 - 4% 4, 1, $10

CRICOS Provider No. 00103D Document1 Page 8 of 10


Marking Criteria/Rubric
Assessment Criteria and Marking Overview Tasks Marks
1. Presentation 5
 Cover page indicating student name and number and tutor name.
 Page numbers included in report
 Index giving page numbers of various sections
 Overall presentation of the report
 Full APA referencing of all materials used and full disclosure of assistance from all
sources including tutors and other students.
2 Revised Schema 10
 Any assumptions explained
 All tables included
 Data types correct
 Primary and foreign keys indicated and referenced correctly
3. Create Statements 10
 File runs with no error messages
 Database created correctly
 All tables created correctly
 All primary and foreign keys created correctly
 Any deletion anomalies corrected
4. Insert Statements 10
 File runs with no error messages
 Default data is inserted correctly
 Additional data for testing is inserted
 Student’s name and number are included in customer file
5. SQL statements Total 65 Marks
Qa 4
 Correct syntax
 Correct table used
 Correct use of sorting statement
Qb 4
 Correct syntax
 Correct tables used
 Where statement correctly formulated
Qc 5
 Correct syntax
 Correct table used
 Where statement correctly formulated
Qd 5
 Correct syntax
 Correct table used
 Where statement correctly formulated
 Correct indication of desired values
Qe 5
 Correct syntax
 Correct tables used

CRICOS Provider No. 00103D Document1 Page 9 of 10


 Where statement correctly formulated
 Correct sorting statement used.
Qf 5
 Correct syntax
 Correct tables used
 Correct answer given
Qg 6
 Correct syntax
 Correct table used
 Correct result for deletion
Qh 6
 Correct syntax
 Correct table used
 Correct result for update
Qi 6
 Correct syntax
 Correct tables used
 Where statement correctly formulated
Qj 7
 Correct syntax
 Correct tables used
 Inserts done in correct order with correct results
Qk 6
 Correct syntax
 Correct tables used
 Correct calculation of total price
 Where statement correctly formatted
Ql 6
 Correct syntax
 Correct tables used
 Where statement correctly formatted
Total 100

Feedback
Feedback will be provided via the marked rubric with comments handed out in the tutorial 2 weeks
after the submission date. The marks will also be available on FDL Marks at this time.

Plagiarism
Plagiarism is the presentation of the expressed thought or work of another person as though it is
one's own without properly acknowledging that person. You must not allow other students to copy
your work and must take care to safeguard against this happening. More information about the
plagiarism policy and procedure for the university can be found at
http://federation.edu.au/students/learning-and-study/online-help-with/plagiarism.

CRICOS Provider No. 00103D Document1 Page 10 of 10

You might also like