proud Posted February 8, 2010 Share Posted February 8, 2010 Hello everyone, I have 2 tables: [books] with the fields (id, title,author,isbn) and another table called [book issue] with the fields (id, borrower_id, borrow_date, book_isbn).. Now the field (book_isbn) in the [book issue] table references (isbn) in the books table, which is a unique field but not a primary key. My questions: 1- Is it correct for a foreign key to reference a unique but non-primary key in another table? 2- Is it okay for the foreign key field to have a different name than the field it references in the other table? Your help is indeed appreciated.. Quote Link to comment https://forums.phpfreaks.com/topic/191351-can-a-foreign-key-reference-a-unique-non-primary-key/ Share on other sites More sharing options...
Mchl Posted February 8, 2010 Share Posted February 8, 2010 1. Yes 2. Yes 3. I would avoid using ISBN as a field referencing anything in database. I've been working in book publishing business for some time and have seen my sort of fscked up ISBNs along the way. Quote Link to comment https://forums.phpfreaks.com/topic/191351-can-a-foreign-key-reference-a-unique-non-primary-key/#findComment-1008841 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.