嗨我和我的朋友不能同意DVD租赁数据库的哪种型号更好。 这是我的模特。DVD租赁数据库2个不同的表模型
Table: Rent
NAME TYPE
ID_Rent Integer (Primary key)
ID_Customer Integer (foregin key from Customer)
ID_office Integer (foreign key from office)
Date of Rent DateTime
Date of Returning DateTime
Possibly_penalty_in_euros Integer
Table : Rented_DVD
NAME TYPE
ID_Rented_DVD Integer (Primary key)
ID_DVD Integer (foreign key from DVD table)
ID_Rent Integer (foreign key from Rent)
这是他的模型
Table: Rent
NAME TYPE
ID_Rent Integer (Primary key)
ID_Customer Integer (foreign key from Customer)
ID_DVD Integer (foreign key from DVD table)
ID_office Integer (foreign key from office)
Date of Rent DateTime
Date of Returning DateTime
Possibly_penalty_in_euros Integer
我的问题是...哪种模式更好?在这两张桌子中,我们有客户,办公室,DVD等领域,但他们并不重要。这是关于如果有人进入我们的办公室并且将同时租用例如4张DVD。
在我的情况下,我会将1行放入表Rent并将4放入表Rented_DVD。它将消耗78个字节的空间。 Rented_DVD中的3个整数* 4行* 4个字节+ 4个整数* 4个字节+ 2个日期时间* 7个字节= 78个字节的空间。
我的朋友会将4行放入租表中,他将占用136个字节的空间(5个整数* 4个字节+ 2个日期时间* 7个字节)* 4个行= 136个字节的空间。
那么这是否意味着我的模型比他更好?他的模型分别比我的消耗更多的数据空间还是我计算错误?
@BobJarvis A)这就是当目标网站没有出现在列表中时的“自定义原因标志”。B)不是它不属于代码评论。这是数据库模型审查,而不是代码审查。 C)投票关闭,因为它是堆栈溢出的主题,不是因为它属于别的地方。 –
如果你想允许在不同的日子里返回不同的dvds,你的模型的返回日期(和惩罚?)应该移动到租借的表。 – Glenn
make:'Date of Rent'和'Date of Returning'与您的其他列一致,使用下划线并使它们成为:'Date_of_Rent'和'Date_of_Returning' –