J
Jeff B
Hi All,
I am wondering if someone here could help me and hopefully help me get
somewhat un-confused. I am in a class in college for database design. We
are discussing Normalization and 3rd and 4th normal form, This has really
confused me in setting up tables. I have not dealt with tables that use
more than one field as a Primary Key, as in combining 2 fields that are
foriegn keys to a couple of different tables to make the Primary Key for
said table? Is there an easy way to think of this that might make sense?
Also the otherr thisng that has me very very stumped which goes along with
the first question is when you have items that are Many-to-Many Relations.
Example being:
A company has more than one warehouse that are identified but a name and
number. Products could be stored in any warehouse. So I know that this is
a Many-to-Many Relationship.
The company has many suppliers that it could get any given product from. So
I know that this is a Many-to-Many Relationship
So setting up the table design for this I understand I would have, I think,
either 4 or 5 tables:
Warehouse (WarehouseID-PK-, WarehouseNumber, WarehouseName)
Suppliers (SuppliersID-PK-, SupplierName)
Products (ProductsID-PK_, Description, Class, Price, SuppliersID-FK-)
I am pretty sure those are needed and correct except for maybe the
suppliersId Foriegn Key in the Products Table
This is where I am very confused in setting up the tables for the
Many-to-Many Relationships, would I need just one more table that would
incorporate both the many suppliers and many Warehouses or does this need to
be broke up?
ProductsDetail (ProductDetailID-PK-, ProductsID-FK, WarehouseID-FK,
SuppliersID-FK-, OnHandQty)
Thank you for the help, I am sure there has to be an easy way to
think/remember this and that I am probably just making it way more difficult
than it really is.
Jeff B.
I am wondering if someone here could help me and hopefully help me get
somewhat un-confused. I am in a class in college for database design. We
are discussing Normalization and 3rd and 4th normal form, This has really
confused me in setting up tables. I have not dealt with tables that use
more than one field as a Primary Key, as in combining 2 fields that are
foriegn keys to a couple of different tables to make the Primary Key for
said table? Is there an easy way to think of this that might make sense?
Also the otherr thisng that has me very very stumped which goes along with
the first question is when you have items that are Many-to-Many Relations.
Example being:
A company has more than one warehouse that are identified but a name and
number. Products could be stored in any warehouse. So I know that this is
a Many-to-Many Relationship.
The company has many suppliers that it could get any given product from. So
I know that this is a Many-to-Many Relationship
So setting up the table design for this I understand I would have, I think,
either 4 or 5 tables:
Warehouse (WarehouseID-PK-, WarehouseNumber, WarehouseName)
Suppliers (SuppliersID-PK-, SupplierName)
Products (ProductsID-PK_, Description, Class, Price, SuppliersID-FK-)
I am pretty sure those are needed and correct except for maybe the
suppliersId Foriegn Key in the Products Table
This is where I am very confused in setting up the tables for the
Many-to-Many Relationships, would I need just one more table that would
incorporate both the many suppliers and many Warehouses or does this need to
be broke up?
ProductsDetail (ProductDetailID-PK-, ProductsID-FK, WarehouseID-FK,
SuppliersID-FK-, OnHandQty)
Thank you for the help, I am sure there has to be an easy way to
think/remember this and that I am probably just making it way more difficult
than it really is.
Jeff B.