2

Known information:

  1. As per this answer comments can't be downvoted.

  2. VoteTypeId 3 means downvote on a given post. referred answer

My Assumption: Comments should not be downvoted and therefore Votes table on SEDE StackoverFlow (StackExchange Data Explorer) should not have entries with VoteTypeId = 3 for any comment as a PostId.

Result:

I ran the following query on SEDE StackOverflow to test my assumption. Following query extracts all the comments of answers of a given QuestionId and finds their entries in Votes table.

select * from votes where postid in
(select id from comments where postid in 
(select id from posts where parentid = 7172459))

I found that there are several entries for some comments with VoteTypeId = 3.

Can anyone please explain if the VoteTypeIds have different notion when considered them in the context of a Comment?

4

The PostId in the votes table is a foreignkey to the Post table and the Posts table only. The id's found there don't relate in anyway to the comments table. Joining them makes no sense from an information point of view.

    +------+
    |      |1
    |   +----------------+              +------------------+
    |   |                |              |                  |
    |   |                |              |    Votes         |
    |   |   Posts        |1            *|    -VoteTypeId   |
    |   |    -Id         +--------------+    -PostId       |
    +---|    -ParentId   |              |                  |
       *|                |              |                  |
        +----------------+              +------------------+
                | 1
                |
                |
                |
                |                       +----------------+
                |                       |                |
                |                       |   Comments     |
                |                      *|   -Id          |
                +-----------------------|   -PostId      |
                                        |   -Score       |
                                        |                |
                                        +----------------+

Use the score attribute in the comments table to find how many times the comment was upvoted. You can't get any extra meta-data about that score, like creationdate of the vote.

See Database schema documentation for the public data dump and SEDE for the full schema and also scroll down to the ERD in the second answer.

  • Is there a way to get last upvote date for a comment? – Aditya Narkar Apr 13 at 9:10
  • 2
    @AdityaNarkar no, you can't get that info. It is not in the public SEDE and I'm not even sure if it is internally tracked. – rene Apr 13 at 9:37

You must log in to answer this question.

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