Is this a correct table structure for my database?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sherifffruitfly

    Is this a correct table structure for my database?

    Hi all,

    I'm making an log-viewer app for a game that I play - the game has
    instant messaging in-game, and stores the chat logs from each of the
    players' chats locally in txt files. I'll be using a sql compact
    database embedded in the app for the storage.

    The structure I've got so far is simple - just two tables:

    tblChatChannels
    (key) colChannelId
    (key) colChannelOpene dTime
    colChannelName
    colChannelSubsc riber


    tblChats
    (key) colChatTime
    (key) colChannelId
    colChatSpeaker
    colChatBody

    The main thing I'm confused about is the fact that my "many" table -
    tblChats only has 1/2 of the "one" table's key as foreign. Is this a
    kosher thing to do?


    Thanks for any thoughts,

    cdj
  • Erland Sommarskog

    #2
    Re: Is this a correct table structure for my database?

    sherifffruitfly (sherifffruitfl y@gmail.com) writes:
    I'm making an log-viewer app for a game that I play - the game has
    instant messaging in-game, and stores the chat logs from each of the
    players' chats locally in txt files. I'll be using a sql compact
    database embedded in the app for the storage.
    >
    The structure I've got so far is simple - just two tables:
    >
    tblChatChannels
    (key) colChannelId
    (key) colChannelOpene dTime
    colChannelName
    colChannelSubsc riber
    >
    >
    tblChats
    (key) colChatTime
    (key) colChannelId
    colChatSpeaker
    colChatBody
    >
    The main thing I'm confused about is the fact that my "many" table -
    tblChats only has 1/2 of the "one" table's key as foreign. Is this a
    kosher thing to do?
    Probably not, but since I don't know the domain, I cannot say for
    sure. Why would there be two channels with the same id, but different
    OpenedTime?

    Overall, time in keys is a bit difficult. Time is a contiguous entity,
    but it is modeled in discrete steps in a computer, so you can get clashes.


    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server 2005 at

    Books Online for SQL Server 2000 at

    Comment

    Working...