RELATIONAL DATABASE DESIGN

  

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

You have been tasked to turn these data into a relational database. You will need to build the database and write a report about what you did. You only need to submit the report. It should have the following sections:

a. Introduction – Introduce the business requirements and describe one business rule and one use case you can identify from the scenario given above.

10 marks

b. ER Diagram – Identify the entities and relationships in the scenario given above and draw an ER diagram showing the entities, attributes, relationships, and cardinality. Do not decompose any of the relationships at this point.

10 marks

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

c. Database Schema – Decompose the design to create a schema to store the data in a suitable normal form (2NF or 3NF). Say which normal form the design is in and justify your choice. List the tables and show the fields, primary keys, and any foreign keys in your schema. Describe any assumptions you have made or any additional fields you have added to your design. Make sure all the primary keys are a sensible choice and introduce new fields if needed. Draw a schema diagram to illustrate your design.

20 marks

d. Create Tables – Create a MySQL database to store the schema that you designed in part c. above. Create the tables using SQL statements and reproduce the code in your answer report. Define the keys and choose appropriate data types and any other restrictions you think are required.

20 marks

e. Insert the Data – Insert the data given above into the appropriate tables. Give a single example of an SQL statement that you used to insert one row of data into one of the tables.

10 marks

f. SQL Queries – Carry out the appropriate SQL queries of answering the following questions. For each query, give the SQL code and the result of running the query on the data in your database. Marks are given by each question.

i. Return a list of all dog names (2).

ii. Return a list of all dog breeds, showing each breed only once (3).

iii. Write a query to count how many dogs have the string “Labr” in their breed (2).

iv. Calculate the average age of all dogs in the kennel (2).

v. Calculate the average age of dogs by breed (3).

vi. Find the breed of dog that has an average age of more than 8 (4).

vii. List all the dog names along with their owners’ names (4).

viii. List all the dogs who have had a vet note recorded. Give the name of the dog and the date of the vet note (5).

ix. List all dogs, giving their name, and if a dog has had a vet visit, give the note for the visit, otherwise, if the dog has not visited the vet, return null in the vet note field (5).

2

>Assignment ONE

RELATIONAL DATABASE DESIGN

Introduction

“It’s a Dog’s Life” is a kennel which operates just outside the village of Newtown. The kennel’s function is to look after dogs while their owners are out of town. To help with the running of the kennel, they maintain a spreadsheet of the name, breed, and age of each dog who is staying with them, as well as the name, address and phone number of each dog’s owners. The database also stores special instructions for the care of each dog, as well as which kennel room the dog is staying in, and a note of the unique microchip number which each dog has implanted in their neck. Every dog must have a chip number. Vet notes are added to the spreadsheet if a dog is seen by the vet and vet notes must be associated with a single dog.

The current way in which the data are stored is shown in the table below.

Note

that each person can own more than one dog and each dog can have more than one owner. The vet columns are empty unless the dog has been seen by the vet. A vet visit cannot exist without a dog, of course.

Fido

Labrador

10

The Meadows Newtown FK40 7LL

01234

567890

545682

None

1

Labrador

Sarah Smith

The Meadows Newtown FK40 7LL

01234
567890

None

Sarah Smith

The Meadows Newtown FK40 7LL

01234
567890

3

6

Frank Jones

14 Main Street Newtown FK40 6TT

0376
458015

Dog Name

DogBreed

Dog Age

Owner

Owner Address

Owner Phone

DogChipNo

Note

Room

Vet ID

Vet Date

Vet Note

Fido

Labrador

1

0

Sarah Smith

The Meadows Newtown FK40

7

LL

0

12

3

4

5

6

78

9

0

545682

None

1

John Smith

Sheba

9

356784

2

76

20.05.18

Worming tablets given

Pat

Labradoodle

3

746587

Enjoys petting

Paddy

Golden retriever

7

Frank Jones

14 Main Street Newtown FK40 6TT

0376

458015

546875

Enjoys all

6

Rex

Mongrel

546888

Requires pills

12

(
Page

1

of

3
)

Your assignment

You have been tasked to turn these data into a relational database. You will need to build the database and write a report about what you did. You only need to submit the report. It should have the following sections:

a. Introduction – Introduce the business requirements and describe one business rule and one use case you can identify from the scenario given above.

10 marks

b. ER Diagram – Identify the entities and relationships in the scenario given above and draw an ER diagram showing the entities, attributes, relationships, and cardinality. Do not decompose any of the relationships at this point.

10 marks

c. Database Schema – Decompose the design to create a schema to store the data in a suitable normal form (2NF or 3NF). Say which normal form the design is in and justify your choice. List the tables and show the fields, primary keys, and any foreign keys in your schema. Describe any assumptions you have made or any additional fields you have added to your design. Make sure all the primary keys are a sensible choice and introduce new fields if needed. Draw a schema diagram to illustrate your design.

20 marks

d. Create Tables – Create a MySQL database to store the schema that you designed in part c. above. Create the tables using SQL statements and reproduce the code in your answer report. Define the keys and choose appropriate data types and any other restrictions you think are required.

20 marks

e. Insert the Data – Insert the data given above into the appropriate tables. Give a single example of an SQL statement that you used to insert one row of data into one of the tables.

10 marks

f. SQL Queries – Carry out the appropriate SQL queries of answering the following questions. For each query, give the SQL code and the result of running the query on the data in your database. Marks are given by each question.

i. Return a list of all dog names (2).

ii. Return a list of all dog breeds, showing each breed only once (3).

iii. Write a query to count how many dogs have the string “Labr” in their breed (2).

iv. Calculate the average age of all dogs in the kennel (2).

v. Calculate the average age of dogs by breed (3).

vi. Find the breed of dog that has an average age of more than 8 (4).

vii. List all the dog names along with their owners’ names (4).

viii. List all the dogs who have had a vet note recorded. Give the name of the dog and the date of the vet note (5).

ix. List all dogs, giving their name, and if a dog has had a vet visit, give the note for the visit, otherwise, if the dog has not visited the vet, return null in the vet note field (5).

Submission

Please write your answers, save them to PDF and upload them in the assignment submission area on iStirling. Include your student number on the front page of the report, but DO NOT PUT YOUR NAME ANYWHERE on the report.

Late penalties of three marks per calendar day you are late in submitting will be applied, up to a maximum of seven calendar days, after which you will receive no grade for the assignment.

Plagiarism

Plagiarism is presenting somebody else’s work as your own. Plagiarism is a form of academic misconduct and is taken very seriously by the University. Students found to have plagiarised work can have marks deducted and, in serious cases, even be expelled from the University. Do not submit any work that is not entirely your own.

Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.

Order your essay today and save 30% with the discount code ESSAYHELP