西安电子科技大学:《数据库系统 DataBase System》课程教学资源(PPT课件讲稿)Unit 2 The Relational Model

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)

DataBase System K Mathematical Relations a The current values( relation instance,关系实例) of a relation are specified by a table E An element t of ris a tuple(T-a), represented by a row in a table H Order of tuples is irrelevant(元组是无序的 tuples may be stored in an arbitrary order) attributes (or columns) customer_namecustomer_street customer_city Jones Main Harrison Smith North Rye tuples Curry North Rye y(or rows) Lindsay Park Pittsfie/d customer Haichang Gao, Software School, Xidian University 8
DataBase System Haichang Gao , Software School , Xidian University 8 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) Jones Smith Curry Lindsay customer_name Main North North Park customer_street Harrison Rye Rye Pittsfield customer_city customer attributes (or columns) tuples (or rows)

DataBase System Relational database E A Relational database consists of multiple relations E Information about an enterprise is broken up into parts, with each relation storing one part of the information G Example customer_id I customer_ namel customer street customer cit 19283-7465J ohnson 12 Alma st Palo alto 677-89-9011 Hayes 3 Main st H arrison 182-73-6091 Turner 123 Putnam Ave. Stamford 321-12-3123 Jones 100 Main St Harrison 336-66-9999 Lindsay 175 Park Ave Pittsfield 019-28-3746 Smith 72 North st R ve (a) The customer table The customer table stores information about customers Haichang Gao, Software School, Xidian University
DataBase System Haichang Gao , Software School , Xidian University 9 Relational Database A Relational database consists of multiple relations Information about an enterprise is broken up into parts, with each relation storing one part of the information Example: The customer table stores information about customers

DataBase System Relational database account_number branch_name balance customer_id I account-number A-101 Downtown500 192-83-7465 A-101 A-215 Mianus 700 19283-7465A-201 A-102 Perryridge 400 019-28-3746 A-215 A-305 Round Hill 350 677-89-9011 A-102 A-201 Brighton 900 182-73-609 A-305 A-222 Redwood 700 321-12-3123 A-217 A-217 Brighton 750 336-66-9999 A-222 019-283746 A-201 (b) The account table (c) The depositor table The account table stores information about accounts The depositor table containing information about which customer owns which account Storing all information as a single relation is NoT a good idea! Haichang Gao, Software School, Xidian University 10
DataBase System Haichang Gao , Software School , Xidian University 10 Relational Database (b) The account table (c) The depositor table The account table stores information about accounts. The depositor table containing information about which customer owns which account Storing all information as a single relation is NOT a good idea!

DataBase System 沙Key Let Kcr e K is a superkey(ig)of R if values for K are sufficient to identify a unique tuple of each possible relation r(R) custoer id customer name Customer street customer cit 192-83-7465 Johnson 12 Alma St Palo alto 677-89-9011 Hayes 3 Main st Harrison 182-73-609 Turner 123 Putnam Ave Stamford 321-12-3123 ones 100 Main St Harrison 336-66-9999 Lindsay 175 Park Ave Pittsfield 019-28-3746 Smith 72 North St Rve (a) The customer table E Example: customer id, customer name) and customer id are both superkeys of Customer a by possible r” ve mean a relation r that could exist in the enterprise we are modeling Haichang Gao, Software School, Xidian University 11
DataBase System Haichang Gao , Software School , Xidian University 11 Key Let K R K is a superkey(超码) of R if values for K are sufficient to identify a unique tuple of each possible relation r(R). Example: {customer_id, customer_name} and {customer_id} are both superkeys of Customer. by “possible r ” we mean a relation r that could exist in the enterprise we are modeling

