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

  • SEARCH
  • Home
  • 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 7028825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:27:31+00:00 2026-05-28T00:27:31+00:00

I will do my best to lay this out in text. Essentially, we have

  • 0

I will do my best to lay this out in text. Essentially, we have an application that tracks actions performed by users. Each action has it’s own table since each action has different parameters that need to be stored. This allows us to store those extra attributes and run analytics on the actions across multiple or single users rather easily. The actions are not really associated with each other other than by what user performed these actions.

Example:

  • ActionTableA Id | UserId | AttributeA | AttributeB
  • ActionTableB Id | UserId | AttributeC | AttributeD | AttributeE
  • ActionTableC Id | UserId | AttributeF

Next, we need to allocate a value to each action performed by the user and keep a running total of those values.

Example:
ValueTable: Id | UserId | Value | ActionType | ActionId

What would be the best way to link the value in the value table to the actual action performed? We know the action type (A, B, C) – but from a SQL design perspective, I cannot see a good way to have an indexed relationship between the Values of the actions in the ActionsTable and the actual actions themselves. The only thing that makes sense would be to modify the ValueTable to the following:

ValueTable

Id | UserId | Value | ActionType | ActionAId(FK Nullable) | ActionBId(FK Nullable) | ActionCId(FK Nullable)

But the problem I have with this that only one of the 3 actionTableId columns would have a value, the rest would be Null. Additionally, as action types are added, the columns in the value table would too. Lastly, to programatically find the data, I would either a) have to check the ActionType to get the appropriate column for the Id or b) scan the row and pick the non-null actionId.

Is there a better way/design or is this just ‘the way it is’ for this particular issue.

EDIT

Attached is a diagram of the above setup:

enter image description here

Sorry for the clarity issues, typing SQL questions is always challenging. So I think your comment gave me an idea of something… I could have an SystemActionId table that essentially has an auto-generated value

SystemActions: Id | Type

Then, each ActionTable would have an additional FK to the SystemAction table. Lastly, in the ValueTable – associate it to the SystemActions table as well. This would allow us to tie values to specific actions. I would need to join the action tables to the system actions table where

JOIN (((SystemActions.Id = ActionTableA.Id) JOIN (SystemActions.Id = ActionTableB.Id)) JOIN (SystemActions.Id = ActionTableC.Id)

crappy quick sql syntax

Is this what you were alluding to in the answer below? A snapshot of what that could potentially look like:enter image description here

  • 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-28T00:27:32+00:00Added an answer on May 28, 2026 at 12:27 am

    Your question is a little unclear, but it looks like you should either have a (denormalized) value column in each action table, or have an artificial key in the value table that is keyed to by each of the seperate action tables.

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

Sidebar

Related Questions

I'm struggling with a regex pattern that will pull out text from a string
I'm trying to figure out how to best lay this out. I'll explain what
This question will expand on: Best way to open a socket in Python When
I got this question from my cousin: What will be the best way to
Okay, so this one may be difficult but I will do my best to
I will try to explain this the best I can. I created a CMS
I'm developing an application which will have these classes: class Shortcut { public string
What will be best practice for this?
Rather than use a full-blown PHP MVC, I'm designing one that will best-fit my
I'm desperately looking for a PHP 5 framework that will work best to develop

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.