Hi All,
Can name of foreign key and it reference be same.
For example in reference_TABLE table given below instead of name 'ref_name' shall is use it with the same
name as in sample_ONE i.e SampleName.
i.e can i have it as given in "Section: Can i have " given below.
Please note that 'sample_ONE is same in both sections only reference_TABLE has changed.
Section: Actual
--------------
create table sample_ONE(
SampleName varchar(100),
PRIMARY KEY (Name),
);
create table reference_TABLE(
ref_name varchar(100),
id int(11) unsigned,
PRIMARY KEY (id),
FOREIGN KEY (ref_name) REFERENCES sample_ONE(SampleName),
);
----------------
Section: Can i have
--------------
create table sample_ONE(
SampleName varchar(100),
PRIMARY KEY (Name),
);
create table reference_TABLE(
SampleName varchar(100),
id int(11) unsigned,
PRIMARY KEY (id),
FOREIGN KEY (SampleName) REFERENCES sample_ONE(SampleName),
);
____________________
Thanks,