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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:43:17+00:00 2026-05-11T07:43:17+00:00

Each product in my database can have at least three and sometimes four or

  • 0

Each product in my database can have at least three and sometimes four or five different prices, and which one is displayed is based on several factors. How should I attempt to tackle this scenario?

Each product can have the following prices:

  • List Price (MSRP)
  • Cost (what we pay for it)
  • Retail Price – shown on ‘main’ site
  • Government price (our primary customer is the U.S. Government) – only shown on our government subdmain
  • Sale Price (valid for 1 month, but extended every month) – only shown on our government subdomain
  • BPA Price (special price for BPAs) – not shown but loaded onto government sites

The list price is provided in the vendor’s quarterly data file and kept in the Products table, since it’s a finite part of a product entity. How should I handle the other prices though?

I’m thinking the best (only?) course of action is to have a separate table with the different price structure as well as SaleStartDate and SaleEndDate columns that I can check to see whether or not to display the sale price. In fact, I’m not sure of any other way to handle this.

Also, I will need to have a duplicate of this (different prices, but same cost) as our company does the processing (all the work, really) for a different company that’s in the same business as us; the products are identical but customers/orders/specific prices are different. The current implementation has a duplicate database with everything repeated (same with the code) and I want to avoid this like the plague so I’m trying to come up with a way to abstract the common things out.

EDIT (2/17/2009 @ 12:57PM): Except for the list price, the prices are all calculated based off the cost, however it’s not always that easy; sometimes items need to have their prices manually changed independently of the margin, however this is handled manually via Excel and only once per quarter (3 months); when the data is loaded into the database the price is finite and isn’t changed until the following quarter; the ‘sale’ price is on perpetually forever, but it expires (not on our site, but on several government sites like GSA Advantage) and needs to be extended; it doesn’t change though when it’s extended. The sale price is just to have our own site in sync with GSA Advantage, so if a government customer visits our site they’ll see identical pricing as they would on Advantage.

RE: The other company, that might be a way to go, although it would be insanely annoying to have to do everything multiple times; the products are exactly the same, the cost is exactly the same (we basically do everything for them, it’s another company in name only and the fact they have different customers than we do), but their prices use a different markup than ours. Everything else is identical, which is why I was hoping to keep stuff like the product information in one table, and then keep the differences in separate tables. The current system is a mess largely because everything (database, code files, images, everything) is duplicated, so refactoring the code in our website requires an identical change made to the other website.

EDIT (2/17/2009 @ 4:52PM): Some very good ideas so far. One of the issues is that, apart from reporting purposes and reference, only one of the price columns is ever the ‘real’ one. For example, the government price is always shown to government customers, but the sale price is shown instead if the current date falls during the sale date (‘sale’ pricing is specific to government customers). If the customer is ordering for a BPA (this will be determined by our order processing system and/or manual override by a user), the price is automatically the BPA price. The list price might be shown to display the discount you are getting, and it’s required for reports, but nothing else.

Also, I’m unsure of how badly normalizing things will make updates. Right now, I’m just handed a spreadsheet with new pricing and told to update the database (since they’re all in the products table); I do this based on the product’s SKU since the ID is internal only and all of the related tables are linked via the SKU. With a separate price table it becomes even more unwieldy, although I could still use the SKU as the reference (it’s going to be a unique index for a product) but a lot more would have to be done manually.

  • 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. 2026-05-11T07:43:18+00:00Added an answer on May 11, 2026 at 7:43 am
    • My first question is, can all of the prices be calculated from one of the prices? If yes and the rules are the same across products, we’re in a somewhat easier place.

    • Do any of the prices change independently of other prices? You have hinted that the Sale Price is valid for 1 month and then extended – does the price remain the same or does it change? If it stays the same, this is easier than if it changes.

    You’re on the right lines with having a start and end date set for product prices as this will be fundamental for historical price reporting.

    EDIT:

    I was thinking that you could use persisted computed columns for the other prices based on the cost price, but since the prices can be manually adjusted this isn’t an option (I don’t believe you can override p.c.c. values). You could write a stored procedure to insert the initial prices into a PRICE table based on cost price.

    Based on the info so far, I think you’re best option would be to have a separate PRICE table from your PRODUCT table and a product_id foreign key in your PRICE table referencing a primary key id of the PRODUCT table –

    PRODUCT table

    id | name | image | description | etc...  

    PRICE table

    id | product_id | list_price | cost_price | retail_price | gov_price | sale_price | bpa_price | start_date | end_date 

    It is prudent to have the start and end date fields on your pricing because not only can you historically report prices, but also populate the table with future prices.

    With the above structure, now when you have a price change, you would need to insert a new record in the PRICE table for the product. Set up indexes on start and end dates, then you would query products and prices as follows

    SELECT  product.name, price.list_price, price.cost_price, price.retail_price /*, ETC... */ FROM product INNER JOIN price ON product.id = price.product_id WHERE price.start_date <= @date AND price.end_date >= @date 

    You could normalize this design further and also have a PRICE_TYPE table. The thing to bear in mind with taking this approach however, is that if you want to get the full set of prices for a product, then the WHERE clause is applied to 6 records for each product.

    To handle the other company situation, provided the proper permissions and restrictions are put in place, I see few * problems with storing their prices in the same database. You say they use different markup – are you referring to their prices? If so, you could handle this with a company_id within the price table. Access to data could be controlled through stored procedures and updating prices through transactions.

    *it depends on how closely coupled the work is between companies. Is it permissible to share resources?

    (N.B. I’ve made the assumption that your target database is SQL Server, but I would imagine the logic to be similar for other platforms).

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

Sidebar

Related Questions

I have a database table which stores products. Each product can have multiple colours.
My problem is that I have three different stock sizes for each product that
I'm designing a product database where products can have very different attributes depending on
I have a database with these tables: products,colors,sizes Each product(t-shirts,jeans etc) can have multiple
I have a product database with several product categories. Each category has a number
Building an inventory system. I have lots of products and each product has three
I have a table products and table sizes. Each product can have multiple sizes.
I have a PRODUCTS table, and each product can have multiple attributes so I
I have a database table with categories for different products in it. Each category
I have a products table containing products. Each product can have multiple images. The

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.