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 4086704
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:45:41+00:00 2026-05-20T18:45:41+00:00

I am building an application that can have multiple users from multiple accounts. For

  • 0

I am building an application that can have multiple users from multiple accounts. For example, an account could be Company ABC. Users X, Y, and Z are members of this account. Each account should have its own separate instance so that if Company ABC creates a new DB item, it should only be visible and manageable by Company ABC. My question is this: do I have to make an explicit foreign key reference to the account in every single table in my DB? For example:

TABLE – ACCOUNTS

ACCOUNT_ID | ACCOUNT_NAME
1234       | Company ABC

TABLE – PAGES

PAGE_ID | PAGE_TITLE | ACCOUNT_ID
987     | My Page    | 1234

TABLE – ASSETS

ASSET_ID | ASSET_TITLE | ACCOUNT_ID
4443     | My Asset    | 1234

TABLE – GROUPS

GROUP_ID | GROUP_NAME  | ACCOUNT_ID
8888     | Admins      | 1234

etc?

This seems wrong to me for some reason and I feel like there is a better way that I’m not thinking of. I have nearly 75 tables that I would need to do this for. Is this right?

  • 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-20T18:45:42+00:00Added an answer on May 20, 2026 at 6:45 pm

    I have had to deal with this situation, and it is likely that you will have to include the ACCOUNT_ID column on many (though not necessarily all) your tables. An alternative is to have separate databases for each account. This can lead to maintenance problems, as you have to ensure that all changes to DDL and DML are universally applied. It also potentially leads to performance problems. Applying the column to each table does (slightly) complicate the queries joins, and views needed on the data, but joins are generally low (or no) cost in terms of performance and space. The one advantage of separate databases is that it is likely to be a more secure solution – ring-fencing each account from all others.

    I suggested that not all your tables would need the account column. The need for this would depend on access paths. – For example, I have sub/super type relationships expressed in my tables. Each sub type and each super type has its own table. Access to all sub types is only through the super type, so the super type would need reference to ACCOUNTS, but the sub types would not.

    EDIT:
    My question and the answers and comments on it, concerning this type of design question led to my above conclusion.

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

Sidebar

Related Questions

I am building application that required some data from iPhone's Call log(read only). The
We have a few projects that involve building an application that is composed of
I'm building a web application that guides my users through the configuration and installation
I'm building an application that is targeting Windows, Mac and Linux soon. I was
We're currently building an application that executes a number of external tools. We often
I am considering building an application that is a blend of a dynamic language
I'm building an application that needs to run through an XML feed but I'm
I am building an application that is very similar to a shopping cart. The
I am building an application that queries a web service. The data in the
I'm building a C# application that will monitor a specified directory for changes and

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.