tE Unit 2 The Relational Model A Relational model H Relational algebra(关系代数) A Relational calculus(关系演算) Haichang Gao, Software School, Xidian University 3
DataBase System Haichang Gao , Software School , Xidian University 3 Unit 2 The Relational Model Relational Model Relational Algebra(关系代数) Relational Calculus(关系演算)
DataBase System Relational model A Laid down in 1969-1970 by Ef.codd A Relational Model of data for large shared Data Bank C aCM 1970 Mathematical Bases( relational Theory) E Developed in 1980s t Most commercial dbms are relational Haichang Gao, Software School, Xidian University
DataBase System Haichang Gao , Software School , Xidian University 4 Relational Model Laid down in 1969-1970 by E.F.CODD “ A Relational Model of Data for Large Shared Data Bank” C ACM 1970 Mathematical Bases ( Relational Theory) Developed in 1980s Most commercial DBMS are Relational
DataBase System Mathematical relations E Formally, given sets D,, 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 a;∈D H EXample: customer-name=Jones, Smith, Curry, Lindsay customer-Street=(Main, North, Park) customer-city =( Ha arrison. Rye, Pittsfield) Then r=(ones, Main, Harrison) (Smith, North, rye) (Curry, North, Rye) Lindsay, Park, Pittsfield)) is a relation over customer-name x customer-street x customer-citi Haichang Gao, Software School, Xidian University
DataBase System Haichang Gao , Software School , Xidian University 5 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
DataBase System Mathematical relations g Each attribute of a relation has a name g The set of allowed values for each attribute is called the domain(tax) of the attribute Attribute values are(normally required to be atomic; that is indivisible Note: multivalued attribute(多值属性) values are not atomic H Note: composite attribute(组合属性) values are not atomic G The special value null is a member of every domain E The null value causes complications in the definition of many operations Haichang Gao, Software School, Xidian University 6
DataBase System Haichang Gao , Software School , Xidian University 6 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
DataBase System K Mathematical Relations H Al, A2,..., An are attributes R=(A1,A2,…,An) is a relation schem(关系模式) E.g. Customer-schema customer-name, customer-street, customer-city H r(R)is a relation on the relation schema r E. g. customer( Customer-schema) Haichang Gao, Software School, Xidian University
DataBase System Haichang Gao , Software School , Xidian University 7 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)