Lookup table

S

san

I have a table customer with two fields customerid and
customer name.
There is one more table sales with customerid and customer
name in it.
The relationship is one to many ( Customer to sales )

Now this is what I want to be working in table.
As soon as I enter a new record with the customer id in
sales table it should get the customer name from customer
table and fill up the customer name field of sales table.

I know this is not a correct design but is it possible?


Any suggestions will be highly appreciated.
Thanks,
San
 
T

TC

You should not duplicate the customer name in the sales table.

The purpose of the customer table is to store the customer's attributes
(such as their name) in >one place only<. Other tables (such as the sales
table) can certainly contain the customer >ID< (if appropriate), but they
should not repeat the customer name etc.

You need to learn about "database normalization". Start here for a dry, but
instructive read:
http://support.microsoft.com/support/kb/articles/Q100139.ASP

HTH,
TC
 
T

TC

Further to my comment, I note you say:
I know this is not a correct design but is it possible?

Sure it's possible. But that's like saying, "I know I should not pour sugar
into the petrol tank of my car, but is it possible?" Sure it's possible!!

Cheers,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top