Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
crugerenator
Posting Yak Master
126 Posts |
Posted - 2007-08-01 : 10:34:17
|
I think I might have made my relational database design wrong. As of right now I have three tables. Users, Posts, Comments. Users is related to posts, with u_id (primary key in users) being a foreign key in posts. Posts is related to comments, p_id (primary key in posts) being a foreign key in comments. Comments is related to users, with u_id (primary key in users) being a foreign key in comments. As you can see, it creates a circle. The types of relationships are all right, I'm just worried that the diagram looks like the tables are in a circle because of the relationships. Is this ok? I wish I could attach a picture so you could see a diagram of the database. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-08-01 : 10:38:32
|
Seems ok to me.As long as the relationship is 1 to many. E 12°55'05.25"N 56°04'39.16" |
 |
|
crugerenator
Posting Yak Master
126 Posts |
Posted - 2007-08-01 : 10:42:14
|
thanks, the relationships are right. just thought that the circle thing might have been against the rules, it's been years since i've had a db class. |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2007-08-02 : 08:07:06
|
Is there a difference between a post and a comment? If this is a forum or something you could also just omit the comments-table and add a column called "ParentPostID" or something to the posts table with a one-to-many relationship between PostID and ParentPostID.--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
|
|