100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Module1_Relational Database: Part 3

Rating
-
Sold
-
Pages
8
Uploaded on
19-02-2019
Written in
2018/2019

Business Information Management - Data Management subject. Third part of Module 1 Relational Database. This document contains all the slides, notes from 2 students and extra information collected on Internet. I had a 15 out 20 for this subject.

Show more Read less
Institution
Course












Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
February 19, 2019
Number of pages
8
Written in
2018/2019
Type
Summary

Subjects

Content preview

Converting Entity-Relationship Diagrams to
Relational Databases
The Rules
- Each entity will convert to a table.
- Each many-to-many relationship or associative entity will convert to a table. (a middle
table) If you have at ERD level one book as many authors and many autor have many
books
- During the conversion, certain rules must be followed to ensure that foreign keys appear
in their proper places in the tables. (it’s about the primary and foreign keys, that’s what
the db understands)
ERD doesn’t have primary keys or foreign keys
Converting a Simple Entity
S a le s p e rs o n S a le s p e rs o n C o m m is s io n
N um ber N am e P e rc e n ta g e Y e a r o f H ire
SA LESPERSO N
The table simply contains the attributes that were specified in
the entity box.
Salesperson Number is underlined to indicate that it is the
unique identifier of the entity and the primary key of the table.
Converting Entities in
Binary Relationships:
One-to-One
There are three options for designing
tables to represent this data.


One-to-One: Option #1
The two entities are combined into one
relational table.


S a le s p e rs o n S a le s p e rs o n C o m m is s io n Y e a r O ffic e
N um ber N am e P e rc e n ta g e of N u m b e r T e le p h o n e S iz e
H ire
S A L E S P E R S O N /O F F IC E
One-to-One: Option #2 He prefers this one
Separate tables for the SALESPERSON and
OFFICE entities, with Office Number as a
foreign key in the SALESPERSON table.




1

,One-to-One: Option #3
Separate tables for the SALESPERSON and
OFFICE entities, with Salesperson Number as a
foreign key in the OFFICE table.




Converting Entities in Binary Relationships: One-to Many

The unique identifier of the entity
on the“one side”of the one-to-
many relationship is placed as a
foreign key in the table
representing the entity on the
“many side.”
So, the Salesperson Number
attribute is placed in the
CUSTOMER table as a foreign key.




Many sales persons selling
many products and may
products are sold by many
sales persons: many to
many relationship
They have no FK but only
PK




Converting Entities in Binary Relationships: Many-to Many


2

, Here is
presented as
entity




- E-R diagram with the many-to-many binary relationship and the equivalent diagram
using an associative entity.

Converting Entities in Binary Relationships: Many-to Many
- An E-R diagram with two entities in a many-to-many relationship converts to three
relational tables.
- Each of the two entities converts to a table with its own attributes but with no foreign
keys (regarding this relationship).
- In addition, there must be a third“many-to-many" table for the many-to-many
relationship.




Converting Entities in Unary Relationships: One-to-
One
• With only one entity type
involved and with a one-to-
one relationship, the
conversion requires only one
table.

3
One to one
S a le s p e rs o n S a le s p e rs o n C o m m is s io n B ackup relationship
N um ber N am e P e rc e n ta g e Y e a r o f H ire N um ber
SA LESPER SO N

, Converting Entities in Unary Relationships: One-to-
Many
• Very similar to the one- One sales person is
to-one unary case. managed by one
manager and one
manager manages
many sales
persons
S a le s p e rs o n S a le s p e rs o n C o m m is s io n
N um ber N am e P e rc e n ta g e Y e a r o f H ire M anager
SA LESPER SO N

Converting Entities in Unary Relationships: Many-to-
Many 7-14




P ro d u c t P ro d u c t
N um ber N am e U n it P ric e
PR O D U CT
P ro d u c t S u b -A s s e m b ly
N um ber N um ber Q u a n tity
C O M PO N EN T

• This relationship requires two tables in the conversion.

• The PRODUCT table has no foreign keys.

7-15




4

, Converting Entities in Unary Relationships: Many-to-
Many
P ro d u c t P ro d u c t
N um ber N am e U n it P ric e
PR O D U C T
P ro d u c t S u b -A s s e m b ly
N um ber N um ber Q u a n tity
CO M PO N EN T

• A second table is created since in the conversion of a
many-to-many relationship of any degree — unary, binary,
or ternary — the number of tables will be equal to the
number of entity types (one, two, or three, respectively)
plus one more table for the many-to-many relationship.

Converting Entities in 7-16

Ternary Relationships
S a le s p e rs o n S a le s p e rs o n C o m m is s io n
N um ber N am e P e rc e n ta g e Y e a r o f H ire
SA LESPER SO N

S a le s p e rs o n C u s to m e r P ro d u c t
N um ber N um ber N u m b e r D a te Q u a n tity
SA LE

P ro d u c t P ro d u c t
N um ber N am e U n it P ric e
PRO D U CT
• The primary key of the SALE
table is the combination of the C u s to m e r C u s to m e r
unique identifiers of the three N um ber N am e H Q C ity
entities involved, plus the Date C U STO M ER
attribute. 7-17




5

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
shafaqsara Katholieke Universiteit Leuven
Follow You need to be logged in order to follow users or courses
Sold
14
Member since
6 year
Number of followers
7
Documents
12
Last sold
1 month ago

4.0

2 reviews

5
0
4
2
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions