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 > Videos, video content

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-20-08, 13:49
darkangel darkangel is offline
Registered User
 
Join Date: Feb 2005
Location: Cape Town, South Africa
Posts: 57
Videos, video content

Hi,

I have two questions.

1. Each video has information about its content (they are poker instruction videos, so it's fields like 'game_type', 'stakes', etc.) -- should I use two tables, or one?

One
video: id, name, content_game_type, content_stakes, etc. (I prefix with 'content' because a video in itself does not have 'stakes', for example.)

Two
video: id, name
video_content: video_id, game_type, stakes, etc.

2. These fields (game, game_type, stakes, table_size, tables) all have relatively static value sets, as follows:

Game: LHE, NLHE, Omaha 8/b, Omaha H/L, Other
Type: Cash, MTT, SNG, Special
Stakes: Lower (0.05/0.10 - 0.25/0.50), Middle(1/2 –3/6), Higher (5/10+)
Size: Long handed, Heads up, Short handed
Tables: 1, 2, 3, 4+

Should I use MySQL's ENUM type, or create lookup tables for each of these fields?

Thanks,

_da.
Reply With Quote
  #2 (permalink)  
Old 02-20-08, 16:28
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
I don't know about MySQL's ENUM type so can't comment on its benfits. I would probably use lookup tabes anyway since these are standard and can be ported.


Whether or not you need one or more tables depends on the nature of the data. Can a video contain information on more than one combination of all these fields. For example, an NLHE MTT video might cover tables of 3 and 4+?
Reply With Quote
  #3 (permalink)  
Old 02-22-08, 03:03
darkangel darkangel is offline
Registered User
 
Join Date: Feb 2005
Location: Cape Town, South Africa
Posts: 57
Quote:
Originally Posted by pootle flump
I don't know about MySQL's ENUM type so can't comment on its benfits. I would probably use lookup tabes anyway since these are standard and can be ported.


Whether or not you need one or more tables depends on the nature of the data. Can a video contain information on more than one combination of all these fields. For example, an NLHE MTT video might cover tables of 3 and 4+?
Hi,

1. True. It just seemed excessive to have so many small tables. Maybe I'm looking at it the wrong way?

2. Nope, just one set of fields per video. Use one table?

Thanks,

_da.
Reply With Quote
  #4 (permalink)  
Old 02-22-08, 03:38
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Quote:
Originally Posted by darkangel
1. True. It just seemed excessive to have so many small tables. Maybe I'm looking at it the wrong way?
Tables represent entities. Some entities are information rich (lots of columns) some are information poor. Some can have, in theory, an infintite of instances (a row in the table is an instance of the entity) (order details for example), some have a very small and, broadly, fixed number of instances (your little lookup table here for example). But they are all entities. You generate your entities through a process of normalisation which is driven by dependencies. Whether or not this results in lots of little tables or several huge ones is irrelevent.

Quote:
Originally Posted by darkangel
2. Nope, just one set of fields per video. Use one table?
Tell you what - can you justify Two?
Reply With Quote
  #5 (permalink)  
Old 02-22-08, 09:33
darkangel darkangel is offline
Registered User
 
Join Date: Feb 2005
Location: Cape Town, South Africa
Posts: 57
Quote:
Originally Posted by pootle flump
Tables represent entities. Some entities are information rich (lots of columns) some are information poor. Some can have, in theory, an infintite of instances (a row in the table is an instance of the entity) (order details for example), some have a very small and, broadly, fixed number of instances (your little lookup table here for example). But they are all entities. You generate your entities through a process of normalisation which is driven by dependencies. Whether or not this results in lots of little tables or several huge ones is irrelevent.
Thanks, that makes me feel a lot better about it.

Quote:
Originally Posted by pootle flump
Tell you what - can you justify Two?
It would only be for semantic reasons. i.e. Do these fields represent a separate entity?

_da.
Reply With Quote
  #6 (permalink)  
Old 02-22-08, 09:39
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Quote:
Originally Posted by darkangel
It would only be for semantic reasons. i.e. do these fields represent a separate entity?
And they don't: One-to-one relationship.

BTW - the stuff about the lookups. There is a counter argument that since these things consist of nothing more than lists of acceptable values (i.e. there are no non-key attributes in there) they do not represent entities in themselves. They are there to support correctness rather than integrity. You could instead just use check constraints in your table DDL.
The advantage of this - less tables. The disadvantages - adding a new game, for example, requires a DDL change; your app needs to maintain a seperate list for users to select from.
Reply With Quote
  #7 (permalink)  
Old 02-22-08, 10:45
darkangel darkangel is offline
Registered User
 
Join Date: Feb 2005
Location: Cape Town, South Africa
Posts: 57
Quote:
Originally Posted by pootle flump
And they don't: One-to-one relationship.
Not sure what you mean here -- do you mean between the video entity and each of the 'content' entities? (i.e. games, game_types, stakes, etc.)

Quote:
Originally Posted by pootle flump
BTW - the stuff about the lookups. There is a counter argument that since these things consist of nothing more than lists of acceptable values (i.e. there are no non-key attributes in there) they do not represent entities in themselves. They are there to support correctness rather than integrity. You could instead just use check constraints in your table DDL.
The advantage of this - less tables. The disadvantages - adding a new game, for example, requires a DDL change; your app needs to maintain a seperate list for users to select from.
Yeah, it's pretty much the same with ENUMs -- any changes you wish to make require changes to the DDL.

_da.
Reply With Quote
  #8 (permalink)  
Old 02-22-08, 10:48
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Quote:
Originally Posted by darkangel
Not sure what you mean here -- do you mean between the video entity and each of the 'content' entities? (i.e. games, game_types, stakes, etc.)
I was answering your question:
Do these fields represent a seperate entity? (BTW - it's columns or attributes not fields if you are being fussy - I usually am )
They don't represent seperate entities so one table.
Reply With Quote
  #9 (permalink)  
Old 02-22-08, 10:57
darkangel darkangel is offline
Registered User
 
Join Date: Feb 2005
Location: Cape Town, South Africa
Posts: 57
Quote:
Originally Posted by pootle flump
I was answering your question:
Do these fields represent a seperate entity? (BTW - it's columns or attributes not fields if you are being fussy - I usually am )
They don't represent seperate entities so one table.
Thanks so much for your help, pootle flump.

_da.
Reply With Quote
Reply

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