高级数据库系统第二章关系模型.ppt
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《高级数据库系统第二章关系模型.ppt》由会员分享,可在线阅读,更多相关《高级数据库系统第二章关系模型.ppt(96页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Database System Concepts,5th Ed.Silberschatz,Korth and SudarshanSee www.db-for conditions on re-use Chapter 2:Relational ModelSilberschatz,Korth and Sudarshan 2.2 Database System Concepts-5th Edition,June 15,2005Chapter 2:Relational Modeln Structure of Relational Databasesn Fundamental Relational-Al
2、gebra-Operationsn Additional Relational-Algebra-Operationsn Extended Relational-Algebra-Operationsn Null Valuesn Modification of the DatabaseSilberschatz,Korth and Sudarshan 2.3 Database System Concepts-5th Edition,June 15,2005Example of a RelationSilberschatz,Korth and Sudarshan 2.4 Database System
3、 Concepts-5th Edition,June 15,2005Attribute Typesn Each attribute of a relation has a namen The set of allowed values for each attribute is called the domain of the attributen Attribute values are(normally)required to be atomic;that is,indivisiblel E.g.the value of an attribute can be an account num
4、ber,but cannot be a set of account numbersn Domain is said to be atomic if all its members are atomicn The special value null is a member of every domainn The null value causes complications in the definition of many operationsl We shall ignore the effect of null values in our main presentation and
5、consider their effect laterSilberschatz,Korth and Sudarshan 2.5 Database System Concepts-5th Edition,June 15,2005Relation Scheman Formally,given domains D1,D2,.Dn a relation r is a subset of D1 x D2 x x DnThus,a relation is a set of n-tuples(a1,a2,an)where each ai Din Schema of a relation consists o
6、fl attribute definitions 4 name4 type/domainl integrity constraintsSilberschatz,Korth and Sudarshan 2.6 Database System Concepts-5th Edition,June 15,2005Relation Instancen The current values(relation instance)of a relation are specified by a tablen An element t of r is a tuple,represented by a row i
7、n a tablen Order of tuples is irrelevant(tuples may be stored in an arbitrary order)JonesSmithCurryLindsaycustomer_nameMainNorthNorthParkcustomer_streetHarrisonRyeRyePittsfieldcustomer_citycustomerattributes(or columns)tuples(or rows)Silberschatz,Korth and Sudarshan 2.7 Database System Concepts-5th
8、Edition,June 15,2005Databasen A database consists of multiple relationsn Information about an enterprise is broken up into parts,with each relation storing one part of the informationn E.g.account:information about accounts depositor:which customer owns which account customer:information about custo
9、mersSilberschatz,Korth and Sudarshan 2.8 Database System Concepts-5th Edition,June 15,2005The customer RelationSilberschatz,Korth and Sudarshan 2.9 Database System Concepts-5th Edition,June 15,2005The depositor RelationSilberschatz,Korth and Sudarshan 2.10 Database System Concepts-5th Edition,June 1
10、5,2005Why Split Information Across Relations?n Storing all information as a single relation such as bank(account_number,balance,customer_name,.)results inl repetition of information 4 e.g.,if two customers own an account(What gets repeated?)l the need for null values 4 e.g.,to represent a customer w
11、ithout an accountn Normalization theory(Chapter 7)deals with how to design relational schemasSilberschatz,Korth and Sudarshan 2.11 Database System Concepts-5th Edition,June 15,2005Keysn Let K Rn K is a superkey of R if values for K are sufficient to identify a unique tuple of each possible relation
12、r(R)l by“possible r”we mean a relation r that could exist in the enterprise we are modeling.l Example:customer_name,customer_street and customer_name are both superkeys of Customer,if no two customers can possibly have the same name4 In real life,an attribute such as customer_id would be used instea
13、d of customer_name to uniquely identify customers,but we omit it to keep our examples small,and instead assume customer names are unique.Silberschatz,Korth and Sudarshan 2.12 Database System Concepts-5th Edition,June 15,2005Keys(Cont.)n K is a candidate key if K is minimalExample:customer_name is a
14、candidate key for Customer,since it is a superkey and no subset of it is a superkey.n Primary key:a candidate key chosen as the principal means of identifying tuples within a relationl Should choose an attribute whose value never,or very rarely,changes.l E.g.email address is unique,but may changeSil
15、berschatz,Korth and Sudarshan 2.13 Database System Concepts-5th Edition,June 15,2005Foreign Keysn A relation schema may have an attribute that corresponds to the primary key of another relation.The attribute is called a foreign key.l E.g.customer_name and account_number attributes of depositor are f
16、oreign keys to customer and account respectively.l Only values occurring in the primary key attribute of the referenced relation may occur in the foreign key attribute of the referencing relation.Silberschatz,Korth and Sudarshan 2.14 Database System Concepts-5th Edition,June 15,2005Schema DiagramSil
17、berschatz,Korth and Sudarshan 2.15 Database System Concepts-5th Edition,June 15,2005Query Languagesn Language in which user requests information from the database.n Categories of languagesl Procedurall Non-procedural,or declarativen“Pure”languages:l Relational algebral Tuple relational calculusl Dom
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 高级 数据库 系统 第二 关系 模型
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内