0% found this document useful (0 votes)
29 views

COMP1556 - Week 4 Database Technologies Applications: The On-Line Examination Case Study and Object Orientation

This document discusses database design techniques for complex relationships between objects. It covers partial vs complete relationships and disjoint vs overlapping relationships. The six-step database design process is demonstrated using an example of different types of artists. Tips are provided on starting with a basic diagram and converting it based on assumptions about the relationships between objects. Future weeks will cover creating test data and working with Oracle databases.

Uploaded by

EricTrein
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

COMP1556 - Week 4 Database Technologies Applications: The On-Line Examination Case Study and Object Orientation

This document discusses database design techniques for complex relationships between objects. It covers partial vs complete relationships and disjoint vs overlapping relationships. The six-step database design process is demonstrated using an example of different types of artists. Tips are provided on starting with a basic diagram and converting it based on assumptions about the relationships between objects. Future weeks will cover creating test data and working with Oracle databases.

Uploaded by

EricTrein
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

COMP1556 – Week 4

Database Technologies
Applications

The on-line examination case study and object orientation.

Andy Wicks (c) 2019 1


 The Last Two Weeks 
• We went through the six steps to creating a
sustainable database.
• You found that a crows-foot diagram could
contain much more information than just
what links to what.
• You found that designing a database is more
an art than a science. What does a word
mean?
Andy Wicks (c) 2019 2
 This Week 
• We will start with some input on how to
capture complex relationships.
• We will go through the six steps using the on-
line examination case study …
• … which you have all read!
• Then it is back to LucidChart to create the
diagrams.
Andy Wicks (c) 2019 3
The Art Gallery Scenario
• You working for an art gallery which needs a
DB to hold all the information on artists and
their sales.
• The design should allow for different kinds of
artists to sell their work.
• A biography page for each artist is needed as
well as a catalogue of their work for sale.
Andy Wicks (c) 2019 4
Now we are off
to LucidChart

Andy Wicks (c) 2019 5


Step 1 – Find the Objects
• Anything you can touch, e.g. a person.
• Anything you can list, e.g. course code.
• At stage 3 we will add any necessary intersection
entities.
• In LucidChart, we add a 3 column box for each
object.

Andy Wicks (c) 2019 6


Step 2 – Link the objects
• We start with the left-most object.
• Check whether there is a link to each of the other
objects.
• Then move to the second object and check that
against each to its right.
• Repeat this until the last object.

Andy Wicks (c) 2019 7


Stage 3 – Add Cardinality

• Which is the 1 and which is the Many?


• Try the relationship from both ends to check
the cardinality.
• We can have M-Ms and 1-1s at this stage. We can
sort them out later.
• For M-Ms, add an intersection entity.

Andy Wicks (c) 2019 8


Stage 4 – Add the PKs
• Each object gets a primary key (PK) with it
own name and “ID” at the end.
• Add these to each object …
• … with a smile.

Andy Wicks (c) 2019 9


Stage 5 – Add the FKs
• Check each object to see whether it has a
many link at its end.
• For each many link, add the PK from the 1
end.
• If Fred is at the many end of a link with Mary,
then it gets MaryID as a foreign key (FK).

Andy Wicks (c) 2019 10


Stage 6 – Add the Fields
• For each object, go through and add any
necessary fields.
• Normally, this is where you would start.

Andy Wicks (c) 2019 11


The Assumptions
• An assumption is something that changes
the shape of the database design.
• It is NOT “Person to Email is a 1-M relationship”.
• It IS “Person to Tapestry, Painter, Sculptor and
Graffiti is a partial\disjoint relationship because
…”.
• It IS “I am assuming that one person can only …
because …”.
Andy Wicks (c) 2019 12
A “Type of …” Object
• Imagine that there is a class called Artist and
two others called Painter and Sculptor.

Andy Wicks (c) 2019 13


A “Type of …” Object
• If someone is either a Painter or a Sculptor
then these are disjoint.

Andy Wicks (c) 2019 14


A “Type of …” Object
• If someone can be both a Painter and a
Sculptor then these are overlapping.

Andy Wicks (c) 2019 15


Disjoint or Overlapping

Andy Wicks (c) 2019 16


Complete or Partial
• If someone must be either a Painter or a
Sculptor and cannot be just an Artist then it is
a complete relationship.

Andy Wicks (c) 2019 17


Complete or Partial
• If someone can be an Artist or a Painter or a
Sculptor then it is a partial relationship.

Andy Wicks (c) 2019 18


Complete or Partial

Andy Wicks (c) 2019 19


Working with these

• These are two independent problems.


• A relationship can be either partial or
complete.
• And it can be either disjoint or overlapping.
• There are therefore four possible diagrams:-

Andy Wicks (c) 2019 20


Partial/Disjoint Diagram
• Someone can be an Artist, Painter or Sculptor
but not a combination of these.

Andy Wicks (c) 2019 21


Partial/Overlapping Diagram
• Someone can be an Artist, Painter or Sculptor
or any combination of these.

Andy Wicks (c) 2019 22


Complete/Disjoint Diagram
• Someone can be a Painter or Sculptor but not
both. Each of these is an artist.

Andy Wicks (c) 2019 23


Complete/Overlapping Diagram
• Someone can be a Painter or Sculptor but they
are both Artists (who have shared attributes).

Andy Wicks (c) 2019 24


Some Tips
• Start with a diagram that looks something like
this:-

Andy Wicks (c) 2019 25


Some Tips
• Then when you are happy with that, convert it
into the type of diagram appropriate for the
assumptions you made.
• Are the tables disjoint (separate) or overlapping
(can be more than one)?
• Is the relationship partial (they can be any or
all) or is it complete (belongs to a single
category)?
Andy Wicks (c) 2019 26
Some Tips
• Keep track of all your assumptions.
• You will need to explain/query these with
clients.
• Clients know what they mean – they are the
experts in their area – it is up to you to make
sure that you ask the right questions.
• You will need to understand this for the exam.
Andy Wicks (c) 2019 27
We have covered …
• We looked the difference between partial and
complete relationships.
• We looked the difference between disjoint and
overlapping relationships.
• How to use the six-step process in a complex
situation. You are now in a position to
complete the design of the database for your
coursework. Hooray!!!
Andy Wicks (c) 2019 28
In the tutorial …
• You have a quiz on what we covered in the
lecture today. Please start with that.
• Join your pair to go into LucidChart and start
re-designing the DB for your coursework by
using the techniques covered today.
• Do NOT create any SQL!

Andy Wicks (c) 2019 29


Next Week
• We will be looking at creating dummy data.
• You need this so that you can test all the SQL
which you will be writing for your coursework!
• This is the professional approach.
• We will be starting Oracle after that.
• The first thing we will do is create the database.
• Then we will populate it – this is non-trivial!
Andy Wicks (c) 2019 30
So, …
• … will I see you next week and the week after
next?

Andy Wicks (c) 2019 31

You might also like