I want to create a table relationship with MYSQL PHPMYADMIN.
But NOT with the constraint.
Here is what i did:
CREATE TABLE runs (
code_teachers int(8),
code_department int(8),
primary key(code_teachers, code_department),
foreign key(code_teachers)references teachers,
foreign key(code_department)references department
);
So as you can see i am trying to create table relation named runs between code_teachers from teachers create table and code_department from department create table.
But for some UNKNOWN reason it just DOESN’T make the relation when i enter desinger.
So if anyone knows the answer to my problem you are welcome to tell me cause ima go crazy here.
Did you try
tableName seems to be missing from your query.
Foreign keys need to reference columns from other tables.
Wikipedia says :
In the context of relational databases, a foreign key is areferential constraint between two tables. A foreign key is a field
in a relational table that matches a candidate key of another table.
The foreign key can be used to cross-reference tables.
mySQL.com says :
Foreign key relationships involve a parent table that holds thecentral data values, and a child table with identical values pointing
back to its parent. The FOREIGN KEY clause is specified in the child
table.