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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:43:12+00:00 2026-05-28T13:43:12+00:00

How to I represent the following datamodel in sql tables. I have 3 entities,

  • 0

How to I represent the following datamodel in sql tables.

I have 3 entities, company, productcategory and product.

Business model is that Company can have product category1-N and each category can have many products.

The trick is that products are shared across companies under different categories. Product categories are not shared. Each company has its own categories.

for example,

product1 belongs to category1 under company1

product1 belongs to category2 under company2

I’m thinking of having the following tables. Only relevant Id fields are shown below.

Company

CompanyId

ProductCategory

ProductCategoryId

CompanyId

ParentCategoryId (To support levels)

Product

ProductId

ProductCategoryXProduct

ProductCategoryId

ProductId

This way I can query for all product categories for a product and filter by company to get the specific category structure for its products. This may be different for another company even if the product is the same.

Will this cover it? is there a better approach?

  • 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-28T13:43:13+00:00Added an answer on May 28, 2026 at 1:43 pm

    Looks like a fine 3NF design that fits what you have described.

    Note that as your data set will grow, this design will start slowing down (mostly due to the required joins), so when the time comes you may want to denormalize some of these tables for faster reads.

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

Sidebar

Related Questions

I have the following classes that represent tables: public class PriceDefinition { public virtual
How would I represent the following in a CakePHP model? Product ======= product_id ....
I have a following domain model: Entity1 -> ValueType1-> Entity2 How can I write
How can I represent the following in XSD. <price-update> <![CDATA[ arbitrary data goes here
I have the following Json collection and I need to represent it as a
I have a domain data model which returns a class such as the following:
I'm wondering how I can represent the following in the criteria API return DataContext.Session.CreateQuery(
i'm just starting with SQL, i have an assignement to do that involves a
I have a Core Data model entity NoteObject that has a transformable type arrayOfTags
I have the following generic schema to represent different types of information. var Record

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.