[工学]ch02-Relation model.ppt

[工学]ch02-Relation model

Database Systems Unit 2 The Relational Model Relational Model Relational Algebra(关系代数) Relational Calculus(关系演算) Relational Model Laid down in 1969-1970 by E.F.CODD “ A Relational Model of Data for Large Shared Data Bank” , ACM 1970 Mathematical Bases ( Relational Theory) Developed in 1980s Most commercial DBMS are Relational Mathematical Relations Formally, given sets D1, D2, …. Dn, a relation r is a subset of Cartesian product(笛卡尔积) D1 × D2 × … × Dn Thus a relation(关系) is a set of n-tuples (a1, a2, …, an) where ai ? Di Example: if customer-name = {Jones, Smith, Curry, Lindsay} customer-street = {Main, North, Park} customer-city = {Harrison, Rye, Pittsfield} Then r = {(Jones, Main, Harrison), (Smith, North, Rye), (Curry, North, Rye), (Lindsay, Park, Pittsfield)} is a relation over customer-name × customer-street × customer-city. Mathematical Relations Each attribute of a relation has a name The set of allowed values for each attribute is called the domain(域) of the attribute Attribute values are (normally) required to be atomic; that is, indivisible Note: multivalued attribute(多值属性) values are not atomic Note: composite attribute (组合属性) values are not atomic The special value null is a member of every domain The null value causes complications in the definition of many operations Mathematical Relations A1, A2, …, An are attributes R = (A1, A2, …, An ) is a relation schema(关系模式) E.g. Customer-schema = (customer-name, customer-street, customer-city) r(R) is a relation on the relation schema R E.g. customer (Customer-schema) Mathematical Relations The current values (relation instance, 关系实例) of a relation are specified by a table An element t of r is a tuple(元组), represented by a row in a table Order of tuples is irrelevant (元组是无序的 tuples may be stored in an arbitrary order) Relational Database A Relational database consists of multiple relations Information abo

文档评论(0)

1亿VIP精品文档

相关文档