数据库

本类阅读TOP10

·SQL语句导入导出大全
·SQL Server日期计算
·SQL语句导入导出大全
·SQL to Excel 的应用
·Oracle中password file的作用及说明
·MS SQLServer OLEDB分布式事务无法启动的一般解决方案
·sqlserver2000数据库置疑的解决方法
·一个比较实用的大数据量分页存储过程
·如何在正运行 SQL Server 7.0 的服务器之间传输登录和密码
·SQL中两台服务器间使用连接服务器

分类导航
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. 

 

 

 

 

 

 

 

 

 

 




相关文章

相关软件