Question

I am learning mysql join queries. To pratice, I decided to make tables for a website like stackoverflow. I made three tables basically.

Question_Thread
    thread_id
    title
    username
    datetime
Question_Reply
    reply_id    
    thread_id
    text
Question_Text_Comment 
    comment_id
    reply_id
    comment

How do I query all the replies and comments of each reply? I can't find a relationship here. It is not many-to-many, one-to-many, or one-to-one. It looks like one-to-many because one reply have many comments. The problem is that question detail page have many replies.

please advise me...

Was it helpful?

Solution

Question and reply is a one-to-many relationship. Reply and comment is a one-to-many relationship.

The properties (and keys) as far as I can see are looking good. I don't see the problem...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top