[英]Are these tables respect the 3NF Database Normalization?
AUTHOR
table AUTHOR
表
Author_ID
, PK Author_ID
,PK First_Name
Last_Name
TITLES
table TITLES
表
TITLE_ID
, PK TITLE_ID
,PK NAME
Author_ID
, FK Author_ID
,FK DOMAIN
table DOMAIN
表
DOMAIN_ID
, PK DOMAIN_ID
,PK NAME
TITLE_ID
, FK TITLE_ID
,FK READERS
table READERS
表
READER_ID
, PK READER_ID
,PK First_Name
Last_Name
ADDRESS
CITY_ID
, FK CITY_ID
,FK PHONE
CITY
table CITY
表
CITY_ID
, PK CITY_ID
,PK NAME
BORROWING
table BORROWING
表
BORROWING_ID
,pk BORROWING_ID
,pk READER_ID
, fk READER_ID
,fk TITLE_ID
, fk TITLE_ID
,fk DATE
HISTORY
table HISTORY
表
READER_ID
TITLE_ID
DATE_OF_BORROWING
DATE_OF_RETURNING
This looks a bit like a homework problem, but let me answer anyway: 这看起来有点像家庭作业问题,但让我回答:
I would change the Titles to a MANY-TO-MANY, and leave the addresses. 我会将标题更改为许多,并保留地址。
TITLES
table TITLES
表
TITLE_ID
, PK TITLE_ID
,PK NAME
TitleAutors
table TitleAutors
表
TITLE_ID
, TITLE_ID
, AUTHOR_ID
You could change the BORROWING table to have the status of the entry (OUT, IN, MISSING, UNKNOWN) and have a STATUS_DATE. 您可以将BORROWING表更改为具有条目的状态(OUT,IN,MISSING,UNKNOWN)并具有STATUS_DATE。
How do you expect anybody to seriously answer this question without any knowledge of your business domain ? 在没有任何业务领域知识的情况下,您如何期望任何人认真回答这个问题?
In order to answer this question earnestly, one needs to know the entire set of functional dependencies that govern your data, and you have not provided those. 为了认真回答这个问题,我们需要知道管理数据的整套功能依赖关系,而你却没有提供这些依赖关系。
For your scheme to be in 3NF, for example, it would require that domainID -> titleID, or, in other words, that there is only one title for each domain, and that knowing the domain implies that you can know the title. 例如,对于你的方案是3NF,它需要domainID - > titleID,换句话说,每个域只有一个标题,知道域意味着你可以知道标题。 On the face of it, that seems curious, but the only one who can tell for sure whether or not this is an accurate representation of the business reality that you're dealing with, is you.
从表面上看,这似乎很奇怪,但是唯一能够确定这是否是您正在处理的商业现实的准确表示的人,就是您。
An additional thought that occurred to me after reading others comments is. 在阅读其他评论后,我想到了另一个想法。
If so you may have redundant first and last names entered into your system, and it would be susceptible to update anomalies. 如果是这样,您可能会在系统中输入多余的名字和姓氏,并且可能会更新异常。 For example if Jane Smith was a reader and an author and got married and her Surname changed to Williams then the possibility for updating her Reader last name and not her author last name would exist.
例如,如果简史密斯是读者和作者并结婚并且她的姓氏改为威廉姆斯,则存在更新她的读者姓氏而不是她的作者姓氏的可能性。
You would fix this by perhaps creating a User table where you have two Foreign keys for a Authors and Readers Table. 您可以通过创建一个User表来修复此问题,其中您有两个用于作者和读者表的外键。 Just a thought... ;)
只是一个想法... ;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.