By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

Organization of tables/rows in mysql

P: n/a
Hey, I'm kind of new to mysql, and I'm not sure which is a better
method of organizing data. I have 10 chat rooms, and for each room I
want to store 10 messages. Does this mean I should create 10 tables,
one for each chat room, and have each of the 10 messages as one row
entry in the chat room table? Or should I create one main table that
stores all 100 messages as 100 row entries, and identify for each
message which chat room it belongs to? Or is there a different way I
should be managing this?

Thanks,

bgold12
Sep 3 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 3 Sep, 16:03, bgold12 <bgol...@gmail.comwrote:
Hey, I'm kind of new to mysql, and I'm not sure which is a better
method of organizing data. I have 10 chat rooms, and for each room I
want to store 10 messages. Does this mean I should create 10 tables,
one for each chat room, and have each of the 10 messages as one row
entry in the chat room table? Or should I create one main table that
stores all 100 messages as 100 row entries, and identify for each
message which chat room it belongs to? Or is there a different way I
should be managing this?

Thanks,

bgold12
The latter.
Sep 3 '08 #2

P: n/a
On 3 Sep, 16:03, bgold12 <bgol...@gmail.comwrote:
Hey, I'm kind of new to mysql, and I'm not sure which is a better
method of organizing data. I have 10 chat rooms, and for each room I
want to store 10 messages. Does this mean I should create 10 tables,
one for each chat room, and have each of the 10 messages as one row
entry in the chat room table? Or should I create one main table that
stores all 100 messages as 100 row entries, and identify for each
message which chat room it belongs to? Or is there a different way I
should be managing this?

Thanks,

bgold12
Also, this should be asked in comp.databases.mysql
Sep 3 '08 #3

P: n/a
On Sep 3, 9:03*am, bgold12 <bgol...@gmail.comwrote:
Hey, I'm kind of new to mysql, and I'm not sure which is a better
method of organizing data. I have 10 chat rooms, and for each room I
want to store 10 messages. Does this mean I should create 10 tables,
one for each chat room, and have each of the 10 messages as one row
entry in the chat room table? Or should I create one main table that
stores all 100 messages as 100 row entries, and identify for each
message which chat room it belongs to? Or is there a different way I
should be managing this?

Thanks,

bgold12
create a table called tblChatRoom
chatRoomId autonumber (pk)
chatRoom varchar

create a table called tblMessage
messageId autonumber (pk)
chatRoomId int (fk)
message varchar
this will allow many chatrooms, and many messages
Sep 4 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.