foreign key reference to two tables? how to do it?# Database - 数据库
m*r
1 楼
Here, I got one foreign key data_id in table PLAN reference to two table
PROGRAM_TEXT(primary key data_id) and PROGRAM_MEDIA(primary key data_id)
how to write sql?
Create Table Plan
(
....
foreign key (Data_id) references PROGRAM_MEDIA(Data_id) ON DELETE CASCADE,
foreign key (Data_id) references PROGRAM_TEXT(Data_id) ON DELETE CASCADE
)
It doesn't work!!!!
pls help me
email: j*******[email protected]
PROGRAM_TEXT(primary key data_id) and PROGRAM_MEDIA(primary key data_id)
how to write sql?
Create Table Plan
(
....
foreign key (Data_id) references PROGRAM_MEDIA(Data_id) ON DELETE CASCADE,
foreign key (Data_id) references PROGRAM_TEXT(Data_id) ON DELETE CASCADE
)
It doesn't work!!!!
pls help me
email: j*******[email protected]