Interview Query

Fraudulent Upvotes

7
Have you seen this question before?

We’re given three tables representing a forum of users and their comments on posts.

We want to figure out if users are creating multiple accounts to upvote their own comments. 

  1. What kind of metrics could we use to figure this out?

  2. Write a query that could display the percentage of users on our forum that would be acting fraudulently in this manner. 

Example:

Input:

users table

Column Type
id INTEGER
created_at DATETIME
username VARCHAR

comments table

Column Type
id INTEGER
created_at DATETIME
post_id INTEGER
user_id INTEGER

comment_votes table

Column Type
id INTEGER
created_at DATETIME
user_id INTEGER
comment_id INTEGER
is_upvote BOOLEAN
Next question: Late Orders
.....
MySQL 8.0.17
Loading editor
Use Shift + Enter to run query