Rabu, 13 Juli 2016

Re: [MS_AccessPros] Primary Index

 

Sarah-


It sounds like you have a fundamental design problem.  You have two subjects:  Products and Colors.  Some products come in many colors (or none), and all colors are potentially used by some product.  Thus you have a many-to-many (Products have many Colors and Colors apply to many Products), so your table design should be:

Products:  Product ID, Product Name, etc.  (but NOT color ID)

Colors:  Color ID, Color Description, etc.

ProductsColors: Product ID, Color ID

When a product has no color options, then there will be no row in the ProductsColors table.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jul 13, 2016, at 8:34 AM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Sarah,
 
Can you add a "NA" color to your color table?
 
Duane
 

To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Tue, 12 Jul 2016 19:35:54 -0700
Subject: [MS_AccessPros] Primary Index



I have a Product table.
The primary key is the Product ID and Color ID. The same Product ID  is available in multiple colors.
Some Products dont have a Color, but I can not update the record without entering something in the Color ID.
I have tried space , but it does not accept it. 
Is there anyway I can have the Color ID as part of the Primary key even though in same cases it is blank/null?
Thanks
Sarah





__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar