Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> SQL relating to foreign key table
I need to write a small block of SQL code and was looking for some
advice on the "correct" way to do this. Let's say I have three
tables, one is a list of products, which is already populated with
product info. The third table has a list of ways a product can be
packaged. Of course all products are not packaged in all ways. The
second table is where I will store the list of each product and have
it is packaged. So I have a foreign relation from the product table
to the way packaged table. And a foreign relation from the way
packaged table to the list of packaging type. Ok, so I am importing a
list of product codes and the way it's packaged, one line for each
package method. I want to do an insert into the second table with the
product number and the reference to the third table that matches the
package method in each line. Can someone show me a sample of how to
formulate a SQL code to say I have this Package method, what is the
unique identifier in the third table that goes with this so I can put
that value in the second table? Thanks.
JR Received on Sat Apr 05 2003 - 21:07:14 CST
![]() |
![]() |