数据库

本类阅读TOP10

·SQL语句导入导出大全
·Power Designer杂记
·SQL Server日期计算
·常用的oracle函数使用说明(一)
·sqlserver2000数据库置疑的解决方法
·MS SQLServer OLEDB分布式事务无法启动的一般解决方案
·SQL to Excel 的应用
·SQL语句导入导出大全
·Error:ORA-01033:ORACLE initialization or shutdown in progress错误解决
·Oracle中password file的作用及说明

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
Transformation Rule(逻辑实现成关系表的规则)

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

word underlined is primary key
Rule 1.Each entity in an E-R diagram is mapped to a single table in a relational database;the table is name after the entity.The columns of the table represent all the single-valued simple attributes that are attached to the entity(possibly through a composite attribute,although a composite attribute itsself does not become a column of the table)。

Rule2:Given an entity E with primary identifier p,a multi-valued attribute a attached to E in an E-R diagram is mapped to a table of its own;the table is named after the plural multi-valued attribute.The columns of this new table are named after p and a,and rows of the table correspond to (p,a) value pairs,representing all pairings of attribute values of a associated with entity occurrences in E.The primary key attribute for this table is the set of columns in p and a.
EG: (here p = = eid,a == hobby)
employes(eid,staddress,city,states,zipcodes) (197,7 Beacon,Boston,MA,02102) (221,19 Brighton St,Boston,MA,02103)
hobbies(eid,hobby) (197,chess)(197,painting)(221,reading)

Rules3:N-N Relationships.When two entities E and F take part in a many-to-many binary relationship R,the relationship is mapped to a representative table T in the related relational database design.The table contains columns for all arrtibutes in the primary keys of both tables transformed from entities E and F,and this set of columns forms the primary key for the table T.
EG:(Employees -(1,N)-works_on-(0,N)-Projects        ---N-N(many-to-many) )
employees(eid,straddr,city,state,zipcode)  --woks_on(eid,prid,percent) --projects(prid,proj_name,due_date)

Rules4:N-1 Relationships.When two entities E and F take part in a many-to-one binary relationship R,the rlationship will not be mapped to a table of its own in a relational database design.Instead,if we assume that the entity F has max-card(F,R)=1 and thus represents the “many“ side of the relationship,the relational table T transformed from the entity F should include colums constituting the primary key for the table transformed from the entity E;this is known as a foreign key in T.
EG:instructors(insid,lname,office_no,ext)  -- cours_sections(secid,insid,course,room,preriod).

Rules5:1-1 Relationships,optional Participation.Given two entities E and F that take part in a one-to-one binary relationship R,where participation is optional on either side,we wish to translate this situation into a relaional design  -- Use foreign key on either or both sides.

Rules6:1-1 Relationships,Mandatory Participation on Both Sides. In the case of a one-to-one relationship with mandatory particpation on both sides,it is most appropriate to combine the tables for the two entities into one,and in this way avoid any foreign keys. 

 

 

 

 

 

 

 

 

 

 




相关文章

相关软件




月光软件程序下载编程文档电脑教程网站设计网址导航网络文学游戏天地幽默笑话生活休闲写作范文安妮宝贝
电脑技术编程开发网络专区谈天说地情感世界游戏元素分类游戏热门游戏体育运动手机专区业余爱好影视沙龙
音乐天地数码广场教育园地科学大观古今纵横谈股论金人文艺术医学保健动漫图酷二手专区地方风情各行各业

月光软件站·版权所有