我有一组关系模式的功能依赖项,需要找到最小的封面。我理解消除冗余线路的基本概念,但我正在努力完成它。完成此任务的最有效方法是什么?
这些是功能依赖:
client --> office
stock --> exchange, dividend
broker --> profile
company --> stock
client --> risk_profile, analyst
analyst --> broker
stock, broker --> investment, volume
stock --> company
investment --> commission, return
stock, broker --> client
account --> assets
答案 0 :(得分:0)
转换所有FD,使得任何FD的RHS仅包含单个属性
client --> office
stock --> exchange
stock --> dividend
broker --> profile
company --> stock
client --> risk_profile
client -->analyst
analyst --> broker
stock, broker --> investment
stock, broker --> volume
stock --> company
investment --> return
investment --> commission
stock, broker --> client
account --> assets
我们需要寻找下一步 LHS上的冗余属性
选择在LHS上具有2个或2个以上属性的FD
1.stock, broker --> investment
一次从LHS中删除一个属性,如果属性的clouser包含已删除的属性,则计算剩余属性的clouser,然后您可以实际删除该属性。
删除股票表格1并计算经纪人的clouser
(broker)+ = {broker,profile,investment,return ,commission}
不包含库存,因此您无法删除库存
删除经纪人表单1并计算库存的clouser
(stock)+ = {stock,exchange,dividend,investment,return,commission,company}
不包含经纪人,因此您无法删除经纪人
你可以玩跟随FD的同一游戏
2.stock, broker --> volume
3.stock, broker --> client
对于FD 3.你会发现可以删除经纪人,导致跟随FD
client --> office
stock --> exchange
stock --> dividend
broker --> profile
company --> stock
client --> risk_profile
client -->analyst
analyst --> broker
stock, broker --> investment
stock, broker --> volume
stock --> company
investment --> return
investment --> commission
stock --> client
account --> assets
最后一步是寻找多余的FD。 检查X形式的FD ---> Y是X的冗余计算缓冲区并检查它是否包含Y,如果是这种情况,则可以安全地从最小覆盖集中删除FD。如下所示。
client --> office
计算客户端的clouser
(client)+ = { client , risk_proflie,analyst,broker,profile }
clouser不包含办公室,因此您无法将其删除。 重复最后一步,你会发现没有FD可以删除,因此最小的封面集是
client --> office
stock --> exchange
stock --> dividend
broker --> profile
company --> stock
client --> risk_profile
client -->analyst
analyst --> broker
stock, broker --> investment
stock, broker --> volume
stock --> company
investment --> return
investment --> commission
stock --> client
account --> assets