Don't know how to handle this relationship

I am a college student and am having a hard time wrapping my head around the database I have to work with for a project. The project entails implementing an auto parts application. I have not encountered a relationship like this before. I have linked to a document I made to describe the table. It can be found here: http://91.121.116.152/graph.pdf. There are basically 4 tables in the database. There is 1 table for all the automakers. (MAKER). Then, there are many tables in the form of APL___ where ___ is a column for the MAKER Table. The APL tables contain all the different models and links to the different parts. The column RLINK references RADCRX which contains 16 different columns. Each set of 4 columns contains part numbers that link to a RAD___ (where ___ is a 3 letter abbr for a vendor).
I've done my best to explain it in English, but I think the document may help. Naturally the assignment is to find parts for a specified car. My problem is how do I do this as effciently as possible? I don't know how to handle a relationship where column name points to a table name, not a column in the table. It could be done with a very long join such as
SELECT * FROM RADMOD, RADCRX WHERE RADCRX.MOD1=RADMOD.P_NUMBER
or so on for each column in RADCRX. This doesn't seem right. I thought about doing joins on the tables, but I don't know how to do it. The DB as about 20K records. Does anyone have any insight?

Try the ff solution if it works:
1.)Create a union view for APL_ _ _
create or replace view v_APL_ALL as
select a.*,'CHE' m_code from APLCHE a
union all
select b.*,'TOY' m_code from APLTOY b
union all
select b.*,'HON' m_code from APLHON b
union all
select c.*,'MIT' m_code from APLMIT c
2.)Create a view for v_APL_ALL and MAKER
create or replace view v_APL_ALL_MAKER as
select a.*,b.M_NUMBER,b.MAKER
from v_APL_ALL a,MAKER b
where a.m_code=b.m_code
3.)Create view for RAD_ _ _
create or replace view v_RAD_ALL as
select a.*,'ARS' VENDOR_CODE from RADARS a
union all
select b.*,'MOD' VENDOR_CODE from RADMOD b
union all
select c.*,'BEH' VENDOR_CODE from RADBEH c
union all
select c.*,'DAN' VENDOR_CODE from RADDAN c
4.) Create a view for v_RAD_ALL and VENDOR
create or replace view v_RAD_ALL_VENDOR as
select a.*,b.M_NUMBER,b.MAKER
from v_RAD_ALL a,VENDOR b
where a.VENDOR_CODE=b.VENDOR_CODE
You can now join them & query it.
Regards,
Benjie

Similar Messages

Maybe you are looking for