Foreign key [message #224747] |
Thu, 15 March 2007 05:50 |
pham
Messages: 17 Registered: August 2006
|
Junior Member |
|
|
I have to create this foreign key:
ALTER TABLE tab1
ADD CONSTRAINT fk_tab1_tab2
FOREIGN KEY(col1, col2) REFERENCES tab2(col1, BETWEEN min_val_col AND max_val_col);
and don't know the correct syntax.
Help, help, help
thank for your help
|
|
|
|
Re: Foreign key [message #224761 is a reply to message #224755] |
Thu, 15 March 2007 06:30 |
pham
Messages: 17 Registered: August 2006
|
Junior Member |
|
|
here more info:
the tab1 has 2 columns col1 and col2
the tab2 has a primary key with 3 columns: col1, col2_1 and col2_2
It is a foreign key to build between this two tables, where
tab1.col1 = tab2.col1 and
the value of tab1.col2 is between tab2.col2_1 and tab2.col2_2
how is the syntax for "ALTER TABLE tab1 ..."
thank in advance
|
|
|
|
Re: Foreign key [message #224792 is a reply to message #224788] |
Thu, 15 March 2007 08:55 |
pham
Messages: 17 Registered: August 2006
|
Junior Member |
|
|
ok, ok
I'm wrong, I make a mistake. It can't work with that.
I have to redesign the tables.
Thank a lot
|
|
|