DataBase System 沙Key Let Kcr e K is a superkey(ig)of R if values for K are sufficient to identify a unique tuple of each possible relation r(R) g K is a candidate key(候选码) if K is minimal customer-id customer-name custommer street customer -city 192-83-7465 Johnson 12 Alma St Palo alto 677-89-9011 laves 3 Main st H larrison 182-73-6091 Turner 123 Putnam Ave.Stamford 321-12-3123Jo ones 100 Main St Harrison 336-66-9999 Lindsay 175 Park Ave Pittsfield 019-28-3746 Smith 72 North St Rve (a) The customer table H Example: customer id, is a candidate key for Customer since it is a superkey and no subset of it is a superkey H customer name is a candidate key also, assuming no two customers can possibly have the same name Haichang Gao, Software School, Xidian University 12
DataBase System Haichang Gao , Software School , Xidian University 12 Key Let K R K is a superkey(超码) of R if values for K are sufficient to identify a unique tuple of each possible relation r(R). K is a candidate key(候选码) if K is minimal. Example: {customer_id} is a candidate key for Customer, since it is a superkey, and no subset of it is a superkey. {customer_name} is a candidate key also, assuming no two customers can possibly have the same name
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 西安电子科技大学:《Mobile Programming》课程PPT教学课件(Android Programming)Lecture 2 Intro to Java Programming.pptx
- 《计算机网络》课程教学资源(考试大纲)计算机网络考试大纲.doc
- 《数据结构与算法》课程教学资源(PPT课件讲稿)第三章 树 3.1 树的有关定义.ppt
- 西安培华学院:《微机原理》课程教学资源(PPT课件讲稿)第一章 绪论.ppt
- 《单片机原理及应用》课程PPT教学课件(C语言版)第4章 C51程序设计入门(单片机C语言及程序设计).ppt
- 《Visual Basic程序设计》课程教学资源(PPT课件讲稿)第四章 VB的基本语句.pps
- 哈尔滨工业大学:再探深度学习词向量表示(PPT课件讲稿)Advanced word vector representations(主讲人:李泽魁).ppt
- 中国科学技术大学:《Linux操作系统分析》课程教学资源(PPT课件讲稿)文件系统.ppt
- 华北科技学院:数字视频教学软件与制作(PPT课件讲稿)数字视频编辑软件Premiere 6.5(主讲:于文华).ppt
- Introduction to Convolution Neural Networks(CNN)and systems.pptx
- 《编译原理》课程教学资源(PPT课件讲稿)第八章 代码生成.ppt
- 《数字图像处理》课程PPT教学课件(讲稿)第四章 点运算.ppt
- 《计算机系统安全》课程教学资源(PPT课件讲稿)第七章 公开密钥设施PKI Public key infrastructure.ppt
- 《密码学》课程教学资源(PPT课件讲稿)第10章 密码学的新方向.ppt
- 清华大学:Local Area Network and Ethernet(PPT课件讲稿).pptx
- 《计算机组成与设计》课程教学资源(PPT课件讲稿)第2章 指令——计算机的语言.ppt
- 《数据挖掘导论 Introduction to Data Mining》课程教学资源(PPT课件讲稿)Data Mining Classification(Basic Concepts, Decision Trees, and Model Evaluation).ppt
- 《微型计算机原理及接口技术》课程电子教案(PPT课件)第9章 AT89S52单片机的I/O扩展.ppt
- 四川大学:《计算机网络 Computer Networks》课程教学资源(PPT课件讲稿)Unit5 Introduction to Computer Networks.ppt
- 《计算机软件技术基础》课程教学资源(PPT课件讲稿)排序(教师:曾晓东).ppt
- 《C语言程序设计》课程教学资源(PPT课件讲稿)第6章 用数组处理批量数据.pptx
- 电子工业出版社:《计算机网络》课程教学资源(第六版,PPT课件讲稿)第六章 应用层.pptx
- 清华大学:《计算机导论》课程电子教案(PPT教学课件)第3章 计算机基础知识.ppt
- 中国科学技术大学:《现代密码学理论与实践》课程教学资源(PPT课件讲稿)第4章 有限域(第五版).pptx
- 西安电子科技大学:《数据库系统 DataBase System》课程教学资源(PPT课件讲稿)Unit 3 SQL.ppt
- 《人工智能技术导论》课程教学资源(PPT课件讲稿)第2章 逻辑程序设计语言.ppt
- 《数据结构》课程教学资源(PPT课件讲稿)第六章 查找.ppt
- 上海交通大学:云安全(PPT讲稿)Cloud Security.pptx
- 《计算机网络》课程教学大纲(适用专业:信息与计算科学).pdf
- 江苏大学:《面向对象建模技术》课程教学资源(PPT课件讲稿)第2章 用例图.ppt
- 《网络营销实务》课程教学资源(PPT课件讲稿)第二章 网络营销环境分析.ppt
- 《数据结构》课程教学资源(PPT课件讲稿)第七章 搜索结构第七章 搜索结构.ppt
- 丽水职业技术学院:《电子商务实训》课程教学资源(PPT课件讲稿)电子商务交易模式之“B2B”——电子合同模式.ppt
- 《电子商务概论》课程教学资源(PPT课件讲稿)第六章 电子商务支付技术.ppt
- 浙江长征职业技术学院:计算机信息管理专业课程教学大纲汇编.doc
- 北京林业大学:《深度学习》课程PPT教学课件(Deep Learning)第二章 神经网络与优化方法(主讲:孙钰).pptx
- 《Advanced Artificial Intelligence》课程PPT教学课件(高级人工智能)Lecture 5 Neural Networks.pptx
- 《Advanced Artificial Intelligence》课程PPT教学课件(高级人工智能)Lecture 3 Decision Tree.pptx
- 《Advanced Artificial Intelligence》课程PPT教学课件(高级人工智能)Lecture 6 Convolutional Neural Network.pptx
- 《操作系统》课程教学资源(PPT课件讲稿)文件管理 File Management.ppt