Re: Please help, table design!
Posted by: Michael Loney
Date: April 30, 2014 06:20AM

Mark,

The way to create many-to-many links between two tables, is to have a third table between them.

e.g You have a 'customer' table identified by CustomerID
You have a 'postcode' table identified by PostcodeID

The third table 'customerpostcode' has just 2 fields:- CustomerID and Postcode, which are keyed to the keys in the original tables. There will be an entry for each unique customer/postcode combination.

Then by using statements like "SELECT * from customerpostcode WHERE customer ='fred'" , you will get list of all postcodes covered by 'fred'.

and a statement like ""SELECT * from customerpostcode WHERE postcode 'CF21'" will list all customers covering postcode 'CF21"

Options: ReplyQuote


Subject
Written By
Posted
March 26, 2014 02:43PM
Re: Please help, table design!
April 30, 2014 06:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.