And
And

Reputation: 13

Oracle / SQL Error Invalid Identifier

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

Answers (2)

Ditto
Ditto

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

Carson Moore
Carson Moore

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

Related Questions