Professional Documents
Culture Documents
Converting ER Diagrams To Tables: Yufei Tao
Converting ER Diagrams To Tables: Yufei Tao
Yufei Tao
Given an entity set, create a table with the same attributes and candidate
key.
Example:
pid hkid
dept PROF
rank salary
A R B
Example:
grade
sid
cid
. . . year
STU TAKE CLASS
. . .
Example:
pid
cid
. . . year
PROF TEACH CLASS
. . .
Think
Why?
One-to-one: R has two candidate keys. The first (second) one is the
same as A (B).
Example:
year
mid
wid
. . . . . .
MAN MARRY WOMAN
grade TAKE
STU sid
dept gpa
grade TAKE
STU sid
dept gpa
Note that there is no explicit table for TEACH. Think: why doesn’t the trick work for
TAKE?
Converting ER Diagrams to Tables