Basically I’m rather new to MySQL and in an example I see this foreign key being added:
ALTER TABLE Department ADD FOREIGN KEY managerIsInDepartment
(manager,id) REFERENCES Employee(id,worksAt);
I suppose one foreign key is being added (of the name managerIsInDepartment).
But I thought the attributes in the parentheses were the attributes to turn into foreign keys?
Why is managerIsInDepartment being displayed?
managerIsInDepartmentis simply a name for the key to help identify it. You can omit it and one will be automatically generated.Hope this helps.
A good reference.