|
-
Hi all, I am new to DBA, hope you can help me. Thanks!
I try to create 2 tables as following,
Create table Table1
(
constraint table1_col12_pk primary key (col1, col2),
ad varchar2(10),
col1 number,
col2 varchar2(20)
);
Create table Table2
(
t_date date,
col2 varchar2(20)
constraint table2_col2_fk references table1(?????)
);
I try to set a foreign key, table2_col2_fk, references to table1_col12_pk. However, the primary key is a combination of columns, and the foreign key only need to link to col2 in Table1. How do I set this up? Do I need to add another column in Table2? If so, how is the foreign key beeing set up? Thanks for the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|