Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to Relational Databases Prof. Yin-Fu Huang CSIE, NYUST Chapter 3.

Similar presentations


Presentation on theme: "An Introduction to Relational Databases Prof. Yin-Fu Huang CSIE, NYUST Chapter 3."— Presentation transcript:

1 An Introduction to Relational Databases Prof. Yin-Fu Huang CSIE, NYUST Chapter 3

2 Advanced Database SystemYin-Fu Huang 3.2An Informal Look at the Relational Model Structural aspect Integrity aspect Manipulative aspect Example (See Fig. 3.1 & 3.2)  Primary key  Foreign key

3 Advanced Database SystemYin-Fu Huang Points from Fig. 3.2: a. the closure property of relational systems b. set-at-a-time Example (Fig. 3.2)

4 Advanced Database SystemYin-Fu Huang Points from Fig. 3.1: a. Tables are the logical structure, not the physical structure. b. The entire information content of the database is represented in one and only one way, namely as explicit values. Example (Fig. 3.1)

5 Advanced Database SystemYin-Fu Huang 3.3Relations and Relvars Relation ? ⇒ a mathematical term for a table (set theory and predicate logic) Relation model ⇒ E. F. Codd (1969-1970) Delete Emp Where Emp#=‘E4’ (See Fig. 3.3) A relation variable vs. a relation per se

6 Advanced Database SystemYin-Fu Huang 3.4What Relations Mean Two parts: the heading & the body (See Fig. 3.4) Thinking about relations: a. predicate b. true proposition

7 Advanced Database SystemYin-Fu Huang 3.5Optimization Relational languages are often said to be nonprocedural, on the grounds that users specify what, not how. Procedurality and nonprocedurality are not absolute. Optimizer: automatic navigation (See Fig. 3.5) ⇒ an efficient way  Example: Result:=(Emp Where Emp#=‘E4’) {Salary}; a. a physical sequential scan of relvar Emp b. an index on the Emp#

8 Advanced Database SystemYin-Fu Huang Automatic vs. manual navigation (Fig. 3.5)

9 Advanced Database SystemYin-Fu Huang 3.5Optimization (Cont.) The considerations: a. Which relvars are referenced in the request b. How big those relvars currently are c. What indexes exist d. How selective those indexes are e. How the data is physically clustered on the disk f. What relational operations are involved Automatic navigation ⇒ data independence

10 Advanced Database SystemYin-Fu Huang 3.6The Catalog Users can interrogate the catalog in exactly the same way they interrogate their own data. Example (See Fig. 3.6) (Column Where Tabname=‘Dept’) {Colname}

11 Advanced Database SystemYin-Fu Huang Base relvars vs. derived relvars A view can be thought of, loosely, as a derived relvar. Example: Create View TopEmp As (Emp Where Salary > 33K) {Emp#, Ename, Salary}; The view defining expression is not evaluated but is merely “remembered” by the system in some way. ⇒ a virtual relvar A window into the base relvar Any changes: view ⇔ base relvars  Example: (TopEmp Where Salary < 42K) {Emp#, Salary} (Emp Where Salary > 33K And Salary < 42K) {Emp#, Salary} 3.7Base Relvars and Views

12 Advanced Database SystemYin-Fu Huang 3.8Transactions A transaction is a logical unit of work. Operations: Begin Transaction, Commit, Rollback Points arising: a. atomic b. durable c. isolated d. serializable

13 Advanced Database SystemYin-Fu Huang 3.9The Suppliers and Parts Database Example (See Fig. 3.8 & 3.9) Entity and Relationship (a special case of an entity)

14 Advanced Database SystemYin-Fu Huang The suppliers and parts database (Fig. 3.9)

15 Advanced Database SystemYin-Fu Huang The End.


Download ppt "An Introduction to Relational Databases Prof. Yin-Fu Huang CSIE, NYUST Chapter 3."

Similar presentations


Ads by Google