我对数据库设计很陌生。
我有个疑问。这个问题非常基本。但请帮帮我。我将尝试通过一个例子来解释它。
假设,我把书放在一张桌子上,而他们的作者放在另一张桌子上(假设一本书只由一位作者(一对多)写,而一位作者可以写多本书(多对一))。我不知道如何准确链接表格以及应该自动增加什么?
tblBooks //Table 1 contains two entities
{
bookId // This field is auto-incremented
bookName
}
tblAuthors //Table 2
{
authorId // Should this field also be auto-incremented?
authorName
Field3 // What should be the 'Field3' then which acts as link between both the tables?
// What exactly is foreign key? Here 'Field3' would be foreign key or what?
}
帮助表示赞赏