Chapter 3: Relational Model Structure of Relational Databases Relational Algebra Extended Relational-Algebra-Operations Modification of the database Views Tuple Relational calculus Domain relational calculus 标 Database System Concepts 3.1 OSilberschatz, Korth and Sudarshan
Database System Concepts 3.1 ©Silberschatz, Korth and Sudarshan Chapter 3: Relational Model Structure of Relational Databases Relational Algebra Extended Relational-Algebra-Operations Modification of the Database Views Tuple Relational Calculus Domain Relational Calculus
Example of a Relation account-number branch-name balance A-101 Downtown 500 A-102 Perryridge 400 A-201 Brighton 900 A-215 anus 700 A-217 Brighton 750 A-222 Redwood 700 A-305 Round Hill 350 Database System Concepts 3.2 OSilberschatz, Korth and Sudarshan
Database System Concepts 3.2 ©Silberschatz, Korth and Sudarshan Example of a Relation
Basic Structure Formally, given sets D,, D2, .. D, a relation r is a subset of D X D,x.X Thus a relation is a set of n-tuples(a1, a2,..., an)where each a;∈D Example: if customer-name= Jones, Smith, Curry, Lindsay! customer-street= Main, North, Park Then r=[ (Jones, Main, Harrison,'A customer-city Harrison, Rye ittsfieldy (Smith, North, Rye (Curry, North, Rye) (Lindsay, Park, Pittsfield)y is a relation over customer-name x customer-street X customer-city Database System Concepts 3.3 OSilberschatz, Korth and Sudarshan
Database System Concepts 3.3 ©Silberschatz, Korth and Sudarshan Basic Structure Formally, given sets D1 , D2 , …. Dn a relation r is a subset of D1 x D2 x … x Dn Thus a relation is a set of n-tuples (a1 , a2 , …, an ) where each 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 x customer-street x customer-city
Attribute Types 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 divisible E.g. multivalued attribute values are not atomic E.g. 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 we shall ignore the effect of null values in our main presentation and consider their effect later 你忘利 Database System Concepts 3.4 OSilberschatz, Korth and Sudarshan
Database System Concepts 3.4 ©Silberschatz, Korth and Sudarshan Attribute Types 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 E.g. multivalued attribute values are not atomic E.g. 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 we shall ignore the effect of null values in our main presentation and consider their effect later
Relation schema Al, A2,..., An are attributes 只=(A1,A2,…,An) is a relation schema E.g. Customer-schema (customer-name, customer-street, customer-city) rR)is a relation on the relation schema R E.g. customer (Customer-schema) 标 Database System Concepts 3.5 OSilberschatz, Korth and Sudarshan
Database System Concepts 3.5 ©Silberschatz, Korth and Sudarshan Relation Schema 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)