I'm a college student working with a recent SO data dump to learn about database queries and eventually formally model a standard procedure for getting statistical data from causal questions on relational schema. Big words aside, there's a "Parent ID" associated with an Answer, and I wanted to clarify whether or not that pointed to the Question the Answer was answering. Thanks for the help!

Update Here's the SO schema I've been working on, in the form of an Entity-Relationship diagram (all of this was translated from the readme.txt that came with a recent data dump):

alt text

So to help clarify: - rectangles are entities - diamonds are relationships - triangles represent an ontology - ovals are attributes Any entity that had a foreign key to another entity, that foreign key gets absorbed in a relationship. Ex) "Earns" has an earns_id, a user_id, and a badge_id, so showing badge_id as an attribute of user isn't necessary (the same goes for user_id in badge). And, cardinality is indicated by the crows feet being many, and single line being one.

So theoretically, each entity and relationship would get its own table when translated to DB.

Let me know if you think I'm on the right track, or if something seems horribly wrong, I appreciate it!

share|improve this question
    
Unofficial answer: Yes, and both questions and answers are stored in the Posts table. –  mmyers Jul 9 '10 at 19:09
    
Thank you! Yes I knew that they were in the post table, but I just wanted to make sure someone could find the question that a particular answer is attached to. Pretty basic, but still wanted clarity :-) –  Elaina R Jul 9 '10 at 19:13
1  
You might want to favourite this question: meta.stackoverflow.com/questions/2677/anatomy-of-a-data-dump –  Jon Seigel Jul 9 '10 at 19:20
    
Ah, yes I saw that question and got the readme.txt with the data dump, but if you notice, it just says that post type 2 (answer) has a "Parent ID" without specifically saying that this points to a question. I must seem a bit dumb, but I really just wanted to clarify before making a relational schema that correctly reflects SO. Thank you for your input! –  Elaina R Jul 9 '10 at 19:40
    
Yeah, that's a good point. Maybe I'll throw together a schema diagram at some point to clarify. –  Jon Seigel Jul 9 '10 at 20:56
    
I've actually got a entity-relationship diagram made to what the readme.txt dictates the flow of the site to be. Is it possible to post pdf's or even jpg's in a question/answer here? Maybe I could get feedback on it. –  Elaina R Jul 9 '10 at 23:57
    
@Elaina: You can link to PDFs, and you can embed images (there is a toolbar button in the editor to help with this). –  Jon Seigel Jul 11 '10 at 16:55
    
Thank Jon! Schema's posted, if you want, let me know what you think –  Elaina R Jul 12 '10 at 18:43
    
@ela: you might want to post a bigger (higher res) version of that schema. –  fretje Jul 12 '10 at 18:51
    
@fretje: I tried a different upload, it looks a lot better now if you right click and "view image" :-) –  Elaina R Jul 12 '10 at 18:57
    
@Elaina: I was thinking more along the lines of a table/relationship diagram, but that works, too. Looks good! –  Jon Seigel Jul 12 '10 at 21:13
add comment

1 Answer

up vote 2 down vote accepted

The parent ID on an Answer entry in the Post table points to the Question the Answer belongs to in the same table.

(That is a hard sentence to read...)

share|improve this answer
    
Thanks for the response! (I often wait a while before accepting an answer just to give others time to post answers in fairness of point-getting) I'll be posting a schema that I've come up with for SO, please feel free to critique! –  Elaina R Jul 11 '10 at 23:58
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .