幻燈片(共3張)_第1頁
幻燈片(共3張)_第2頁
幻燈片(共3張)_第3頁
幻燈片(共3張)_第4頁
幻燈片(共3張)_第5頁
已閱讀5頁,還剩23頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、幻燈片幻燈片1(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models Rationale 基本原理基本原理Databases are an integral part of an organization. Aspiring Database Developers should be able to efficiently design and implement databases. 數據庫是一個組織整體的一部分。好的數據庫開發者應該能數據庫是一個組織整體的一部分。好的數據庫開發者應該能夠高效地設計和實現數據庫。夠高效地設計和實現數據庫。Knowled

2、ge of these will enable the developers to build robust database solutions. 這些知識將使開發者能夠創建健壯的數據庫解決方案。這些知識將使開發者能夠創建健壯的數據庫解決方案。This module will help students understand concepts related to relational databases. 此模塊將幫助學員理解關系數據庫的相關概念。此模塊將幫助學員理解關系數據庫的相關概念。幻燈片幻燈片2(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Mod

3、els在本章中,您將學習:在本章中,您將學習: Define a Database Management System 定義數據庫管理系統定義數據庫管理系統 Describe the types of data models 描述數據模型類型描述數據模型類型 Create an entity-relationship model 創建實體關系模型創建實體關系模型 List the types of relationships between entities 列出實體之間的關系類型列出實體之間的關系類型 Define a Relational Database Management Syste

4、m 定義關系數據庫管理系統定義關系數據庫管理系統 Describe the operators that work on relations 描述作用于關系的操作符描述作用于關系的操作符 Objectives 目標目標幻燈片幻燈片3(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsA database is a collection of logically related information. 數據庫是一個邏輯上相關的信息的集合。數據庫是一個邏輯上相關的信息的集合。Database Management is the task of maint

5、aining databases so that information is readily available. 數據庫管理是一個維護數據庫以便信息能夠使用的任務。數據庫管理是一個維護數據庫以便信息能夠使用的任務。The software required to perform the task of database management is called a Database Management System (DBMS). 執行數據庫管理任務所需的軟件稱為數據庫管理系統執行數據庫管理任務所需的軟件稱為數據庫管理系統(DBMS)。I、Database Management Syst

6、ems 數據庫管理系統數據庫管理系統幻燈片幻燈片4(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models數據模型可以分成兩類:數據模型可以分成兩類: Object-based logical model 基于對象的邏輯模型:基于對象的邏輯模型: focuses on describing the data, the relationship among the data, and any constraints defined 著重于描述數據、數據以及為數據定義的約束之間的關系。著重于描述數據、數據以及為數據定義的約束之間的關系。 Record-base

7、d logical model 基于記錄的邏輯模型:基于記錄的邏輯模型: focuses on describing the data structure and the access techniques in the DBMS 著重于描述數據庫管理著重于描述數據庫管理系統中的數據結構和訪問技術。系統中的數據結構和訪問技術。II、Data Models 數據模型數據模型幻燈片幻燈片5(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsThere are various object-based models. The most widely used

8、 is the Entity-Relationship model (ER model) introduced by Peter Chen. 有各種基于對象的模型。最常用的是由Peter Chen 在1976年引入的實體關系 (ER) 模型。III、基于對象的邏輯模型基于對象的邏輯模型END-DTTitleCodeSTART-DTSEM#SEMESTERCOURSETAUGHT幻燈片幻燈片6(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsChen defined an entity as “a thing, which can be easily

9、identified”.Chen 將實體將實體 定義為定義為“可以簡單識別的物體可以簡單識別的物體”。An entity is any object, place, person, or activity about which data is recorded. 實體是任何一個對象、位置、人物或記錄數據實體是任何一個對象、位置、人物或記錄數據的操作。的操作。In the diagramming technique, entities are named and represented inside a box. 在圖表技術中,實體在框中命名和表在圖表技術中,實體在框中命名和表示。示。An e

10、ntity type is a set of things that share common properties:實體類型是一組擁有共同屬性的事物的集合:實體類型是一組擁有共同屬性的事物的集合: STUDENT、COURSE 和和 GRADE是實體類型的例子。是實體類型的例子。 An entity type is usually in uppercase. 實體類型通常是大實體類型通常是大寫的。寫的。1、Entities 實體實體幻燈片幻燈片7(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsTypes of Entities 實體的類型:實體的

11、類型: Dependent entity 相關實體:相關實體: Is an entity whose existence depends on the existence of another entity and are also called weak entities 一個實體的存在要依賴于另一個實體的存在,一個實體的存在要依賴于另一個實體的存在,那么這個實體稱為相關實體。它也稱為弱實體。那么這個實體稱為相關實體。它也稱為弱實體。 Independent entity 獨立實體:獨立實體: Is an entity which does not depend on any other e

12、ntity for existence and are also called regular entities 獨立實體不依賴于任何其他實例的存在。它也獨立實體不依賴于任何其他實例的存在。它也稱為常規實體。稱為常規實體。 Entities (Contd.) 實體(續)實體(續)COURSE幻燈片幻燈片8(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsChen defines a relationship as “an association among entities”. Chen 將關系定義為將關系定義為“實體之間的聯系實體之間的聯系”。 F

13、or example, the relationship between students and instructors represents the fact that an instructor teaches several students and a student is taught by several instructors. This relationship could be named TEACH. 例如,在學生和老師之間有一個關系。這個關系例如,在學生和老師之間有一個關系。這個關系代表老師可以教幾個學生,而學生可以由幾個老師教。這代表老師可以教幾個學生,而學生可以由幾

14、個老師教。這個關系可命名為個關系可命名為 TEACH。Relationships are depicted as a diamond with the name of the relationship type. 用一個帶有關系類型名稱的菱形來描用一個帶有關系類型名稱的菱形來描述關系。述關系。2、Relationships 關系關系幻燈片幻燈片9(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsA relationship type is an association of entity types (STUDENT-INSTRUCTOR). 關系類

15、型是實體類型的聯合關系類型是實體類型的聯合 (STUDENT-INSTRUCTOR)。)。A relationship can associate an entity with itself. For example, one instructor in a university may marry another instructor. 關系可以將實體本身聯系起來。例如,學校的老師關系可以將實體本身聯系起來。例如,學校的老師可以和另一位老師結婚。可以和另一位老師結婚。相同實體中可以存在多個關系。相同實體中可以存在多個關系。Relationships (Contd.) 關系(續)關系(續)IN

16、STRUCTERSTUDENTTEACHMARRYTEACHERTEACHERSTUDENTTEACHMANAGEEVALUATE幻燈片幻燈片10(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsJust a minute 課間思考課間思考The following statement has been extracted from a case presented by a manufacturer regarding the maintenance of their data: “A supplier ships certain parts.”

17、Identify the entities mentioned in this statement, and their relationship. Draw a diagram depicting the relationship. 從某個案例中抽取了以下語句,這個案例是有關一個生產廠商從某個案例中抽取了以下語句,這個案例是有關一個生產廠商的數據維護:的數據維護:“供應商供應某些部件供應商供應某些部件”。請確定此語句中涉及。請確定此語句中涉及的實體和它們之間的關系。請畫圖描述。的實體和它們之間的關系。請畫圖描述。答案:答案: 實體:實體: SUPPLIER, PARTS 關系:關系: SHI

18、P (或(或 SHIPMENT)SUPPLIERSPARTSSHIP幻燈片幻燈片11(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models3、Types of Relationships 關系類型關系類型There are three types of relationships 有三種關系類型:有三種關系類型: One-to-One 一對一一對一 One-to-Many (or Many-to-One) 一對多(或多對一)一對多(或多對一) Many-to-Many 多對多多對多幻燈片幻燈片12(共(共34張)張)第第1章章Ver. 1.0Chapte

19、r01_01 Data ModelsConsider the example of a university. For one DEPARTMENT (like the department of social sciences) there can be only one department head. This is a one-to-one relationship. 請考慮一個學校示例。對于某個請考慮一個學校示例。對于某個DEPARTMENT(如社會科學(如社會科學系),只有一位系主任。這就是一對一關系的示例。系),只有一位系主任。這就是一對一關系的示例。(1)One-to-One

20、Relationship 一對一關系一對一關系幻燈片幻燈片13(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsA STUDENT can MAJOR in only one course, but many STUDENTs would have registered for a given MAJOR course. This is a many-to-one relationship. 學生可以主修一門課程,但是許多學生可以同時注冊一個給學生可以主修一門課程,但是許多學生可以同時注冊一個給定的主修課程。這就是多對一的關系。定的主修課程。這就是多

21、對一的關系。(2) Many-to-One Relationship 多對一關系多對一關系幻燈片幻燈片14(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsA STUDENT can take many COURSEs and many STUDENTs can register for a given COURSE. This is a many-to-many relationship. 一個學生可以上多門一個學生可以上多門 課程。多個學生課程。多個學生 可以注冊一門給定的可以注冊一門給定的課程。這就是多對多的關系。課程。這就是多對多的關系。(3

22、)Many-to-Many Relationship 多對多關系多對多關系幻燈片幻燈片15(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models課間思考課間思考What do the following ER diagrams represent? 以下以下 ER 圖圖表達了什么?表達了什么?答案:答案: 多個學生可以進行多個項目。多個學生可以進行多個項目。 多個員工僅屬于一個部門。多個員工僅屬于一個部門。幻燈片幻燈片16(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models課間思考課間思考Consider the

23、 following statement of a manufacturing company: “A supplier ships certain parts. A particular part is not necessarily shipped by only one supplier. No supplier ships only a single part.” What type of relationship is this? Draw a diagram to depict the relationship. 請注意生產公司的以下語句:供應商供應一些請注意生產公司的以下語句:供

24、應商供應一些部件。某個特定部件不必要僅由一個供應商來供應,沒有一個供部件。某個特定部件不必要僅由一個供應商來供應,沒有一個供應商只供應一個部件。應商只供應一個部件。” 這是一種什么關系?請畫圖描述。這是一種什么關系?請畫圖描述。答案:多對多類型SUPPLIERPARTSSHIPm m幻燈片幻燈片17(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsAttributes are a property of a given entity. 屬性是給定實屬性是給定實體的特性。體的特性。Attributes are depicted as ellipses,

25、 labeled with the name of the property. 屬性可以用橢圓表示,其中標有屬性名。屬性可以用橢圓表示,其中標有屬性名。The key properties are underlined, a key property uniquely identified an entity instance. 鍵屬性用下劃線表示鍵屬性用下劃線表示 ,鍵屬性唯一的確定了一個實體對象。鍵屬性唯一的確定了一個實體對象。 4、Attributes 屬性屬性ADDRESSNAMEROLL_NOREG_DTSTUDENT幻燈片幻燈片18(共(共34張)張)第第1章章Ver. 1.0Ch

26、apter01_01 Data Models課間思考課間思考A manufacturer needs to maintain the following details about the supplier 廠商需要維護以下有關供應商的詳細信廠商需要維護以下有關供應商的詳細信息:息:a. Name 名稱名稱b. Address 地址地址c. Credit Status 信用狀態信用狀態d. Assigned code number 分配的代碼號分配的代碼號 Draw a diagram to show this information 請畫出一張描請畫出一張描述這些信息的圖。述這些信息的圖。C

27、ODECR_STATUSADDNAMESUPPLIER幻燈片幻燈片19(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsSubtype 子類型:子類型: Is a subset of another entity. It is always dependent on the supertype for its existence 子類型是另一個實體的子子類型是另一個實體的子集。它的存在始終依賴于超級類型。集。它的存在始終依賴于超級類型。 Is connected to the supertype by an unnamed relationship

28、子類型通過未命名的關系連接到超級類型。子類型通過未命名的關系連接到超級類型。Supertype 超級類型:超級類型: Is connected to the relationship with a line containing a crossbar 超級類型通過一條包含交叉欄的線條連接到關系超級類型通過一條包含交叉欄的線條連接到關系成員。成員。 Is described by attributes that belong to all subtypes. The subtype is described by the attributes that are unique to it 超級類型

29、由屬于所有子類型的屬性來描述。子超級類型由屬于所有子類型的屬性來描述。子類型由其唯一的屬性來描述。類型由其唯一的屬性來描述。5、Subtypes and Supertypes 子類型和超級類型子類型和超級類型幻燈片幻燈片20(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data ModelsSubtypes and Supertypes 子類型和超級類型子類型和超級類型CODECONTENTNAMECOURSESTANDALONESEMESTERDUARATIONSEMESTER_NO超類型子類型幻燈片幻燈片21(共(共34張)張)第第1章章Ver. 1.0Chapt

30、er01_01 Data Models課間思考課間思考There are two types of suppliers. One type of supplier allows credit, while the other type insists on payment in cash before delivery. The manufacturer wishes to maintain separate information on these two types of suppliers. For the credit supplier, “credit period” and “cr

31、edit limit” have to be recorded. For the cash supplier, “date of payment” has to be stored. Represent this diagrammatically. 有兩種類型的供應商。一種供應商允許用信用卡支付,而另一有兩種類型的供應商。一種供應商允許用信用卡支付,而另一種堅持在發貨之前現金支付。廠商希望對這兩種類型的供應商種堅持在發貨之前現金支付。廠商希望對這兩種類型的供應商維護不同的信息,對于信用支付的供應商需要記錄維護不同的信息,對于信用支付的供應商需要記錄“信用周期信用周期”和和 “信用極限信用極限”

32、,對現金支付的供應商,需要存儲,對現金支付的供應商,需要存儲“支付日支付日期期”。請用圖形來表示。請用圖形來表示。幻燈片幻燈片22(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models課間思考課間思考Answer:SUPPLIERSCREDITCASHPAY_DTCR_PERIODCR_LIMIT幻燈片幻燈片23(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models IV Record-Based Logical Model 基于記錄的邏輯模型基于記錄的邏輯模型The three types of record-b

33、ased models are 三種基于記錄的模三種基于記錄的模型類型是:型類型是: Hierarchical model 層次模型層次模型 In a hierarchical model, data is represented in the form of a tree 在分層模型中,數據以樹的形式表示。在分層模型中,數據以樹的形式表示。 Network model 網絡模型網絡模型 A network model is similar to a hierarchical model in the way that data and the relationships among them

34、 are represented in the form of records and links. 網絡模型網絡模型類似于這樣一個分層模型,在模型中,數據和數據之間的關類似于這樣一個分層模型,在模型中,數據和數據之間的關系以記錄和鏈接的形式表示。系以記錄和鏈接的形式表示。 Relational model 關系模型關系模型 In the relational model, the database is structured in fixed-format records of several types. 在關系模型中,在關系模型中,數據庫中的表有固定的記錄長度和固定數量的屬性或字段。數據

35、庫中的表有固定的記錄長度和固定數量的屬性或字段。幻燈片幻燈片24(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models1、Relational Model 關系模型關系模型Dr. E. F. Codd first described the relational model in 1970. Dr. E. F. Codd 第一次描述關系模型是在第一次描述關系模型是在1970 年。年。Relational model is an attempt to simplify the database structure. 關系模型是一種簡化數據庫結構的嘗試。關系

36、模型是一種簡化數據庫結構的嘗試。It represents all data in the database as simple tables in the row-column format. 它將數據庫中的所有數據表示為以它將數據庫中的所有數據表示為以行和列為格式的一張簡單表。行和列為格式的一張簡單表。P1.16RDBMS can be defined as a DBMS where all data visible to the user is organized strictly as tables of data values and where all database opera

37、tions work on these tables. RDBMS 可以定義為數據庫關系系統,其中用戶可見的所有數可以定義為數據庫關系系統,其中用戶可見的所有數據都嚴格以數據值表的形式組織,所有數據庫操作都是在這些據都嚴格以數據值表的形式組織,所有數據庫操作都是在這些表上完成的。表上完成的。幻燈片幻燈片25(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models 2、Relational Data Structure 關系數據結構關系數據結構The organizing principle in a relational database is the t

38、able, a tabular arrangement of data values 關系數據庫中的組織原則是表,數據值在表中關系數據庫中的組織原則是表,數據值在表中是行列排列的:是行列排列的:A table is called a relation 表稱為關系。表稱為關系。The row (or record) in the table is called a tuple 表中的行(或記錄)表中的行(或記錄)稱為元組。稱為元組。The column (or field) is called an attribute. 列(或字段)稱為屬性。列(或字段)稱為屬性。The number of t

39、uples is called the cardinality, and the number of attributes is called the degree of the table. 元組數稱為表為基數,屬性元組數稱為表為基數,屬性號稱為表的等級。號稱為表的等級。Rows are unordered and each row must have some columns or a combination of columns that uniquely identifies each row, called the primary key of the table. 行是無序的,并且

40、每行必須有能夠唯一識別表行是無序的,并且每行必須有能夠唯一識別表中每個行的一些列或列的組合。該列(或多個列)稱為表的主鍵。中每個行的一些列或列的組合。該列(或多個列)稱為表的主鍵。A domain is a pool of values from which one or more attributes (columns) draw their actual values. 域是一個值集,在集合中,一個或多個屬性(列)域是一個值集,在集合中,一個或多個屬性(列)顯示它們的實際值。顯示它們的實際值。幻燈片幻燈片26(共(共34張)張)第第1章章Ver. 1.0Chapter01_01 Data Models3、Representing Missing Information 表示丟失表示丟失的信息的信息Missing or unknown information is represented as NULL in a re

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論