Reputation: 2696
What is the best method of implementing multi-valued attributes in a relational database?
I'm trying to convert an ER diagram into a relational schema, and I have this problem:
I have a table of 'Programmes' with attributes such as Programme ID, type, title, description etc - but then also have Actors - obviously this is multi-valued as a specific programme will have multiple actors in.
How should I represent this?
Upvotes: 0
Views: 3044
Reputation: 185
If an actor can have Many
programmes and a programme can have Many
actors this sounds like a classic Many-to-Many
relationship. Create a third table called programme_actors
or perhaps cast
with two columns: the primary keys of each of the two joined tables.
Upvotes: 2
Reputation: 3343
If an actor also may appear in several programmes, use a join table with foreign keys on both programme and actor and possibly other attributes like role.
Upvotes: 1