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 > Tricky Normalization

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-08-09, 16:41
mrbugg mrbugg is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
Tricky Normalization

To me, at least.

I'm taking boxscores from hockey games and putting them into a relational database. So far, I have this:

Games

GameNumber (PK)
-----------------
GameDate Type DateTime
HomeTeam Type String
VisitorTeam Type String

Goals

GameNumber (FK)
Team (FK)
--------------
Period Type Int
Time Type DateTime
Scorer Type Int
Assist1 Type Int
Assists2 Type Int

GameNumber and Team in the Goals table form a composite primary key.

Here's my problem: Each goal also has information about who was on the ice for each team (GoalFor and GoalAgainst). Right now, I'm storing it in the Goals table like this:

GFTeam
GF1
GF2
GF3
GF4
GF5
GATeam
GA1
GA2
GA3
GA4
GA5

This is a pain because I have to concatenate every column to search for someone.

I know I need to create a GoalAgainst and GoalFor table somehow with a composite primary key, but I don't know what columns to combine.

Any suggestions are much appreciated!
Reply With Quote
  #2 (permalink)  
Old 06-08-09, 16:50
dportas dportas is offline
Registered User
 
Join Date: Dec 2007
Location: London, UK
Posts: 732
Think about what should be your identifier for a goal. The time perhaps? Or maybe only the sequence is important to you?
Reply With Quote
  #3 (permalink)  
Old 06-08-09, 16:51
mrbugg mrbugg is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
Quote:
Originally Posted by dportas
Think about what should be your identifier for a goal. The time perhaps? Or maybe only the sequence is important to you?
Yeah, that's what I figured. I'll focus on that- thanks!
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