Reputation: 13
I'm having a problem with a FOREIGN KEY
. I'm always getting
FOREIGN KEY (STUDID)
*
ERROR at line 3:
ORA-00904: "STUDID": invalid identifier
Upvotes: 1
Views: 183
Reputation: 3344
Carson is correct - it seems like you are trying to build a relationship between Students and Subjects. Typically this is a many to many relationship, and would likely require a third, middle table to link them.
Think
"A Student can be enrolled to many subjects."
"A Subject can have many Students enrolled."
So you need a middle table with both STUDID
and SUBJECTID
columns, and that table would have 2 FKs declared, pointing to the other tables.
[edit] of course, that's the whole 3rd normal form thing .. you may or may not want/need to denormalize at some point, but that's a different discussion ;) [/edit]
Upvotes: 1
Reputation: 1287
You have no field called STUDID
in your SUBJECT
table. Looks like you're trying to create a foreign key on a field that doesn't exist.
Upvotes: 1