I am looking for some explanation of the schema for the data dump of se sites.

Specifically I'd like to know the values for PostTypeId field (1=Questions?, 2=Answers?, 3=?, etc).

I have tried to look for it, I am sure it must be posted somewhere pretty obvious, but I seem to have a blind spot that I need help with.

  • I changed my mind about the duplicate, since the documentation is so far behind – Michael Mrozek Jul 21 '11 at 14:21
  • @MichaelMrozek - In that case, isn't the solution to edit the original, canonical post? It's got 40 upvotes and 24 revisions, I hardly think that we should start a new question for it. – Kevin Vermeer Jul 26 '12 at 0:02

You can get it by:

select * from posttypes

It returns:

1 Question
2 Answer
3 Wiki
4 TagWikiExcerpt
5 TagWiki
6 ModeratorNomination
7 WikiPlaceholder
8 PrivilegeWiki

Is this what you are looking for?

  • 2
    Thanks. Duh, I knew it was obvious. – Unreason Jul 21 '11 at 14:27

In theory selecting from PostTypes should be the right way, but it seems to be behind, since I see 1-6 used in the PostTypeId field. The readme.txt file in the data dump is worse; it only lists 1 and 2 for Question and Answer, respectively. I looked at 20 random posts from each ID; they appear to be:

  • 1 -- Questions
  • 2 -- Answers
  • 3 -- Orphan Tag Wikis (tag wikis for tags that have since been deleted. ♦ mods can see these live)
  • 4 -- Tag Wiki Excerpts
  • 5 -- Tag Wiki Bodys
  • 6 -- Election nominations
  • 1
    Thank you, interesting... btw, is there somewhere where I can look more directly on the schema, integrity rules, etc... +1 – Unreason Jul 21 '11 at 14:37
  • 1
    There's documentation in the readme.txt that comes with the data dump; it's reproduced here. That's all that's publicly available – Michael Mrozek Jul 21 '11 at 14:39

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