Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Adding foreign keys after table creation?
Hi;
I'm a complete newbie on Oracle and SQL. I got my copy of Oracle Personal Edition installed and working - at least the initial database is there and I'm able to play around with it.
In order to learn, I've bought a book from Osborne called SQL, The Complete Reference. I tried the create table script that they have in the book and it's not working correctly due to the differences between what the book calls standard and Oracle's sql. If I can get the tables created, I can keep going with the book; however, I'm having difficulties working through Oracle's syntax for adding foreign keys after the table's been created.
I've tried variations on the following:
alter table customers
modify cust_rep constraint foreign key cr_fk
references salesreps;
and
alter table customers
add constraint foreign key (cust_rep)
references salesreps.
Any tips on this particular problem would be greatly appreciated - also, any tips on sql books that lean towards Oracle would also be helpful.
Thanks for your time.
Doug O'Leary
--