Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 210063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:58:18+00:00 2026-05-11T17:58:18+00:00

I am looking to design a database for a website where users will be

  • 0

I am looking to design a database for a website where users will be able to gain points (reputation) for performing certain activities and am struggling with the database design.

I am planning to keep records of the things a user does so they may have 25 points for an item they have submitted, 1 point each for 30 comments they have made and another 10 bonus points for being awesome!

Clearly all the data will be there, but it seems like a lot or querying to get the total score for each user which I would like to display next to their username (in the form of a level). For example, a query to the submitted items table to get the scores for each item from that user, a query to the comments table etc. If all this needs to be done for every user mentioned on a page…. LOTS of queries!

I had considered keeping a score in the user table, which would seem a lot quicker to look up, but I’ve had it drummed into me that storing data that can be calculated from other data is BAD!

I’ve seen a lot of sites that do similar things (even stack overflow does similar) so I figure there must be a “best practice” to follow. Can anyone suggest what it may be?

Any suggestions or comments would be great. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:58:18+00:00Added an answer on May 11, 2026 at 5:58 pm

    I think that this is definitely a great question. I’ve had to build systems that have similar behavior to this–especially when the table with the scores in it is accessed pretty often (like in your scenario). Here’s my suggestion to you:

    First, create some tables like the following (I’m using SQL Server best practices, but name them however you see fit):

    UserAccount          UserAchievement
     -Guid (PK)           -Guid (PK)
     -FirstName           -UserAccountGuid (FK)
     -LastName            -Name
     -EmailAddress        -Score
    

    Once you’ve done this, go ahead and create a view that looks something like the following (no, I haven’t verified this SQL, but it should be a good start):

    SELECT [UserAccount].[FirstName]      AS FirstName,
           [UserAccount].[LastName]       AS LastName,
           SUM([UserAchievement].[Score]) AS TotalPoints
    FROM [UserAccount]
    INNER JOIN [UserAchievement]
         ON [UserAccount].[Guid] = [UserAchievement].[UserAccountGuid]
    GROUP BY [UserAccount].[FirstName],
             [UserAccount].[LastName]
    ORDER BY [UserAccount].[LastName] ASC
    

    I know you’ve mentioned some concern about performance and a lot of queries, but if you build out a view like this, you won’t ever need more than one. I recommend not making this a materialized view; instead, just index your tables so that the lookups that you need (essentially, UserAccountGuid) will enable fast summation across the table.

    I will add one more point–if your UserAccount table gets huge, you may consider a slightly more intelligent query that would incorporate the names of the accounts you need to get roll-ups for. This will make it possible not to return huge data sets to your web site when you’re only showing, you know, 3-10 users’ information on the page. I’d have to think a bit more about how to do this elegantly, but I’d suggest staying away from “IN” statements since this will invoke a linear search of the table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 315k
  • Answers 315k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's usually easiest to create a wrapper function that contains… May 13, 2026 at 11:11 pm
  • Editorial Team
    Editorial Team added an answer Think of a Web Part as a reusable custom web… May 13, 2026 at 11:11 pm
  • Editorial Team
    Editorial Team added an answer Generic views are simple views that handle a couple of… May 13, 2026 at 11:11 pm

Related Questions

I would like to learn the best practices to employ when creating a database
I was searching the net for something like a wiki database, just like wikipedia
I've been asked to screen some candidates for a MySQL DBA / Developer position
I'm looking for a way for users to be able to connect to my

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.