If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Normalized design question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-12, 15:32
ChipT ChipT is offline
Registered User
 
Join Date: Aug 2009
Posts: 5
Normalized design question

I've set up a MySQL database in a way that makes sense to me. It has occurred to me that it might not be the most efficient construction/consistent with good database design. It's described below, inviting constructive criticism (also let me know if there is another board I should be posting this to instead).

Models/Fields below:

Studio:
Name
Short_Description
Long_Description
Hyperlink_1
Hyperlink_2
Hyperlink_3
Hyperlink_4
Hyperlink_5
(it already occurs to me to put hyperlinks on their own table)

Genre:
Name
Long_Description

Film:
Studio (foreign key - one2many)
Name
Genre (foreign key - many2many)
Award (foreign key - many2many)
Short_Description
Long_Description
Hyperlink_1
Hyperlink_2
Hyperlink_3
Hyperlink_4
Hyperlink_5

Actor:
Film (foreign key - many2many)
Award (foreign key - many2many)
Name
Short_Description
Long_Description

Award:
Name
Short_Description
Long_Description
Reply With Quote
  #2 (permalink)  
Old 01-31-12, 15:40
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
Those many-to-many links are gonna be a problem, but maybe you already understand that. The work-around is simple enough.

Any time you see enumeration like hyperlink_1, hyperlink_2... there is a problem. Your comment shows that you understand that too.

Your design is off to a good start, but it isn't ready to code yet.

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #3 (permalink)  
Old 01-31-12, 15:52
ChipT ChipT is offline
Registered User
 
Join Date: Aug 2009
Posts: 5
Would I be good to go with the following, or are the other many-to-many fields also problematic? And how might I restructure?

Studio:
Name
Short_Description
Long_Description

Genre:
Name
Long_Description

Film:
Studio (foreign key - one2many)
Name
Genre (foreign key - many2many)
Award (foreign key - many2many)
Short_Description
Long_Description

Actor:
Film (foreign key - many2many)
Award (foreign key - many2many)
Name
Short_Description
Long_Description

Award:
Name
Short_Description
Long_Description

Hyperlinks:
Table (generic foreign key - could go to Film or Studio)
ID (primary key of film or studio link applies to)
Link
Reply With Quote
  #4 (permalink)  
Old 01-31-12, 15:56
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
I don't understand enough to answer your questions. Give it a shot, if you have questions come back and ask them!

One step at a time, you're on the right track at the very least and you might have everything ready to roll.

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #5 (permalink)  
Old 01-31-12, 16:30
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
so looking at your model
...a film can only have one award?
...an actor can only appear in one film?
...an actor can only win one award?

Google

these are worth a read...
Fundamentals of Relational Database Design -- r937.com
The Relational Data Model, Normalisation and effective Database Design
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #6 (permalink)  
Old 01-31-12, 16:40
ChipT ChipT is offline
Registered User
 
Join Date: Aug 2009
Posts: 5
No, that's not the case. Sorry if that's unclear. What I mean by many-to-many is that a film can have many awards and an award can apply to many films. An actor can be in many films, and a film can have many actors, etc.

That's the way I have it set up now actually, in mysql.
Reply With Quote
Reply

Tags
design, mysql, normalization

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On