473,406 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

database design

DB
Hello All,

I'm failling to get my head around a normalisation and db design issue, and
was hoping someone may be able to offer some comments.
I have two tables ProductGroups and ProductItems.
ProductGroups has a Manufacturer, Model, and Image (cutting it to basics)
ProductItems has a MasterID field - relating to a ProductGroup so that each
item can be associated with a particular ProductGroup, however, although the
majority of items are specifically associated with one ProductGroup some
items are more general and can be associated with any number of
ProductGroups.
I'm not sure how to address this in the best manner, as I don't want to be
repeating data as will be the case currently. Will it be best to have one
productitems table for specifically related items and one for the more
general items? The more I think about it the more I seem to confuse myself!
Any help greatly appreciated.

Cheers,
D.
Nov 12 '05 #1
3 1496
I think you need 3 tables:

ProductGroups
GroupID (PK)
GroupName
GroupDesc

Products
ProductID (PK)
Maker
etc...

ProductsAndGroups
ProductID (FK)
GroupID (FK)
other info...

In the ProductsAndGroups junction table, set the PK to the combination
of ProductID and GroupID.

Cheers,
Pavel

DB wrote:

Hello All,

I'm failling to get my head around a normalisation and db design issue, and
was hoping someone may be able to offer some comments.
I have two tables ProductGroups and ProductItems.
ProductGroups has a Manufacturer, Model, and Image (cutting it to basics)
ProductItems has a MasterID field - relating to a ProductGroup so that each
item can be associated with a particular ProductGroup, however, although the
majority of items are specifically associated with one ProductGroup some
items are more general and can be associated with any number of
ProductGroups.
I'm not sure how to address this in the best manner, as I don't want to be
repeating data as will be the case currently. Will it be best to have one
productitems table for specifically related items and one for the more
general items? The more I think about it the more I seem to confuse myself!
Any help greatly appreciated.

Cheers,
D.

Nov 12 '05 #2
I think you need to set up a many-to-many association - where in most
cases an item is only assoc. with one Group, but could also be assoc.
with multiple groups.....it means an extra table but keeps the two
'data' tables clean

"DB" <%64%69%7a%7a%79%62%69%72%64%40%64%69%7a%7a%79%2e% 63%78> wrote in message news:<vq************@corp.supernews.com>...
Hello All,

I'm failling to get my head around a normalisation and db design issue, and
was hoping someone may be able to offer some comments.
I have two tables ProductGroups and ProductItems.
ProductGroups has a Manufacturer, Model, and Image (cutting it to basics)
ProductItems has a MasterID field - relating to a ProductGroup so that each
item can be associated with a particular ProductGroup, however, although the
majority of items are specifically associated with one ProductGroup some
items are more general and can be associated with any number of
ProductGroups.
I'm not sure how to address this in the best manner, as I don't want to be
repeating data as will be the case currently. Will it be best to have one
productitems table for specifically related items and one for the more
general items? The more I think about it the more I seem to confuse myself!
Any help greatly appreciated.

Cheers,
D.

Nov 12 '05 #3
"DB" <%64%69%7a%7a%79%62%69%72%64%40%64%69%7a%7a%79%2e% 63%78> wrote in message news:<vq************@corp.supernews.com>...
Hello All,

I'm failling to get my head around a normalisation and db design issue, and
was hoping someone may be able to offer some comments.
I have two tables ProductGroups and ProductItems.
ProductGroups has a Manufacturer, Model, and Image (cutting it to basics)
ProductItems has a MasterID field - relating to a ProductGroup so that each
item can be associated with a particular ProductGroup, however, although the
majority of items are specifically associated with one ProductGroup some
items are more general and can be associated with any number of
ProductGroups.
I'm not sure how to address this in the best manner, as I don't want to be
repeating data as will be the case currently. Will it be best to have one
productitems table for specifically related items and one for the more
general items? The more I think about it the more I seem to confuse myself!
Any help greatly appreciated.

Cheers,
D.


You'll need 3.

Product--(1,M)--ProdGroupMembership--(M,1)--ProductGroup

CREATE TABLE ProdGroupMembership(
ProductID As Long,
GroupID As Long,
PRIMARY KEY (ProductID, GroupID)
FOREIGN KEY ProductID REFERENCES Product(ProductID),
FOREIGN KEY GroupID REFERENCES ProductGroup(GroupID));
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rushikesh | last post by:
I am designing a WEB BASED Accounting Software with ASP and SQL Server. For this I need some help for the Database design. My design is as follows. I)User table: User_id, UserName..... Users...
5
by: Don Vaillancourt | last post by:
Hello all, Over the years as I design more database schemas the more I come up with patterns in database design. The more patterns I recognize the more I want to try to design some kind of...
1
by: Lane Beneke | last post by:
All, New to the list and a relative newbie to PostgreSQL. Please forgive stupid questions. Designing an application server for a work order processing (et al) database. I have a good handle...
5
by: trynittee | last post by:
Hello, It's been a while since I've posted. I am an intermediate user of Access. I can read simple VB code, have done complex queries, comfortable with event procedures, designing forms and...
12
by: nyathancha | last post by:
Hi, I have a question regarding best practices in database design. In a relational database, is it wise/necessary to sometimes create tables that are not related to other tables through a...
3
by: vicky | last post by:
Hi All, Can u please suggest me some books for relational database design or database modelling(Knowledgeable yet simple) i.e. from which we could learn database relationships(one to many,many to...
0
by: Laurynn | last post by:
# (ebook - pdf) - programming - mysql - php database applicati # (Ebook - Pdf)Learnkey How To Design A Database - Sql And Crystal Report # (ebook-pdf) E F Codd - Extending the Database Relational...
1
by: abhijitbkulkarni | last post by:
Hello, I am designing a .NET database application that uses 3 tier architecture. Starting initially, this application will be desktop application but I will convert it into a website later but...
0
by: sam | last post by:
Hi, Hope you are doing well !!!! One of our clients is looking to augment their team with “Database Architect – DB2" please find below the details and respond with
2
by: programmerx101 | last post by:
Ok, I'm looking for expert advice on this one. I have a database which keeps going into read_only mode. Sometimes it goes into read_only / single user mode. Once it was taken offline completely....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.