In: Computer Science
What is the foreign key that creates a relationship between the Book and Publisher entities?
What is the foreign key that creates a relationship between the Book and Publisher entities:
Answer: Publisher
Description:
• Foreign key - FK: Foreign key is an attribute or a column in a table which references to the primary key or column of another table. Primary key or attribute and foreign key are must of the same data type.
• Consider the following two entities:
Book
Publisher
• Book table is having attributes like ISBN_NO [PK], title, author, publisher [FK] and Publisher table is having attributes like Publisher_ID [PK], name, country.
Book (ISBN_NO[PK], title, author, publisher [FK])
Publisher (Publisher_ID [PK], name, country)
• Foreign key is used to relate two tables in the sane database. Here, each book of the Book table is related to a publisher in Publisher table through the “publisher” foreign key in a Book table.
• Here, Foreign key is publisher which contains appropriate corresponding Publisher_ID of the Publisher table.
• Consider the following diagram showing the relationship between the Book and Publisher entities. Arrows in the figure shows the relation or link between the foreign key of one table and primary key of another table.
• "publisher" is the foreign key that creates a relationship between the Book and Publisher entities.