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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:39:09+00:00 2026-05-28T03:39:09+00:00

This question applies to any database table design, where you would have system default

  • 0

This question applies to any database table design, where you would have system default items and custom user defaults of the same type (ie user can add his own custom items/settings).

Here is an example of invoicing and paymenttypes, By default an invoice can have payment terms of DueOnReceipt, NET10, NET15, NET30 (this is the default for all users!) therefore you would have two tables “INVOICE” and “PAYMENT_TERM”

INVOICE
Id
...
PaymentTermId



PAYMENT_TERM (System default)
Id
Name

Now what is the best way to allow a user to store their own custom “PaymentTerms” and why? (ie user can use system default payment terms OR user’s own custom payment terms that he created/added)

Option 1) Add UserId to PaymentTerm, set userid for the user that has added the custom item and system default userid set to null.

INVOICE
Id
...
PaymentTermId



PaymentTerm
Id
Name
UserId (System Default, UserId=null)

Option 2) Add a flag to Invoice “IsPaymentTermCustom” and Create a custom table “PAYMENT_TERM_CUSTOM”

INVOICE
Id
...
PaymentTermId
PaymentTermCustomId
IsPaymentTermCustom (True for custom, otherwise false for system default)

PaymentTerm
Id
Name

PAYMENT_TERM_CUSTOM
Id
Name
UserId

Now check via SQL query if the user is using a custom payment term or not, if IsPaymentTermCustom=True, it means the user is using custom payment term otherwise its false.

Option 3) ????

…

  • 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-28T03:39:09+00:00Added an answer on May 28, 2026 at 3:39 am

    As a general rule:

    • Prefer adding columns to adding tables
    • Prefer adding rows to adding columns

    Generally speaking, the considerations are:

    Effects of adding a table

    • Requires the most changes to the app: You’re supporting a new kind of “thing”
    • Requires more complicated SQL: You’ll have to join to it somehow
    • May require changes to other tables to add a foreign key column referencing the new table
    • Impacts performance because more I/O is needed to join to and read from the new table

    Note that I am not saying “never add tables”. Just know the costs.

    Effects of adding a column

    • Can be expensive to add a column if the table is large (can take hours for the ALTER TABLE ADD COLUMN to complete and during this time the table wil be locked, effectively bringing your site “down”), but this is a one-time thing
    • The cost to the project is low: Easy to code/maintain
    • Usually requires minimal changes to the app – it’s a new aspect of a thing, rather than a new thing
    • Will perform with negligible performance difference. Will not be measurably worse, but may be a lot faster depending on the situation (if having the new column avoids joining or expensive calculations).

    Effects of adding rows

    • Zero: If your data model can handle your new business idea by just adding more rows, that’s the best option

    (Pedants kindly refrain from making comments such as “there is no such thing as ‘zero’ impact”, or “but there will still be more disk used for more rows” etc – I’m talking about material impact to the DB/project/code)

    To answer the question: Option 1 is best (i.e. add a column to the payment option table).
    The reasoning is based on the guidelines above and this situation is a good fit for those guidelines.

    Further,
    I would also store “standard” payment options in the same table, but with a NULL userid; that way you only have to add new payment options when you really have one, rather than for every customer even if they use a standard one.

    It also means your invoice table does not need changing, which is a good thing – it means minimal impact to that part of your app.

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

Sidebar

Related Questions

Although this is a Java-centric question it really applies to any system utilizing a
I believe this question applies to any of the For Html helpers, but my
I have a HashMap (although I guess this question applies to other collections) of
(This question specifically in C#, but applies generally to .NET) I have a largish
This is a generic question that applies to (probably) any high-level programming language. Here
Actually this question applies to any widget that requires data from a remote server.
I'm writing my first NHibernate application, but I guess this question applies to any
I believe this question applies equally well to C# as to Java, because both
I'm using Castle ActiveRecord, but this question applies to NHibernate, too, since a solution
I'm coming largely from a c++ background, but I think this question applies to

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.